-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.gradle.kts
50 lines (43 loc) · 1.43 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.io.FileInputStream
import java.util.Properties
buildscript {
repositories {
mavenLocal()
google()
mavenCentral()
}
dependencies {
classpath(libs.android.gradle)
classpath(libs.kotlin.gradle)
classpath(libs.processing.ksp.gradle)
classpath(libs.hilt.gradle)
classpath(libs.emulator.wtf.gradle)
classpath(libs.processing.javaPoet) // https://github.com/google/dagger/issues/3068
}
}
allprojects {
repositories {
mavenLocal()
google()
mavenCentral()
}
}
tasks.register<Delete>("clean") {
delete(rootProject.buildDir)
}
tasks.register("updateVersion") {
doLast {
if (!project.hasProperty("versionName")) {
error("The updateVersion task requires a versionName property to be passed as an argument")
}
val versionPropertiesFile = rootProject.file("version.properties")
val existingProperties = Properties()
existingProperties.load(FileInputStream(versionPropertiesFile))
val versionName = project.properties["versionName"]
val versionCode = (existingProperties["versionCode"].toString().toInt()) + 1
if(versionName == existingProperties["versionName"]) {
error("The versionName '$versionName' is the current versionName")
}
versionPropertiesFile.writeText("versionName=$versionName\nversionCode=$versionCode")
}
}