mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-13 08:48:38 +02:00
[android] Fix build id (#3066)
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3066 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Co-committed-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
This commit is contained in:
parent
f7f6a4cde4
commit
61f3ce643c
4 changed files with 56 additions and 51 deletions
|
|
@ -61,7 +61,6 @@ android {
|
|||
minSdk = 24
|
||||
targetSdk = 36
|
||||
versionName = getGitVersion()
|
||||
|
||||
versionCode = autoVersion
|
||||
|
||||
ndk {
|
||||
|
|
@ -69,9 +68,6 @@ android {
|
|||
abiFilters += listOf("arm64-v8a")
|
||||
}
|
||||
|
||||
buildConfigField("String", "GIT_HASH", "\"${getGitHash()}\"")
|
||||
buildConfigField("String", "BRANCH", "\"${getBranch()}\"")
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
val extraCMakeArgs =
|
||||
|
|
@ -92,14 +88,14 @@ android {
|
|||
"-DYUZU_TESTS=OFF",
|
||||
"-DDYNARMIC_TESTS=OFF",
|
||||
*extraCMakeArgs.toTypedArray()
|
||||
))
|
||||
)
|
||||
)
|
||||
|
||||
abiFilters("arm64-v8a")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val keystoreFile = System.getenv("ANDROID_KEYSTORE_FILE")
|
||||
signingConfigs {
|
||||
if (keystoreFile != null) {
|
||||
|
|
@ -162,7 +158,39 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
// this is really annoying but idk any other ways to fix this behavior
|
||||
flavorDimensions.add("version")
|
||||
productFlavors {
|
||||
create("mainline") {
|
||||
dimension = "version"
|
||||
resValue("string", "app_name_suffixed", "Eden")
|
||||
}
|
||||
|
||||
create("genshinSpoof") {
|
||||
dimension = "version"
|
||||
resValue("string", "app_name_suffixed", "Eden Optimized")
|
||||
applicationId = "com.miHoYo.Yuanshen"
|
||||
}
|
||||
|
||||
create("legacy") {
|
||||
dimension = "version"
|
||||
resValue("string", "app_name_suffixed", "Eden Legacy")
|
||||
applicationId = "dev.legacy.eden_emulator"
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments.add("-DYUZU_LEGACY=ON")
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
getByName("legacy") {
|
||||
res.srcDirs("src/main/legacy")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this is really annoying but idk any other ways to fix this behavior
|
||||
applicationVariants.all {
|
||||
val variant = this
|
||||
when {
|
||||
|
|
@ -187,40 +215,6 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
android {
|
||||
flavorDimensions.add("version")
|
||||
productFlavors {
|
||||
create("mainline") {
|
||||
dimension = "version"
|
||||
resValue("string", "app_name_suffixed", "Eden")
|
||||
}
|
||||
|
||||
create("genshinSpoof") {
|
||||
dimension = "version"
|
||||
resValue("string", "app_name_suffixed", "Eden Optimized")
|
||||
applicationId = "com.miHoYo.Yuanshen"
|
||||
}
|
||||
|
||||
create("legacy") {
|
||||
dimension = "version"
|
||||
resValue("string", "app_name_suffixed", "Eden Legacy")
|
||||
applicationId = "dev.legacy.eden_emulator"
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments.add("-DYUZU_LEGACY=ON")
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
getByName("legacy") {
|
||||
res.srcDirs("src/main/legacy")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version = "3.22.1"
|
||||
|
|
@ -284,7 +278,6 @@ dependencies {
|
|||
implementation("androidx.core:core-splashscreen:1.0.1")
|
||||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.2")
|
||||
implementation("androidx.window:window:1.3.0")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.2.1")
|
||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||
implementation("org.commonmark:commonmark:0.22.0")
|
||||
implementation("androidx.navigation:navigation-fragment-ktx:2.8.9")
|
||||
|
|
@ -302,7 +295,9 @@ fun runGitCommand(command: List<String>): String {
|
|||
.directory(project.rootDir)
|
||||
.redirectOutput(ProcessBuilder.Redirect.PIPE)
|
||||
.redirectError(ProcessBuilder.Redirect.PIPE)
|
||||
.start().inputStream.bufferedReader().use { it.readText() }
|
||||
.start()
|
||||
.inputStream.bufferedReader()
|
||||
.use { it.readText() }
|
||||
.trim()
|
||||
} catch (e: Exception) {
|
||||
logger.error("Cannot find git")
|
||||
|
|
@ -326,9 +321,3 @@ fun getGitVersion(): String {
|
|||
}
|
||||
return versionName.ifEmpty { "0.0" }
|
||||
}
|
||||
|
||||
fun getGitHash(): String =
|
||||
runGitCommand(listOf("git", "rev-parse", "--short", "HEAD")).ifEmpty { "dummy-hash" }
|
||||
|
||||
fun getBranch(): String =
|
||||
runGitCommand(listOf("git", "rev-parse", "--abbrev-ref", "HEAD")).ifEmpty { "dummy-hash" }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue