Skip to content

Commit

Permalink
Reattempt
Browse files Browse the repository at this point in the history
  • Loading branch information
ggcrunchy committed Dec 3, 2023
1 parent 255c048 commit 361c9d7
Show file tree
Hide file tree
Showing 55 changed files with 1,729 additions and 320 deletions.
78 changes: 69 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,38 @@ jobs:
name: CoronaCards-iOS
path: ./output

<<<<<<< HEAD
=======

CoronaCards-iOS-angle:
needs: source-code
runs-on: macos-13
steps:
- run: CDR="$(basename "$(pwd)")" ; cd .. ; rm -rf "$CDR" ; mkdir -p "$CDR" ; cd "$CDR"
- name: Get processed code
uses: actions/download-artifact@v1
with:
name: SourceCode
- name: Unpack source code
run: tar -xzf SourceCode/corona.tgz
- run: ./tools/GHAction/daily_env.sh
- name: Corona Cards framework for iOS
working-directory: ./platform/iphone
run: |
xcodebuild -scheme CoronaCards-angle.framework -project ratatouille.xcodeproj -configuration Release -sdk iphoneos build -derivedDataPath "$(pwd)/build"
cd build/Build/Products/Release-iphoneos
rm -rf CoronaCards.framework
cp -R CoronaCards-angle.framework/CoronaCards-angle CoronaCards-angle.framework/CoronaCards
ln -s CoronaCards-angle.framework CoronaCards.framework
mkdir "${WORKSPACE}/output"
zip -r -y -o "${WORKSPACE}/output"/CoronaCards-angle.zip CoronaCards-angle.framework CoronaCards.framework
- name: Upload CoronaCards framework archive
uses: actions/upload-artifact@v1
with:
name: CoronaCards-iOS-angle
path: ./output

>>>>>>> experimental
macOS-Simulator:
needs:
- source-code
Expand Down Expand Up @@ -398,12 +430,25 @@ jobs:
run: ./tools/GHAction/build_dmg.sh
env:
CERT_PASSWORD: ${{ secrets.CertPassword }}
- name: Notarize
run: |
[ -n "$APPLE_ISSUER" ] || exit 0
APPLE_KEY_FILE="$(mktemp)"
echo "$APPLE_KEY" > "$APPLE_KEY_FILE"
xcrun notarytool submit --key "$APPLE_KEY_FILE" --issuer "$APPLE_ISSUER" --key-id "$APPLE_KEY_ID" --wait ./output/*.dmg
xcrun stapler staple ./output/*.dmg
shell: bash
env: # get this at https://appstoreconnect.apple.com/access/api
APPLE_KEY: ${{ secrets.AppleKey }} ## full contents of the file
APPLE_KEY_ID: ${{ secrets.AppleKeyId }}
APPLE_ISSUER: ${{ secrets.AppleIssuer }}
- name: Upload macOS Daily build artifact
uses: actions/upload-artifact@v1
with:
name: Simulator-macOS
path: ./output

<<<<<<< HEAD
notarize:
needs:
- macOS-Simulator
Expand Down Expand Up @@ -433,28 +478,31 @@ jobs:
shell: bash
env:
APPLE_AUTH: ${{ secrets.AppleAuth }} # --username [email protected] --password secret-app-specific-pwd --asc-provider anscainc
=======
>>>>>>> experimental

check-notarization:
runs-on: macos-12
steps:
- name: Check notarization credentials
run: |
if [ -z "$APPLE_AUTH" ]
then
echo 'Skipping because no authorization provided'
exit 0
fi
[ -n "$APPLE_ISSUER" ] || exit 0
T="R7NmWb1brmEx65"
echo "::add-mask::$T"
Z="cNgt1OO-"
echo "::add-mask::$Z"
if ! eval xcrun altool $APPLE_AUTH --list-apps &> /dev/null
APPLE_KEY_FILE="$(mktemp)"
echo "$APPLE_KEY" > "$APPLE_KEY_FILE"
if ! xcrun notarytool history --key "$APPLE_KEY_FILE" --issuer "$APPLE_ISSUER" --key-id "$APPLE_KEY_ID" &> /dev/null
then
curl -X POST -H "Content-Type: application/json" -d '{"value1":"'$GITHUB_REPOSITORY'"}' https://maker.ifttt.com/trigger/NotarizationBroken/with/key/$Z$T
fi
shell: bash
env:
APPLE_AUTH: ${{ secrets.AppleAuth }} # --username [email protected] --password secret-app-specific-pwd --asc-provider anscainc
env: # get this at https://appstoreconnect.apple.com/access/api
APPLE_KEY: ${{ secrets.AppleKey }}
APPLE_KEY_ID: ${{ secrets.AppleKeyId }}
APPLE_ISSUER: ${{ secrets.AppleIssuer }}


Windows-Simulator:
needs:
Expand Down Expand Up @@ -587,6 +635,7 @@ jobs:
- linux
- CoronaCards-Android
- CoronaCards-iOS
- CoronaCards-iOS-angle
- native
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -622,6 +671,9 @@ jobs:
- uses: actions/download-artifact@v1
with:
name: CoronaCards-iOS
- uses: actions/download-artifact@v1
with:
name: CoronaCards-iOS-angle
- uses: actions/download-artifact@v1
with:
name: CoronaCards-Android
Expand Down Expand Up @@ -680,6 +732,15 @@ jobs:
asset_path: ./CoronaCards-iOS/CoronaCards.framework.zip
asset_name: CoronaCards-iOS-${{ env.YEAR }}.${{ env.BUILD }}.zip
asset_content_type: application/zip
- name: Upload Release Asset Corona Cards iOS Angle
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./CoronaCards-iOS-angle/CoronaCards-angle.zip
asset_name: CoronaCards-iOS-MetalANGLE-${{ env.YEAR }}.${{ env.BUILD }}.zip
asset_content_type: application/zip
- name: Upload Release Asset Corona Cards Android
uses: actions/upload-release-asset@v1
env:
Expand Down Expand Up @@ -748,7 +809,6 @@ jobs:
- linux
- CoronaCards-Android
- CoronaCards-iOS
- notarize
- release
- source-code
runs-on: ubuntu-20.04
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ platform/windows/**/Debug.Simulator/*
platform/windows/**/Release.App/*
platform/windows/**/Release.Simulator/*
platform/windows/**/Debug/
platform/windows/**/PreRelease/
platform/windows/**/Release/

