co-maps/android/build.gradle
2025-11-22 13:58:55 +01:00

28 lines
928 B
Groovy

import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias libs.plugins.android.application apply false
alias libs.plugins.android.library apply false
}
def run(cmd) {
def output = providers.exec {
commandLine = cmd
}
return output.standardOutput.asText.get().trim()
}
def getVersion() {
def isWindows = DefaultNativePlatform.getCurrentOperatingSystem().isWindows()
def bash = isWindows ? 'C:\\Program Files\\Git\\bin\\bash.exe' : 'bash'
def versionCode = Integer.parseInt(run([bash, '../tools/unix/version.sh', 'android_code']))
def versionName = run([bash, '../tools/unix/version.sh', 'android_name'])
return new Tuple2(versionCode, versionName)
}
rootProject.ext {
def ver = getVersion()
versionCode = ver.V1
versionName = ver.V2
}