-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
165 lines (140 loc) · 5.52 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
@file:Suppress("UnstableApiUsage")
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
val kotlinVersion = "1.6.10"
val gradlePublishVersion = "0.20.0"
kotlin("jvm") version kotlinVersion apply false
kotlin("plugin.serialization") version kotlinVersion apply false
id("org.jetbrains.dokka") version kotlinVersion
id("com.gradle.plugin-publish") version gradlePublishVersion apply false
val usingVelaVersion = "2.0.0-alpha3"
id("de.menkalian.vela.buildconfig") version usingVelaVersion apply false
id("de.menkalian.vela.featuretoggle") version usingVelaVersion apply false
id("de.menkalian.vela.keygen") version usingVelaVersion apply false
id("de.menkalian.vela.versioning") version usingVelaVersion apply false
}
val velaBaseVersion = "2.1.0"
val velaVersion = parseVelaVersion(velaBaseVersion)
val junitVersion = "5.8.2"
fun parseVelaVersion(baseVersion: String = velaBaseVersion): String {
// Expecting tag like `release-2.3.1-alpha4`
val buildTag: String?
if (System.getenv("GITHUB_REF_TYPE") == "tag")
buildTag = System
.getenv("GITHUB_REF_NAME")
?.substring("release-".length)
else
buildTag = null
val commitSha = System.getenv("GITHUB_SHA") ?: "dev"
return buildTag ?: "$baseVersion-$commitSha"
}
allprojects {
group = "de.menkalian.vela"
version = velaVersion
repositories {
mavenCentral()
google()
}
pluginManager.withPlugin("java") {
extensions.getByType(JavaPluginExtension::class.java).apply {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
dependencies {
add("testImplementation", "org.junit.jupiter:junit-jupiter-api:${junitVersion}")
add("testImplementation", "org.junit.jupiter:junit-jupiter-params:${junitVersion}")
add("testRuntimeOnly", "org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
}
tasks {
withType(Test::class.java) {
useJUnitPlatform()
testLogging {
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
}
}
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
dependencies {
add("implementation", kotlin("stdlib"))
add("implementation", kotlin("stdlib-jdk8"))
add("implementation", kotlin("stdlib-jdk7"))
add("implementation", kotlin("reflect"))
}
tasks.withType(KotlinCompile::class.java) {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
this.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
}
}
pluginManager.withPlugin("org.jetbrains.kotlin.plugin.serialization") {
dependencies {
add("implementation", "org.jetbrains.kotlinx:kotlinx-serialization-core:1.3.2")
}
}
pluginManager.withPlugin("org.jetbrains.dokka") {
val kotlinVersion = "1.6.10"
dependencies.add("dokkaHtmlPlugin", "org.jetbrains.dokka:kotlin-as-java-plugin:$kotlinVersion")
tasks.withType(DokkaTask::class.java).configureEach {
try {
dokkaSourceSets.named("main") {
platform.set(org.jetbrains.dokka.Platform.jvm)
sourceLink {
localDirectory.set(project.file("src/main/kotlin"))
remoteUrl.set(uri("https://gitlab.com/kiliankra/vela/-/tree/main/${projectDir.relativeTo(rootProject.projectDir)}/src/main/kotlin").toURL())
remoteLineSuffix.set("#L")
}
}
} catch (_: Exception) {
}
}
}
pluginManager.withPlugin("jacoco") {
tasks.withType(JacocoReport::class.java) {
dependsOn(tasks.getByName("test"))
classDirectories.setFrom(files(classDirectories.files.map {
fileTree(
mapOf(
"dir" to it,
"exclude" to listOf("de/menkalian/vela/gradle", "de/menkalian/vela/example")
)
)
}))
reports {
xml.required.set(true)
csv.required.set(true)
}
}
tasks.getByName("check") {
dependsOn(tasks.withType(JacocoReport::class.java))
}
}
pluginManager.withPlugin("com.gradle.plugin-publish") {
extensions.getByType(com.gradle.publish.PluginBundleExtension::class.java).apply {
website = "https://gitlab.com/kiliankra/vela"
vcsUrl = "https://gitlab.com/kiliankra/vela.git"
tags = listOf("tool", "vela")
}
}
pluginManager.withPlugin("maven-publish") {
extensions.getByType(PublishingExtension::class.java).apply {
repositories {
maven {
setUrl("https://artifactory.menkalian.de/artifactory/vela")
name = "artifactory-menkalian"
credentials {
username = System.getenv("MAVEN_REPO_USER")
password = System.getenv("MAVEN_REPO_PASS")
}
}
}
}
}
}
tasks.dokkaHtmlMultiModule.configure {
moduleName.set("Vela Source Documentation")
}