New App: Destination Sol

This commit is contained in:
BSA* 2022-03-30 09:48:23 +00:00 committed by linsui
parent 595f440764
commit b2bec260d8
9 changed files with 309 additions and 0 deletions

View file

@ -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<Deque<Name>>()
{ @Override protected Deque<Name> 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

View file

@ -0,0 +1,137 @@
From a28f8f935cdfc81c193809b699b7e7620e6970f9 Mon Sep 17 00:00:00 2001
From: Benjamin Amos <benjamin.amos11@gmail.com>
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 <benjamin.amos11@gmail.com>
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 <benjamin.amos11@gmail.com>
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") {

View file

@ -0,0 +1,4 @@
RepoType: git
Repo: https://github.com/MovingBlocks/DestinationSol.git
Prepare: rm -rf desktop launcher gradle/wrapper/groovy-wrapper.jar

View file

@ -0,0 +1,4 @@
RepoType: git
Repo: https://github.com/MovingBlocks/gestalt.git
Subdir: gestalt-android

View file

@ -0,0 +1,2 @@
RepoType: git
Repo: https://github.com/MovingBlocks/gestalt.git

View file

@ -0,0 +1,2 @@
RepoType: git
Repo: https://github.com/MovingBlocks/joml-ext

View file

@ -0,0 +1,2 @@
RepoType: git
Repo: https://github.com/MovingBlocks/TeraNUI.git

View file

@ -0,0 +1,4 @@
RepoType: git
Repo: https://github.com/MovingBlocks/reflections
Prepare: sed -i '/<version>0.9.12/s/SNAPSHOT/MB/' pom.xml

View file

@ -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