-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathProjects.kt
34 lines (28 loc) · 1.11 KB
/
Projects.kt
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
import org.gradle.api.Project
import org.gradle.api.provider.Provider
object Library {
const val name = "kord"
const val group = "dev.kord"
const val description = "Idiomatic Kotlin Wrapper for The Discord API"
const val projectUrl = "https://github.com/kordlib/kord"
}
private val Project.tag
get() = git("tag", "--no-column", "--points-at", "HEAD")
.takeIf { it.isNotBlank() }
?.lines()
?.single()
val Project.libraryVersion
get() = tag ?: run {
val snapshotPrefix = when (val branch = git("branch", "--show-current")) {
"main" -> providers.gradleProperty("nextPlannedVersion").get()
else -> branch.replace('/', '-')
}
"$snapshotPrefix-SNAPSHOT"
}
val Project.commitHash get() = git("rev-parse", "--verify", "HEAD")
val Project.shortCommitHash get() = git("rev-parse", "--short", "HEAD")
val Project.isRelease get() = tag != null
object Repo {
const val releasesUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
const val snapshotsUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
}