-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
30 lines (26 loc) · 1.11 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import org.xml.sax.InputSource
import java.io.StringReader
import javax.xml.parsers.DocumentBuilderFactory
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.kotlinAndroid) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.kotlinSerialization) apply false
alias(libs.plugins.google.services) apply false
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.jetbrains.compose.compiler) apply false
}
tasks.register("printVersion") {
doLast {
val manifestFile = file("app/build/intermediates/merged_manifests/release/AndroidManifest.xml").readText()
val xml = DocumentBuilderFactory
.newInstance()
.newDocumentBuilder()
.parse(InputSource(StringReader(manifestFile)))
val versionCode = xml.documentElement.getAttribute("android:versionCode")
val versionName = xml.documentElement.getAttribute("android:versionName")
println("Version Name: $versionName")
println("Version Code: $versionCode")
}
}