# Android
Expand Down
7 changes: 6 additions & 1 deletion external/lua-5.1.3/src/loslib.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#ifdef NXS_LIB
struct tm* nx_localtime(const time_t* timep);
time_t nx_time(time_t* tloc);
#endif

static int os_pushresult (lua_State *L, int i, const char *filename) {
Expand Down Expand Up @@ -232,7 +233,11 @@ static int os_date (lua_State *L) {
static int os_time (lua_State *L) {
time_t t;
if (lua_isnoneornil(L, 1)) /* called without args? */
t = time(NULL); /* get current time */
#ifdef NXS_LIB
t = nx_time(NULL); /* get current time */
#else
t = time(NULL); /* get current time */
#endif
else {
struct tm ts;
luaL_checktype(L, 1, LUA_TTABLE);
Expand Down
2 changes: 1 addition & 1 deletion librtt/Core/Rtt_Allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void operator delete[]( void* p ) throw();

#ifdef __cplusplus

#if defined(Rtt_WIN_ENV) && defined(Rtt_DEBUG)
#if defined(Rtt_WIN_ENV) && defined(Rtt_DEBUG) && defined(Rtt_CHECK_MEMORY)
#define Rtt_NEW( pUnused, T ) new ( _CLIENT_BLOCK, __FILE__, __LINE__) T
#else
#define Rtt_NEW( pUnused, T ) new T
Expand Down
2 changes: 1 addition & 1 deletion librtt/Renderer/Rtt_Geometry_Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "Display/Rtt_DisplayTypes.h"
#include "Renderer/Rtt_RenderTypes.h"

#include "Corona/CoronaGraphics.h"
#include "CoronaGraphics.h"

#include <cstring>
#include <stddef.h>
Expand Down
6 changes: 2 additions & 4 deletions librtt/Renderer/Rtt_Geometry_Renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ struct GeometryWriter {
};
typedef U16 MaskBits;

// n.b. if we do these two conditions as a couple asserts in a row, Clang
// seems to treat the two conditions as being on the same line and breaks
// the macro
Rtt_STATIC_ASSERT( ( kExtra == kMain + 1 ) && ( kIsUpdate == kAll + 1 ) );
Rtt_STATIC_ASSERT( kExtra == kMain + 1 );
Rtt_STATIC_ASSERT( kIsUpdate == kAll + 1 );

static const GeometryWriter& CopyGeometryWriter();

Expand Down
2 changes: 1 addition & 1 deletion librtt/Renderer/Rtt_RenderData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "Renderer/Rtt_Geometry_Renderer.h"

#include "Core/Rtt_Assert.h"
#include "Corona/CoronaGraphics.h"
#include "CoronaGraphics.h"

// ----------------------------------------------------------------------------

Expand Down
8 changes: 4 additions & 4 deletions platform/android/Rtt_AndroidAppPackager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ AndroidAppPackager::Build( AppPackagerParams * params, const char * tmpDirBase )
gradleGo.append(" && cd template &&");

#if defined(Rtt_MAC_ENV) || defined(Rtt_LINUX_ENV)
bool java8Installed = 0 == system("JAVA_VERSION=1.8 /usr/bin/java -version > /dev/null 2>/dev/null");
if(java8Installed) {
gradleGo.append(" ./setup.sh && JAVA_VERSION=1.8 ./gradlew");
bool java11Installed = 0 == system("JAVA_VERSION=11 /usr/bin/java -version > /dev/null 2>/dev/null");
if(java11Installed) {
gradleGo.append(" ./setup.sh && JAVA_VERSION=11 ./gradlew");
} else {
Rtt_TRACE_SIM(("WARNING: Java 1.8 does not seems to be available. If build fails, install Java 1.8."));
Rtt_TRACE_SIM(("WARNING: Java 11 does not seems to be available. If build fails, install Java 1.11."));
gradleGo.append(" ./setup.sh && ./gradlew");
}
#else
Expand Down
14 changes: 7 additions & 7 deletions platform/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fun checkCoronaNativeInstallation() {
} else {
val setupNativeApp = File("/Applications").listFiles { f ->
f.isDirectory && f.name.startsWith("Corona")
}?.max()?.let {
}.maxOrNull()?.let {
"${it.absolutePath}/Native/Setup Corona Native.app"
} ?: "Native/Setup Corona Native.app"
throw InvalidUserDataException("Corona Native was not set-up properly. Launch '$setupNativeApp'.")
Expand Down Expand Up @@ -190,20 +190,20 @@ if (configureCoronaPlugins == "YES") {

android {
lintOptions {
isCheckReleaseBuilds = false
isCheckReleaseBuilds = true
}
compileSdkVersion(32)
compileSdk = 33
defaultConfig {
applicationId = coronaAppPackage
targetSdkVersion(32)
minSdkVersion(extra["minSdkVersion"] as Int)
targetSdk = 33
minSdk = (extra["minSdkVersion"] as Int)
versionCode = coronaVersionCode
versionName = coronaVersionName
multiDexEnabled = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
coronaKeystore?.let { keystore ->
signingConfigs {
Expand Down
4 changes: 2 additions & 2 deletions platform/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ buildscript {
jcenter()
}
dependencies {
classpath(kotlin("gradle-plugin", version = "1.3.70"))
classpath("com.android.tools.build:gradle:4.2.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
classpath("com.android.tools.build:gradle:7.4.2")
classpath("com.beust:klaxon:5.0.1")
}
}
Expand Down
3 changes: 2 additions & 1 deletion platform/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Mon Jul 24 23:10:14 CDT 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 0 additions & 1 deletion platform/android/ndk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ add_library( corona SHARED
${CORONA_ROOT}/librtt/Display/Rtt_LineObject.cpp
${CORONA_ROOT}/librtt/Display/Rtt_LuaLibDisplay.cpp
${CORONA_ROOT}/librtt/Display/Rtt_LuaLibGraphics.cpp
${CORONA_ROOT}/librtt/Display/Rtt_ObjectHandle.cpp
${CORONA_ROOT}/librtt/Display/Rtt_OpenPath.cpp
${CORONA_ROOT}/librtt/Display/Rtt_Paint.cpp
${CORONA_ROOT}/librtt/Display/Rtt_PaintAdapter.cpp
Expand Down
25 changes: 25 additions & 0 deletions platform/android/ndk/Rtt_AndroidTextFieldObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,26 @@ AndroidTextFieldObject::setSelection( lua_State *L )
return 0;
}

int
AndroidTextFieldObject::getSelection( lua_State *L )
{
PlatformDisplayObject *o = (PlatformDisplayObject*)LuaProxy::GetProxyableObject(L, 1);
if (&o->ProxyVTable() == &PlatformDisplayObject::GetTextFieldObjectProxyVTable())
{
NativeToJavaBridge *bridge = (NativeToJavaBridge*)lua_touserdata(L, lua_upvalueindex(1));

int startPosition, endPosition;
if (bridge->TextFieldGetSelection(((AndroidDisplayObject*)o)->GetId(), startPosition, endPosition))
{
lua_pushnumber(L, startPosition);
lua_pushnumber(L, endPosition);
return 2;
}
}

return 0;
}

// TODO: move these somewhere in librtt, so all platforms use same constants
static const char kDefaultInputType[] = "default";
static const char kUrlInputType[] = "url";
Expand Down Expand Up @@ -199,6 +219,11 @@ AndroidTextFieldObject::ValueForKey( lua_State *L, const char key[] ) const
lua_pushlightuserdata( L, fNativeToJavaBridge );
lua_pushcclosure( L, setSelection, 1 );
}
else if ( strcmp( "getSelection", key ) == 0 )
{
lua_pushlightuserdata( L, fNativeToJavaBridge );
lua_pushcclosure( L, getSelection, 1 );
}
else if ( strcmp( "align", key ) == 0 )
{
Rtt_Allocator * allocator = LuaContext::GetAllocator( L );
Expand Down
1 change: 1 addition & 0 deletions platform/android/ndk/Rtt_AndroidTextFieldObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class AndroidTextFieldObject : public AndroidDisplayObject
static int setTextColor( lua_State *L );
static int setReturnKey( lua_State *L );
static int setSelection( lua_State *L );
static int getSelection( lua_State *L );

public:
// MLuaTableBridge
Expand Down
29 changes: 29 additions & 0 deletions platform/android/ndk/jni/NativeToJavaBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2370,6 +2370,35 @@ NativeToJavaBridge::TextFieldSetSelection( int id, int startPosition, int endPos
}
}

bool
NativeToJavaBridge::TextFieldGetSelection(int id, int& startPosition, int& endPosition)
{
NativeTrace trace("NativeToJavaBridge::TextFieldGetSelection");

jclassInstance bridge(GetJNIEnv(), kNativeToJavaBridge);
startPosition = -1;
endPosition = -1;

if (bridge.isValid()) {
jmethodID mid = bridge.getEnv()->GetStaticMethodID(bridge.getClass(),
"callTextFieldGetSelection", "(Lcom/ansca/corona/CoronaRuntime;I)[I");

if (mid != NULL) {
jintArray result = (jintArray)bridge.getEnv()->CallStaticObjectMethod(bridge.getClass(), mid, fCoronaRuntime, id);
HandleJavaException();

if (result != NULL) {
jint* elements = bridge.getEnv()->GetIntArrayElements(result, 0);
startPosition = elements[0];
endPosition = elements[1];
bridge.getEnv()->ReleaseIntArrayElements(result, elements, 0);
return true;
}
}
}
return false;
}

void
NativeToJavaBridge::TextFieldSetPlaceholder( int id, const char * placeholder )
{
Expand Down
1 change: 1 addition & 0 deletions platform/android/ndk/jni/NativeToJavaBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class NativeToJavaBridge
int TextFieldCreate( int id, int left, int top, int width, int height, int isSingleLine );
void TextFieldSetReturnKey( int id, const char * imeType );
void TextFieldSetSelection( int id, int startPosition, int endPosition );
bool TextFieldGetSelection(int id, int& startPosition, int& endPosition);
void TextFieldSetPlaceholder( int id, const char * placeholder );
void TextFieldSetColor( int id, int r, int g, int b, int a );
void TextFieldSetText( int id, const char * text );
Expand Down
Loading

0 comments on commit 361c9d7

Please sign in to comment.