-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.gradle.kts
163 lines (137 loc) · 4.5 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
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.dokka")
alias(libs.plugins.ktlint)
id("maven-publish")
id("signing")
id("java-library")
id("net.researchgate.release") version "3.0.2"
alias(libs.plugins.kover) apply(false)
}
allprojects {
project.group = "com.strumenta.kolasu"
project.version = version
repositories {
mavenLocal()
mavenCentral()
}
}
val isReleaseVersion = !(version as String).endsWith("-SNAPSHOT")
subprojects {
if (this.name != "ast" && this.name != "antlr4k") {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "maven-publish")
apply(plugin = "idea")
apply(plugin = "signing")
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "org.jetbrains.kotlinx.kover")
this.version = rootProject.version
this.group = rootProject.group
val kotlinVersion = extra["kotlinVersion"]
if (this.name != "lionwebrepo-client") {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion")
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType(DokkaTask::class).configureEach {
dokkaSourceSets {
named("main") {
includeNonPublic.set(true)
moduleName.set("kolasu-" + moduleName.get())
}
}
}
tasks.register<Jar>("kdocJar") {
dependsOn("dokkaJavadoc")
from((tasks.named("dokkaJavadoc").get() as DokkaTask).outputDirectory)
archiveClassifier.set("javadoc")
}
tasks.register<Jar>("sourcesJar") {
archiveClassifier.set("sources")
// See https://discuss.gradle.org/t/why-subproject-sourceset-dirs-project-sourceset-dirs/7376/5
// Without the closure, parent sources are used for children too
from(sourceSets["main"].allSource)
}
tasks.named("publish") {
dependsOn("kdocJar")
dependsOn("sourcesJar")
}
tasks.named("publishToMavenLocal") {
dependsOn("kdocJar")
dependsOn("sourcesJar")
}
tasks.withType(Test::class).all {
testLogging {
showStandardStreams = true
showExceptions = true
exceptionFormat =
org
.gradle
.api
.tasks
.testing
.logging
.TestExceptionFormat
.FULL
}
}
val jvmVersion = extra["jvm_version"]!! as String
tasks
.withType(
KotlinCompile::class,
).all {
kotlinOptions {
jvmTarget = "$jvmVersion"
}
}
tasks.withType(Sign::class) {
enabled = isReleaseVersion
}
ktlint {
filter {
exclude { element ->
element
.file
.absolutePath
.split(File.separator)
.contains("build")
}
}
}
tasks
.withType<KotlinCompile>()
.configureEach {
compilerOptions
.languageVersion
.set(
KOTLIN_1_9,
)
}
}
}
release {
buildTasks.set(listOf("publish", ":lionweb-gen-gradle:publishPlugins", ":kotlin-ir-plugin-gradle:publishPlugins"))
git {
requireBranch.set("")
pushToRemote.set("origin")
}
}
tasks.wrapper {
gradleVersion = "8.9"
distributionType = Wrapper.DistributionType.ALL
}
tasks {
getByPath(":lionwebrepo-client:signMavenPublication")
.dependsOn(":lionwebrepo-client:kdocJar")
.dependsOn(":lionwebrepo-client:sourcesJar")
}