mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
This commit removes the `BUILDTIME` field from `BuildConfig` across all modules. This change improves build caching and reproducibility by eliminating a value that changed with every build. The `BUILDTIME` was previously used in `VERSION_DESCRIPTION_LONG` but is no longer included.
65 lines
2.2 KiB
Kotlin
65 lines
2.2 KiB
Kotlin
import java.io.File
|
|
import java.io.FileInputStream
|
|
import java.util.Properties
|
|
|
|
object ProjectConfig {
|
|
const val packageName = "eu.darken.capod"
|
|
|
|
const val minSdk = 26
|
|
const val compileSdk = 36
|
|
const val targetSdk = 36
|
|
|
|
object Version {
|
|
val versionProperties = Properties().apply {
|
|
load(FileInputStream(File("version.properties")))
|
|
}
|
|
val major = versionProperties.getProperty("project.versioning.major").toInt()
|
|
val minor = versionProperties.getProperty("project.versioning.minor").toInt()
|
|
val patch = versionProperties.getProperty("project.versioning.patch").toInt()
|
|
val build = versionProperties.getProperty("project.versioning.build").toInt()
|
|
|
|
val name = "${major}.${minor}.${patch}-rc${build}"
|
|
val code = major * 10000000 + minor * 100000 + patch * 1000 + build * 10
|
|
}
|
|
}
|
|
|
|
fun lastCommitHash(): String = Runtime.getRuntime().exec("git rev-parse --short HEAD").let { process ->
|
|
process.waitFor()
|
|
val output = process.inputStream.use { input ->
|
|
input.bufferedReader().use {
|
|
it.readText()
|
|
}
|
|
}
|
|
process.destroy()
|
|
output.trim()
|
|
}
|
|
|
|
fun com.android.build.api.dsl.SigningConfig.setupCredentials(
|
|
signingPropsPath: File? = null
|
|
) {
|
|
|
|
val keyStoreFromEnv = System.getenv("STORE_PATH")?.let { File(it) }
|
|
|
|
if (keyStoreFromEnv?.exists() == true) {
|
|
println("Using signing data from environment variables.")
|
|
storeFile = keyStoreFromEnv
|
|
storePassword = System.getenv("STORE_PASSWORD")
|
|
keyAlias = System.getenv("KEY_ALIAS")
|
|
keyPassword = System.getenv("KEY_PASSWORD")
|
|
} else {
|
|
println("Using signing data from properties file.")
|
|
val props = Properties().apply {
|
|
signingPropsPath?.takeIf { it.canRead() }?.let { load(FileInputStream(it)) }
|
|
}
|
|
|
|
val keyStorePath = props.getProperty("release.storePath")?.let { File(it) }
|
|
|
|
if (keyStorePath?.exists() == true) {
|
|
storeFile = keyStorePath
|
|
storePassword = props.getProperty("release.storePassword")
|
|
keyAlias = props.getProperty("release.keyAlias")
|
|
keyPassword = props.getProperty("release.keyPassword")
|
|
}
|
|
}
|
|
}
|