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 {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("org.jetbrains.kotlin.android")
|
id("org.jetbrains.kotlin.android")
|
||||||
|
|
@ -20,7 +22,8 @@ android {
|
||||||
keyPassword = "123456"
|
keyPassword = "123456"
|
||||||
}
|
}
|
||||||
create("pixelized") {
|
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
|
storePassword = project.properties["PIXELIZED_RELEASE_STORE_PASSWORD"] as? String
|
||||||
keyAlias = project.properties["PIXELIZED_RELEASE_KEY_ALIAS"] as? String
|
keyAlias = project.properties["PIXELIZED_RELEASE_KEY_ALIAS"] as? String
|
||||||
keyPassword = project.properties["PIXELIZED_RELEASE_KEY_PASSWORD"] as? String
|
keyPassword = project.properties["PIXELIZED_RELEASE_KEY_PASSWORD"] as? String
|
||||||
|
|
@ -57,7 +60,7 @@ android {
|
||||||
isMinifyEnabled = true
|
isMinifyEnabled = true
|
||||||
signingConfig = signingConfigs.getByName("pixelized")
|
signingConfig = signingConfigs.getByName("pixelized")
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
versionCode = gitBuildNumber
|
versionCode = getGitBuildNumber()
|
||||||
}
|
}
|
||||||
proguardFiles(
|
proguardFiles(
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
|
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
|
||||||
|
|
@ -67,7 +70,7 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
buildConfigField("String", "TIME_FORMAT", "\"$timeFormat\"")
|
buildConfigField("String", "TIME_FORMAT", "\"$timeFormat\"")
|
||||||
buildConfigField("Long", "TIMESTAMP", "${timestamp}L")
|
buildConfigField("Long", "TIMESTAMP", "${System.currentTimeMillis()}L")
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
|
@ -104,13 +107,13 @@ dependencies {
|
||||||
implementation("androidx.activity:activity-compose:1.9.0")
|
implementation("androidx.activity:activity-compose:1.9.0")
|
||||||
|
|
||||||
// Compose
|
// Compose
|
||||||
implementation("androidx.compose.ui:ui:1.6.7")
|
implementation("androidx.compose.ui:ui:1.6.8")
|
||||||
implementation("androidx.compose.ui:ui-util:1.6.7")
|
implementation("androidx.compose.ui:ui-util:1.6.8")
|
||||||
implementation("androidx.compose.ui:ui-graphics:1.6.7")
|
implementation("androidx.compose.ui:ui-graphics:1.6.8")
|
||||||
implementation("androidx.compose.ui:ui-tooling-preview:1.6.7")
|
implementation("androidx.compose.ui:ui-tooling-preview:1.6.8")
|
||||||
implementation("androidx.compose.material:material:1.6.7")
|
implementation("androidx.compose.material:material:1.6.8")
|
||||||
implementation("androidx.compose.material3:material3:1.2.1")
|
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")
|
implementation("androidx.constraintlayout:constraintlayout-compose:1.0.1")
|
||||||
|
|
||||||
|
|
@ -178,15 +181,17 @@ room {
|
||||||
private val timeFormat: String
|
private val timeFormat: String
|
||||||
get() = "dd/MM/yyyy HH:mm:ss"
|
get() = "dd/MM/yyyy HH:mm:ss"
|
||||||
|
|
||||||
private val timestamp: Long
|
private fun getGitBuildNumber(
|
||||||
get() = System.currentTimeMillis()
|
charset: Charset = Charset.defaultCharset(),
|
||||||
|
): Int {
|
||||||
private val gitBuildNumber: Int
|
return try {
|
||||||
get() {
|
|
||||||
val stdout = org.apache.commons.io.output.ByteArrayOutputStream()
|
val stdout = org.apache.commons.io.output.ByteArrayOutputStream()
|
||||||
rootProject.exec {
|
rootProject.exec {
|
||||||
commandLine("git", "rev-list", "--count", "HEAD")
|
commandLine("git", "rev-list", "--count", "HEAD")
|
||||||
standardOutput = stdout
|
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