-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
70 lines (62 loc) · 3.12 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
61
62
63
64
65
66
67
68
69
70
import org.ajoberstar.grgit.Grgit
@Suppress("RemoveRedundantBackticks")
plugins {
`distribution`
kotlin("jvm").apply(false)
kotlin("plugin.noarg").apply(false)
kotlin("plugin.serialization").apply(false)
id("org.ajoberstar.grgit")
id("com.github.hierynomus.license").apply(false)
id("com.github.johnrengelman.shadow").apply(false)
}
group = "com.epam.drill.admin"
val kotlinVersion: String by extra
val kotlinxCoroutinesVersion: String by extra
val kotlinxSerializationVersion: String by extra
repositories {
mavenLocal()
mavenCentral()
}
buildscript {
dependencies.classpath("org.apache.commons:commons-configuration2:2.9.0")
dependencies.classpath("commons-beanutils:commons-beanutils:1.9.4")
}
if(version == Project.DEFAULT_VERSION) {
val fromEnv: () -> String? = {
System.getenv("GITHUB_REF")?.let { Regex("refs/tags/v(.*)").matchEntire(it)?.groupValues?.get(1) }
}
val fromGit: () -> String? = {
val gitdir: (Any) -> Boolean = { projectDir.resolve(".git").isDirectory }
takeIf(gitdir)?.let {
val gitrepo = Grgit.open { dir = projectDir }
val gittag = gitrepo.describe {
tags = true
longDescr = true
match = listOf("v[0-9]*.[0-9]*.[0-9]*")
}
gittag?.trim()?.removePrefix("v")?.replace(Regex("-[0-9]+-g[0-9a-f]+$"), "")?.takeIf(String::any)
}
}
version = fromEnv() ?: fromGit() ?: version
}
subprojects {
val constraints = setOf(
dependencies.constraints.create("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"),
dependencies.constraints.create("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"),
dependencies.constraints.create("org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"),
dependencies.constraints.create("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"),
dependencies.constraints.create("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"),
dependencies.constraints.create("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion"),
dependencies.constraints.create("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$kotlinxCoroutinesVersion"),
dependencies.constraints.create("org.jetbrains.kotlinx:kotlinx-coroutines-debug:$kotlinxCoroutinesVersion"),
dependencies.constraints.create("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$kotlinxCoroutinesVersion"),
dependencies.constraints.create("org.jetbrains.kotlinx:kotlinx-serialization-core:$kotlinxSerializationVersion"),
dependencies.constraints.create("org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:$kotlinxSerializationVersion"),
dependencies.constraints.create("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinxSerializationVersion"),
dependencies.constraints.create("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:$kotlinxSerializationVersion"),
dependencies.constraints.create("org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$kotlinxSerializationVersion"),
)
configurations.all {
dependencyConstraints += constraints
}
}