Update dependencies & refactor git build number method.
This commit is contained in:
parent
7a600d1db5
commit
4e103a2a37
1 changed files with 20 additions and 15 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import java.nio.charset.Charset
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
|
|
@ -20,7 +22,8 @@ android {
|
|||
keyPassword = "123456"
|
||||
}
|
||||
create("pixelized") {
|
||||
storeFile = (project.properties["PIXELIZED_RELEASE_STORE_FILE"] as? String)?.let { file(it) }
|
||||
storeFile =
|
||||
(project.properties["PIXELIZED_RELEASE_STORE_FILE"] as? String)?.let { file(it) }
|
||||
storePassword = project.properties["PIXELIZED_RELEASE_STORE_PASSWORD"] as? String
|
||||
keyAlias = project.properties["PIXELIZED_RELEASE_KEY_ALIAS"] as? String
|
||||
keyPassword = project.properties["PIXELIZED_RELEASE_KEY_PASSWORD"] as? String
|
||||
|
|
@ -57,7 +60,7 @@ android {
|
|||
isMinifyEnabled = true
|
||||
signingConfig = signingConfigs.getByName("pixelized")
|
||||
defaultConfig {
|
||||
versionCode = gitBuildNumber
|
||||
versionCode = getGitBuildNumber()
|
||||
}
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
|
||||
|
|
@ -67,7 +70,7 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
buildConfigField("String", "TIME_FORMAT", "\"$timeFormat\"")
|
||||
buildConfigField("Long", "TIMESTAMP", "${timestamp}L")
|
||||
buildConfigField("Long", "TIMESTAMP", "${System.currentTimeMillis()}L")
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
|
|
@ -104,13 +107,13 @@ dependencies {
|
|||
implementation("androidx.activity:activity-compose:1.9.0")
|
||||
|
||||
// Compose
|
||||
implementation("androidx.compose.ui:ui:1.6.7")
|
||||
implementation("androidx.compose.ui:ui-util:1.6.7")
|
||||
implementation("androidx.compose.ui:ui-graphics:1.6.7")
|
||||
implementation("androidx.compose.ui:ui-tooling-preview:1.6.7")
|
||||
implementation("androidx.compose.material:material:1.6.7")
|
||||
implementation("androidx.compose.ui:ui:1.6.8")
|
||||
implementation("androidx.compose.ui:ui-util:1.6.8")
|
||||
implementation("androidx.compose.ui:ui-graphics:1.6.8")
|
||||
implementation("androidx.compose.ui:ui-tooling-preview:1.6.8")
|
||||
implementation("androidx.compose.material:material:1.6.8")
|
||||
implementation("androidx.compose.material3:material3:1.2.1")
|
||||
debugImplementation("androidx.compose.ui:ui-tooling:1.6.7")
|
||||
debugImplementation("androidx.compose.ui:ui-tooling:1.6.8")
|
||||
|
||||
implementation("androidx.constraintlayout:constraintlayout-compose:1.0.1")
|
||||
|
||||
|
|
@ -178,15 +181,17 @@ room {
|
|||
private val timeFormat: String
|
||||
get() = "dd/MM/yyyy HH:mm:ss"
|
||||
|
||||
private val timestamp: Long
|
||||
get() = System.currentTimeMillis()
|
||||
|
||||
private val gitBuildNumber: Int
|
||||
get() {
|
||||
private fun getGitBuildNumber(
|
||||
charset: Charset = Charset.defaultCharset(),
|
||||
): Int {
|
||||
return try {
|
||||
val stdout = org.apache.commons.io.output.ByteArrayOutputStream()
|
||||
rootProject.exec {
|
||||
commandLine("git", "rev-list", "--count", "HEAD")
|
||||
standardOutput = stdout
|
||||
}
|
||||
return stdout.toString().trim().toInt()
|
||||
stdout.toString(charset).trim().toInt()
|
||||
} catch (e: Exception) {
|
||||
0
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue