2023-02-16 10:11:39 +02:00
|
|
|
plugins {
|
|
|
|
id 'com.android.application'
|
|
|
|
}
|
|
|
|
|
|
|
|
android {
|
2023-08-15 17:47:42 +02:00
|
|
|
compileSdk 33
|
2023-02-26 11:21:46 +02:00
|
|
|
ndkVersion '25.2.9519653'
|
2023-02-16 10:11:39 +02:00
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
applicationId "is.xyz.vcmi"
|
|
|
|
minSdk 19
|
2023-08-15 17:47:42 +02:00
|
|
|
targetSdk 33
|
2023-09-08 14:19:08 +02:00
|
|
|
versionCode 1320
|
2023-09-14 16:38:33 +02:00
|
|
|
versionName "1.3.2"
|
2023-02-16 10:11:39 +02:00
|
|
|
setProperty("archivesBaseName", "vcmi")
|
|
|
|
}
|
|
|
|
|
|
|
|
signingConfigs {
|
|
|
|
releaseSigning
|
2023-04-15 10:47:24 +02:00
|
|
|
dailySigning
|
|
|
|
LoadSigningConfig("releaseSigning")
|
|
|
|
LoadSigningConfig("dailySigning")
|
2023-02-16 10:11:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
2023-02-26 11:21:46 +02:00
|
|
|
debug {
|
|
|
|
debuggable true
|
2023-02-26 11:23:36 +02:00
|
|
|
applicationIdSuffix '.debug'
|
|
|
|
manifestPlaceholders = [
|
|
|
|
applicationLabel: 'VCMI debug',
|
|
|
|
]
|
2023-02-26 11:21:46 +02:00
|
|
|
ndk {
|
|
|
|
debugSymbolLevel 'full'
|
|
|
|
}
|
|
|
|
}
|
2023-02-16 10:11:39 +02:00
|
|
|
release {
|
|
|
|
minifyEnabled false
|
|
|
|
zipAlignEnabled true
|
|
|
|
signingConfig signingConfigs.releaseSigning
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
2023-02-26 11:23:36 +02:00
|
|
|
manifestPlaceholders = [
|
|
|
|
applicationLabel: '@string/app_name',
|
|
|
|
]
|
2023-02-26 11:21:46 +02:00
|
|
|
ndk {
|
2023-07-21 15:19:16 +02:00
|
|
|
debugSymbolLevel 'full'
|
2023-02-26 11:21:46 +02:00
|
|
|
}
|
2023-02-16 10:11:39 +02:00
|
|
|
}
|
2023-02-26 11:53:20 +02:00
|
|
|
daily {
|
|
|
|
initWith release
|
|
|
|
applicationIdSuffix '.daily'
|
2023-04-15 10:47:24 +02:00
|
|
|
signingConfig signingConfigs.dailySigning
|
2023-02-26 11:53:20 +02:00
|
|
|
manifestPlaceholders = [
|
|
|
|
applicationLabel: 'VCMI daily',
|
|
|
|
]
|
|
|
|
}
|
2023-02-16 10:11:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
applicationVariants.all { variant -> RenameOutput(project.archivesBaseName, variant) }
|
|
|
|
|
|
|
|
tasks.withType(JavaCompile) {
|
|
|
|
options.compilerArgs += ["-Xlint:deprecation"]
|
|
|
|
}
|
|
|
|
|
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
|
}
|
|
|
|
|
|
|
|
buildFeatures {
|
|
|
|
viewBinding true
|
|
|
|
dataBinding true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def RenameOutput(final baseName, final variant) {
|
|
|
|
final def buildTaskId = System.getenv("GITHUB_RUN_ID")
|
|
|
|
|
|
|
|
ResolveGitInfo()
|
|
|
|
|
2023-02-26 12:47:09 +02:00
|
|
|
def name = baseName + "-" + ext.gitInfoVcmi
|
2023-02-16 10:11:39 +02:00
|
|
|
|
|
|
|
if (buildTaskId != null && !buildTaskId.isEmpty()) {
|
|
|
|
name = buildTaskId + "-" + name
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!variant.buildType.name != "release") {
|
|
|
|
name += "-" + variant.buildType.name
|
|
|
|
}
|
|
|
|
|
|
|
|
variant.outputs.each { output ->
|
|
|
|
def oldPath = output.outputFile.getAbsolutePath()
|
|
|
|
output.outputFileName = name + oldPath.substring(oldPath.lastIndexOf("."))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def CommandOutput(final cmd, final arguments, final cwd) {
|
|
|
|
try {
|
|
|
|
new ByteArrayOutputStream().withStream { final os ->
|
|
|
|
exec {
|
|
|
|
executable cmd
|
|
|
|
args arguments
|
|
|
|
workingDir cwd
|
|
|
|
standardOutput os
|
|
|
|
}
|
|
|
|
return os.toString().trim()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (final Exception ex) {
|
|
|
|
print("Broken: " + cmd + " " + arguments + " in " + cwd + " :: " + ex.toString())
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def ResolveGitInfo() {
|
2023-02-26 12:47:09 +02:00
|
|
|
if (ext.gitInfoVcmi != "none") {
|
2023-02-16 10:11:39 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
ext.gitInfoVcmi =
|
2023-02-26 12:47:09 +02:00
|
|
|
CommandOutput("git", ["log", "-1", "--pretty=%D", "--decorate-refs=refs/remotes/origin/*"], ".").replace("origin/", "").replace(", HEAD", "").replaceAll("[^a-zA-Z0-9\\-_]", "_") +
|
2023-02-16 10:11:39 +02:00
|
|
|
"-" +
|
2023-02-26 12:47:09 +02:00
|
|
|
CommandOutput("git", ["describe", "--match=", "--always", "--abbrev=7"], ".")
|
2023-02-16 10:11:39 +02:00
|
|
|
}
|
|
|
|
|
2023-04-15 10:47:24 +02:00
|
|
|
def SigningPropertiesPath(final basePath, final signingConfigKey) {
|
|
|
|
return file("${basePath}/${signingConfigKey}.properties")
|
2023-02-16 10:11:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
def SigningKeystorePath(final basePath, final keystoreFileName) {
|
2023-02-26 13:14:51 +02:00
|
|
|
return file("${basePath}/${keystoreFileName}")
|
2023-02-16 10:11:39 +02:00
|
|
|
}
|
|
|
|
|
2023-04-15 10:47:24 +02:00
|
|
|
def LoadSigningConfig(final signingConfigKey) {
|
2023-02-26 13:14:51 +02:00
|
|
|
final def projectRoot = "${project.projectDir}/../../CI/android"
|
2023-02-16 10:11:39 +02:00
|
|
|
final def props = new Properties()
|
2023-04-15 10:47:24 +02:00
|
|
|
final def propFile = SigningPropertiesPath(projectRoot, signingConfigKey)
|
|
|
|
|
|
|
|
def signingConfig = android.signingConfigs.getAt(signingConfigKey)
|
|
|
|
|
2023-02-16 10:11:39 +02:00
|
|
|
if (propFile.canRead()) {
|
|
|
|
props.load(new FileInputStream(propFile))
|
|
|
|
|
|
|
|
if (props != null
|
|
|
|
&& props.containsKey('STORE_FILE')
|
2023-04-15 10:47:24 +02:00
|
|
|
&& props.containsKey('KEY_ALIAS')) {
|
|
|
|
|
|
|
|
signingConfig.storeFile = SigningKeystorePath(projectRoot, props['STORE_FILE'])
|
|
|
|
signingConfig.storePassword = props['STORE_PASSWORD']
|
|
|
|
signingConfig.keyAlias = props['KEY_ALIAS']
|
|
|
|
|
|
|
|
if(props.containsKey('STORE_PASSWORD'))
|
|
|
|
signingConfig.storePassword = props['STORE_PASSWORD']
|
|
|
|
else
|
|
|
|
signingConfig.storePassword = System.getenv("ANDROID_STORE_PASSWORD")
|
|
|
|
|
|
|
|
if(props.containsKey('KEY_PASSWORD'))
|
|
|
|
signingConfig.keyPassword = props['KEY_PASSWORD']
|
|
|
|
else
|
|
|
|
signingConfig.keyPassword = System.getenv("ANDROID_KEY_PASSWORD")
|
2023-02-16 10:11:39 +02:00
|
|
|
} else {
|
|
|
|
println("Some props from signing file are missing")
|
2023-04-15 10:47:24 +02:00
|
|
|
android.signingConfigs.putAt(signingConfigKey, null)
|
2023-02-16 10:11:39 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
println("file with signing properties is missing")
|
2023-04-15 10:47:24 +02:00
|
|
|
android.signingConfigs.putAt(signingConfigKey, null)
|
2023-02-16 10:11:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
|
|
|
implementation 'com.google.android.material:material:1.3.0'
|
|
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
2023-03-04 13:35:56 +02:00
|
|
|
implementation 'com.google.android.gms:play-services-base:18.2.0'
|
|
|
|
implementation 'com.google.android.gms:play-services-basement:18.1.0'
|
2023-02-16 10:11:39 +02:00
|
|
|
}
|