-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.gradle.kts
54 lines (43 loc) · 1.17 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
51
52
53
54
import java.io.FileInputStream
import java.nio.file.Paths
import java.nio.file.Files
import java.nio.file.StandardCopyOption
plugins {
alias(catalog.plugins.nexusPublish)
}
val versionProperties = java.util.Properties()
versionProperties.load(FileInputStream(file("version.properties")))
group = "co.elastic.otel"
version = versionProperties.get("version").toString()
description = "Elastic Distribution of OpenTelemetry Java"
defaultTasks("agent:assemble")
subprojects {
group = rootProject.group
version = rootProject.version
}
nexusPublishing {
repositories {
sonatype()
}
}
tasks {
register("currentVersion") {
doLast {
println(project.version)
}
}
register("setVersion") {
doLast {
val versionFile = file("version.properties")
versionFile.writeText("version=${project.property("newVersion")}\n")
}
}
register("setNextVersion") {
doLast {
val semVer = "\\d+\\.\\d+\\.\\d+".toRegex().find(version.toString())!!.value;
val nums = semVer.split('.');
val versionFile = file("version.properties")
versionFile.writeText("version=${nums[0]}.${nums[1]}.${nums[2].toInt() + 1}-SNAPSHOT\n")
}
}
}