Allow user-config data path on non-public release build

This commit is contained in:
Johannes Frohnmeyer 2021-12-27 14:53:45 +01:00
parent f77d8709ae
commit 8c0019912f
Signed by: Johannes
GPG Key ID: E76429612C2929F4
5 changed files with 8 additions and 3 deletions

View File

@ -36,11 +36,12 @@ allprojects {
ext {
lwjglVersion = '3.2.3'
imguiVersion = '1.84.1.4'
imguiVersion = '1.85.1'
log4jVersion = '2.14.1'
flavorProp = project.hasProperty('flavor') ? project.getProperty('flavor') : 'custom'
flavor = flavorProp
isPublic = project.hasProperty('public')
isRelease = project.hasProperty('release')
}
if (flavor == 'custom') {
@ -60,7 +61,7 @@ if (flavor == 'custom') {
dependencies {
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'org.slf4j:slf4j-api:1.7.32'
implementation 'ch.qos.logback:logback-classic:1.2.8'
implementation 'ch.qos.logback:logback-classic:1.2.9'
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r'
implementation project(":wrapper")
@ -88,6 +89,7 @@ processResources {
expand "version": project.version
filter { line -> line.replace("@flavor@", project.ext.flavorProp) }
filter { line -> line.replace("@public@", "$project.ext.isPublic") }
filter { line -> line.replace("@release@", "$project.ext.isRelease") }
filter { line -> line.replace("@jvm@", "$project.sourceCompatibility") }
}
}

View File

@ -2,5 +2,6 @@
"version": "${version}",
"flavor": "@flavor@",
"isPublic": @public@,
"isRelease": @release@,
"jvm": @jvm@
}

View File

@ -6,5 +6,6 @@ public class InceptumVersion {
public ComparableVersion version;
public String flavor;
public Boolean isPublic;
public Boolean isRelease;
public Integer jvm;
}

View File

@ -26,7 +26,7 @@ public class MetaHolder {
.create()
.fromJson(isr, InceptumVersion.class);
Path runDir = getRunDir();
BASE_PATH = VERSION.isPublic && !Files.exists(runDir)
BASE_PATH = VERSION.isRelease && !Files.exists(runDir)
? getConfigPath().resolve("Inceptum")
: runDir;
} catch (IOException e) {

View File

@ -2,5 +2,6 @@
"version": "${version}",
"flavor": "@flavor@",
"isPublic": @public@,
"isRelease": @release@,
"jvm": @jvm@
}