From b2bec260d84be4fa3b8a77c1d9bd67f0f4f0d361 Mon Sep 17 00:00:00 2001 From: BSA* Date: Wed, 30 Mar 2022 09:48:23 +0000 Subject: [PATCH] New App: Destination Sol --- metadata/com.miloshpetrov.sol2.android.yml | 145 ++++++++++++++++++ .../2.0.0-android-backport.patch | 137 +++++++++++++++++ .../MovingBlocks-DestinationSol-engine.yml | 4 + srclibs/MovingBlocks-gestalt-android.yml | 4 + srclibs/MovingBlocks-gestalt.yml | 2 + srclibs/MovingBlocks-joml-ext.yml | 2 + srclibs/MovingBlocks-nui.yml | 2 + srclibs/MovingBlocks-org-reflections-fork.yml | 4 + srclibs/antilaby-jsemver-fork.yml | 9 ++ 9 files changed, 309 insertions(+) create mode 100644 metadata/com.miloshpetrov.sol2.android.yml create mode 100644 metadata/com.miloshpetrov.sol2.android/2.0.0-android-backport.patch create mode 100644 srclibs/MovingBlocks-DestinationSol-engine.yml create mode 100644 srclibs/MovingBlocks-gestalt-android.yml create mode 100644 srclibs/MovingBlocks-gestalt.yml create mode 100644 srclibs/MovingBlocks-joml-ext.yml create mode 100644 srclibs/MovingBlocks-nui.yml create mode 100644 srclibs/MovingBlocks-org-reflections-fork.yml create mode 100644 srclibs/antilaby-jsemver-fork.yml diff --git a/metadata/com.miloshpetrov.sol2.android.yml b/metadata/com.miloshpetrov.sol2.android.yml new file mode 100644 index 0000000000..afd5505c46 --- /dev/null +++ b/metadata/com.miloshpetrov.sol2.android.yml @@ -0,0 +1,145 @@ +AntiFeatures: + - NonFreeAssets +Categories: + - Games +License: Apache-2.0 +WebSite: https://destinationsol.org +SourceCode: https://github.com/MovingBlocks/DestinationSol +IssueTracker: https://github.com/MovingBlocks/DestinationSol/issues + +AutoName: Destination Sol + +RepoType: git +Repo: https://github.com/MovingBlocks/DestSolAndroid + +Builds: + - versionName: 2.0.0 + versionCode: 11 + commit: 1b1c0db + patch: + - 2.0.0-android-backport.patch + gradle: + - yes + srclibs: + - MovingBlocks-gestalt@df875f0 + - MovingBlocks-gestalt-android@c077a11 + - MovingBlocks-org-reflections-fork@4fe6bd5 + - MovingBlocks-DestinationSol-engine@v2.0.0 + forceversion: true + forcevercode: true + prebuild: + - printf '\nrootProject.projectDir = file("engine_workspace"); include ":android"; + project(":android").projectDir = file(".\"); project(":android").buildFileName + = "android.gradle"; apply from:"engine_workspace/settings.gradle";' >> settings.gradle + - mv build.gradle android.gradle + - echo "configurations.all { resolutionStrategy { dependencySubstitution { substitute(module('dom4j:dom4j')).with(module('org.dom4j:dom4j:2.1.3')) + } } }" >> android.gradle + - ln -s $$MovingBlocks-DestinationSol-engine$$ engine_workspace + - ln -s engine_workspace/gradle gradle + - pushd engine_workspace + - sed -i '/^dependencies {/a compile("org.slf4j:slf4j-api:1.7.25"); compile("com.google.code.gson:gson:2.6.2");' + engine/build.gradle + - echo 'includeBuild("$rootDir/libs/gestalt")' >> settings.gradle + - echo 'includeBuild("$rootDir/libs/reflections")' >> settings.gradle + - mkdir libs + - ln -s $$MovingBlocks-gestalt$$ libs/gestalt + - rm -rf libs/gestalt/gestalt-android + - ln -s $$MovingBlocks-gestalt-android$$ libs/gestalt/gestalt-android + - sed -i -e 's/variant.javaCompileProvider.get()/variant.getJavaCompiler()/g' + -e '/allowInsecureProtocol true/d' libs/gestalt/gestalt-android/build.gradle + - sed -i 's/variant.assembleProvider.get()/variant.assemble/g' libs/gestalt/gestalt-android-testbed/build.gradle + - sed -i -e "/dependencies {/a compileOnly 'org.javassist:javassist:3.20.0-GA'" + -e '/com.google.guava:guava/s/implementation/api/' libs/gestalt/gestalt-module/build.gradle + - sed -i 's/ThreadLocal\.withInitial(Queues::newArrayDeque);/new ThreadLocal>() + { @Override protected Deque initialValue() { return Queues\.newArrayDeque(); + } };/g' libs/gestalt/gestalt-asset-core/src/main/java/org/terasology/gestalt/assets/management/ContextManager.java + - ln -s $$MovingBlocks-org-reflections-fork$$ libs/reflections + - pushd $$MovingBlocks-org-reflections-fork$$ + - gradle init --type pom + - popd + - echo 'sdk.dir=$$SDK$$' > local.properties + - echo 'sdk.dir=$$SDK$$' > libs/gestalt/local.properties + - popd + - sed -i '/artifactory.terasology.org/d' android.gradle engine_workspace/build.gradle + engine_workspace/config/gradle/common.gradle engine_workspace/engine/build.gradle + - sed -i -e '/heisluft.de/d' -e '/com.github.zafarkhaja:java-semver/d' android.gradle + - sed -i "s/.*com\.android\.tools\.build:gradle:.*/$(grep 'com\.android\.tools\.build:gradle:3.*' + android.gradle)/g" engine_workspace/libs/gestalt/build.gradle + + - versionName: 2.1.0-SNAPSHOT + versionCode: 13 + disable: not anywhere near release yet but this is to make sure it builds at least + under the current development branch. + commit: develop + gradle: + - yes + srclibs: + - MovingBlocks-DestinationSol-engine@develop + - MovingBlocks-gestalt@release/v7.x + - MovingBlocks-nui@v3.1.0 + - MovingBlocks-joml-ext@v0.1.0 + - MovingBlocks-org-reflections-fork@4fe6bd5 + - antilaby-jsemver-fork@0.10.0 + forceversion: true + forcevercode: true + prebuild: + - printf '\nrootProject.projectDir = file("engine_workspace"); include ":android"; + project(":android").projectDir = file(".\"); project(":android").buildFileName + = "android.gradle"; apply from:"engine_workspace/settings.gradle";' >> settings.gradle + - mv build.gradle android.gradle + - ln -s $$MovingBlocks-DestinationSol-engine$$ engine_workspace + - ln -s engine_workspace/gradle gradle + - pushd engine_workspace + - ln -s $$MovingBlocks-gestalt$$ libs/gestalt + - ln -s $$MovingBlocks-nui$$ libs/TeraNUI + - ln -s $$MovingBlocks-joml-ext$$ libs/joml-ext + - ln -s $$MovingBlocks-org-reflections-fork$$ libs/reflections + - ln -s $$antilaby-jsemver-fork$$ libs/jsemver + - pushd $$MovingBlocks-org-reflections-fork$$ + - gradle init --type pom + - popd + - echo 'sdk.dir=$$SDK$$' > local.properties + - echo 'sdk.dir=$$SDK$$' > libs/gestalt/local.properties + - popd + - sed -i '/artifactory.terasology.org/d' android.gradle engine_workspace/build.gradle + engine_workspace/config/gradle/common.gradle engine_workspace/engine/build.gradle + - sed -i -e '/heisluft.de/d' -e '/com.github.zafarkhaja:java-semver/d' android.gradle + - sed -i "s/.*com\.android\.tools\.build:gradle:.*/$(grep 'com\.android\.tools\.build:gradle:.*' + android.gradle)/g" engine_workspace/libs/gestalt/build.gradle + +MaintainerNotes: | + The main engine code is at https://github.com/MovingBlocks/DestinationSol but the actual android application + can be found at https://github.com/MovingBlocks/DestSolAndroid. + The android app build depends on being a sub-project of the main DestinationSol gradle build. + This can normally be achieved by cloning the DestSolAndroid repository + into a sub-directory of the main root DestinationSol directory. + + In this particular instance though, we want to store the F-Droid/Fastlane metadata in the android repository itself, + so the DestSolAndroid repository will be fetched as the source. + A problem with this though is that the DestinationSol repository is needed as the gradle root for the project to build successfully. + With a bit of extra gradle configuration though, it is possible to change the directory of the gradle root project, + allowing for a sub-directory to act as the effective root. + To prevent any confusion with gradle though, the root android build.gradle is re-named to android.gradle. + The Android repository (the actual root) is then established as a gradle sub-project of the project root. + The last thing done is to include the settings.gradle of the effective project root, as this does not occur automatically. + + Destination Sol depends on a couple of MovingBlocks libraries that are not published elsewhere. + Normally they can be found in the Terasology Artifactory (http://artifactory.terasology.org/artifactory), however, + that repository has been patched-out for the F-Droid builds. + It may be possible to use jitpack.io to replace these custom builds? + + The MovingBlocks libraries needed are as follows: + * org.terasology.gestalt - https://github.com/MovingBlocks/gestalt + * org.terasology.nui - https://github.com/MovingBlocks/TeraNui (app >= v2.1.0-SNAPSHOT) + * org.terasology.joml-ext - https://github.com/MovingBlocks/joml-ext (app >= v2.1.0-SNAPSHOT) + [app >= v2.1.0] Gestalt also depends on a fork of jsemver containing fixes and improvments to the original code. + The forked jsemver can be found at https://github.com/AntiLaby/jsemver. Version 0.10.0 is used. + + For 2.0.0, a later version of the DestSolAndroid repository is used than was used for the original release. + A minor patch is applied to make the newer DestSolAndroid version compatible with Destination Sol 2.0.0 again. + Because the newer commit was intended for a later version, the version and version code need to be forced here. + +AutoUpdateMode: None +UpdateCheckMode: Tags v\d+\.\d+\.\d+([-]alpha|beta)?$ +CurrentVersion: 2.0.0 +CurrentVersionCode: 11 diff --git a/metadata/com.miloshpetrov.sol2.android/2.0.0-android-backport.patch b/metadata/com.miloshpetrov.sol2.android/2.0.0-android-backport.patch new file mode 100644 index 0000000000..35ec50374f --- /dev/null +++ b/metadata/com.miloshpetrov.sol2.android/2.0.0-android-backport.patch @@ -0,0 +1,137 @@ +From a28f8f935cdfc81c193809b699b7e7620e6970f9 Mon Sep 17 00:00:00 2001 +From: Benjamin Amos +Date: Tue, 1 Mar 2022 22:58:41 +0000 +Subject: [PATCH 1/3] build: fix building with engine v2.0.0 + +--- + build.gradle | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +diff --git a/build.gradle b/build.gradle +index f030f6e..9d042e4 100644 +--- a/build.gradle ++++ b/build.gradle +@@ -15,7 +15,11 @@ buildscript { + google() + } + dependencies { +- classpath 'com.android.tools.build:gradle:4.1.3' ++ if (version == '2.0.0') { ++ classpath 'com.android.tools.build:gradle:3.2.1' ++ } else { ++ classpath 'com.android.tools.build:gradle:4.1.3' ++ } + } + } + +@@ -71,7 +75,11 @@ dependencies { + } + // Android-compatible JOML variant + implementation "org.joml:joml-jdk3:1.9.25" +- implementation(group: 'org.terasology.gestalt', name: 'gestalt-android', version: '7.2.0-SNAPSHOT') ++ implementation(group: 'org.terasology.gestalt', name: 'gestalt-android', version: '7.2.0-SNAPSHOT') { ++ // Only include gestalt-android. ++ // This is safe because gestalt-android has not changed apart from to add the android assets file sources. ++ exclude group: "org.terasology.gestalt" ++ } + // TODO: Needed for gestalt because of an internal dependency but since that dependency is never + // exposed in a public API, I have no idea why it's needed for compilation. + implementation "com.github.zafarkhaja:java-semver:0.10.0" +@@ -289,6 +297,14 @@ task exportModules() { + include "reflections.cache" + } + ++ if (version == '2.0.0') { ++ copy { ++ from "$rootDir/engine/build/classes/java/main" ++ into "$projectDir/assets/engine" ++ include "reflections.cache" ++ } ++ } ++ + copy { + into "$projectDir/assets/modules" + from("$rootDir/modules") { + +From e28414b18a24e86dcae54ccdf45afa7d2c323063 Mon Sep 17 00:00:00 2001 +From: Benjamin Amos +Date: Wed, 2 Mar 2022 20:09:44 +0000 +Subject: [PATCH 2/3] fix: fix building modules without code + +--- + build.gradle | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/build.gradle b/build.gradle +index 9d042e4..e050965 100644 +--- a/build.gradle ++++ b/build.gradle +@@ -286,7 +286,10 @@ task exportModules() { + + file("$projectDir/assets/modules/${module.name}/build/classes").mkdirs() + Files.createSymbolicLink(Paths.get("$projectDir/assets/modules/${module.name}/build/classes/reflections.cache"), Paths.get("$rootDir/modules/${module.name}/build/classes/reflections.cache")) +- Files.createSymbolicLink(Paths.get("$projectDir/assets/modules/${module.name}/build/dexes"), Paths.get("$rootDir/modules/${module.name}/build/dexes")) ++ def moduleDexesDir = "$rootDir/modules/${module.name}/build/dexes"; ++ if (file(moduleDexesDir).exists()) { ++ Files.createSymbolicLink(Paths.get("$projectDir/assets/modules/${module.name}/build/dexes"), Paths.get(moduleDexesDir)) ++ } + } + } else { + copy { + +From 5cea69c1981fd48f57598145ecf01b421418950e Mon Sep 17 00:00:00 2001 +From: Benjamin Amos +Date: Thu, 17 Mar 2022 20:30:24 +0000 +Subject: [PATCH 3/3] fix: correct export of engine reflections + +--- + build.gradle | 22 ++++++++++++++-------- + 1 file changed, 14 insertions(+), 8 deletions(-) + +diff --git a/build.gradle b/build.gradle +index e050965..9ec8831 100644 +--- a/build.gradle ++++ b/build.gradle +@@ -80,6 +80,12 @@ dependencies { + // This is safe because gestalt-android has not changed apart from to add the android assets file sources. + exclude group: "org.terasology.gestalt" + } ++ ++ if (version == '2.0.0') { ++ // Gestalt does not use JavaAssist to compile ++ compileOnly 'org.javassist:javassist:3.20.0-GA' ++ } ++ + // TODO: Needed for gestalt because of an internal dependency but since that dependency is never + // exposed in a public API, I have no idea why it's needed for compilation. + implementation "com.github.zafarkhaja:java-semver:0.10.0" +@@ -268,6 +274,14 @@ task exportModules() { + + boolean canCreateSymlinks + ++ if (version == '2.0.0') { ++ copy { ++ from "$rootDir/engine/build/classes/java/main" ++ into "$rootDir/engine/build/resources/main/org/destinationsol" ++ include "reflections.cache" ++ } ++ } ++ + try { + Files.createSymbolicLink(Paths.get("$projectDir/assets/engine"), Paths.get("$rootDir/engine/build/resources/main/org/destinationsol")) + canCreateSymlinks = true +@@ -300,14 +314,6 @@ task exportModules() { + include "reflections.cache" + } + +- if (version == '2.0.0') { +- copy { +- from "$rootDir/engine/build/classes/java/main" +- into "$projectDir/assets/engine" +- include "reflections.cache" +- } +- } +- + copy { + into "$projectDir/assets/modules" + from("$rootDir/modules") { diff --git a/srclibs/MovingBlocks-DestinationSol-engine.yml b/srclibs/MovingBlocks-DestinationSol-engine.yml new file mode 100644 index 0000000000..09bf061671 --- /dev/null +++ b/srclibs/MovingBlocks-DestinationSol-engine.yml @@ -0,0 +1,4 @@ +RepoType: git +Repo: https://github.com/MovingBlocks/DestinationSol.git + +Prepare: rm -rf desktop launcher gradle/wrapper/groovy-wrapper.jar diff --git a/srclibs/MovingBlocks-gestalt-android.yml b/srclibs/MovingBlocks-gestalt-android.yml new file mode 100644 index 0000000000..f14654e4ad --- /dev/null +++ b/srclibs/MovingBlocks-gestalt-android.yml @@ -0,0 +1,4 @@ +RepoType: git +Repo: https://github.com/MovingBlocks/gestalt.git + +Subdir: gestalt-android diff --git a/srclibs/MovingBlocks-gestalt.yml b/srclibs/MovingBlocks-gestalt.yml new file mode 100644 index 0000000000..263cb1b3b6 --- /dev/null +++ b/srclibs/MovingBlocks-gestalt.yml @@ -0,0 +1,2 @@ +RepoType: git +Repo: https://github.com/MovingBlocks/gestalt.git diff --git a/srclibs/MovingBlocks-joml-ext.yml b/srclibs/MovingBlocks-joml-ext.yml new file mode 100644 index 0000000000..6ba8669455 --- /dev/null +++ b/srclibs/MovingBlocks-joml-ext.yml @@ -0,0 +1,2 @@ +RepoType: git +Repo: https://github.com/MovingBlocks/joml-ext diff --git a/srclibs/MovingBlocks-nui.yml b/srclibs/MovingBlocks-nui.yml new file mode 100644 index 0000000000..62927cafea --- /dev/null +++ b/srclibs/MovingBlocks-nui.yml @@ -0,0 +1,2 @@ +RepoType: git +Repo: https://github.com/MovingBlocks/TeraNUI.git diff --git a/srclibs/MovingBlocks-org-reflections-fork.yml b/srclibs/MovingBlocks-org-reflections-fork.yml new file mode 100644 index 0000000000..c381a3ac4b --- /dev/null +++ b/srclibs/MovingBlocks-org-reflections-fork.yml @@ -0,0 +1,4 @@ +RepoType: git +Repo: https://github.com/MovingBlocks/reflections + +Prepare: sed -i '/0.9.12/s/SNAPSHOT/MB/' pom.xml diff --git a/srclibs/antilaby-jsemver-fork.yml b/srclibs/antilaby-jsemver-fork.yml new file mode 100644 index 0000000000..85c0c27581 --- /dev/null +++ b/srclibs/antilaby-jsemver-fork.yml @@ -0,0 +1,9 @@ +RepoType: git +Repo: https://github.com/AntiLaby/jsemver + +Prepare: | + printf " + java { + sourceCompatibility(JavaVersion.VERSION_1_8) + targetCompatibility(JavaVersion.VERSION_1_8) + }" >> build.gradle