forked from JetBrains/kotless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
60 lines (50 loc) · 1.41 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
55
56
57
58
59
60
import com.airthings.buildtools.util.Dependencies
import com.airthings.buildtools.util.Library
import com.airthings.buildtools.util.testImplementationAll
group = "com.airthings.cloud.kotless"
plugins {
`java-library`
`maven-publish`
}
kotlin {
explicitApi()
}
repositories {
mavenCentral()
}
dependencies {
testImplementationAll(*Dependencies.kotest)
testImplementationAll(*Dependencies.moshi)
testImplementation(Dependencies.kotlinsnapshot)
implementation(Dependencies.sensortype)
}
val latestTag = command("git describe --tags --abbrev=0") ?: "dummy.version" // dummy version for builds != deployment/publish
subprojects {
version = latestTag
}
publishing {
repositories {
maven {
name = "AirthingsGitHubPackages"
url = uri("https://maven.pkg.github.com/airthings/lib-kotless")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
withType<MavenPublication> {
pom {
artifactId = "kotless"
}
}
}
}
fun command(command: String): String? {
val cmd = command.split(" ").toTypedArray()
val process = ProcessBuilder(*cmd)
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.start()
return process.inputStream.bufferedReader().readLine()?.trim()
}