-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
88 lines (77 loc) · 2.11 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
plugins {
id("com.diffplug.spotless")
id("org.jetbrains.kotlin.jvm") apply false
id("org.jetbrains.kotlin.plugin.serialization") apply false
id("pl.allegro.tech.build.axion-release")
}
scmVersion {
useHighestVersion.set(true)
tag {
prefix.set("")
initialVersion { _, _ -> "1.0.0" }
}
versionCreator { versionFromTag, position ->
if (position.branch == "main")
versionFromTag
else
"${position.branch}-${position.shortRevision}"
}
}
tasks {
create("installLocalGitHook") {
delete {
delete(File(rootDir, ".git/hooks/pre-commit"))
}
copy {
from(File(rootDir, "scripts/pre-commit"))
into(File(rootDir, ".git/hooks"))
fileMode = 0b111101101
}
}
build {
dependsOn("installLocalGitHook")
}
}
allprojects {
apply(plugin = "pl.allegro.tech.build.axion-release")
scmVersion {
useHighestVersion.set(true)
tag {
prefix.set("")
initialVersion { _, _ -> "1.0.0" }
}
versionCreator { versionFromTag, position ->
if (position.branch == "main")
versionFromTag
else
"${position.branch}-${position.shortRevision}"
}
localOnly = true
}
project.group = "com.github.connorwyatt.common"
project.version = scmVersion.version
}
subprojects {
apply(plugin = "com.diffplug.spotless")
apply(plugin = "maven-publish")
apply(plugin = "org.jetbrains.kotlin.jvm")
spotless {
kotlin {
target("**/*.kt", "**/*.kts")
ktfmt(project.properties["ktfmtVersion"] as String).kotlinlangStyle()
}
}
tasks.withType(Test::class) {
useJUnitPlatform()
}
configure<PublishingExtension> {
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
}
}
}
}