1
1
import org.jetbrains.dokka.gradle.DokkaTaskPartial
2
2
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3
3
4
- val kotlinVersion: String by rootProject
5
- val coroutinesVersion: String by rootProject
6
- val junit5Version: String by project
7
4
val semVer: String? by project
8
5
val includeDokka: String? by project
9
6
10
7
group = " org.jacodb"
11
-
12
- project.version = semVer ? : " 1.2-SNAPSHOT"
13
-
14
- buildscript {
15
- repositories {
16
- mavenCentral()
17
- maven(url = " https://plugins.gradle.org/m2/" )
18
- }
19
- }
8
+ version = semVer ? : " 1.2-SNAPSHOT"
20
9
21
10
plugins {
22
- val kotlinVersion = " 1.7.21"
23
-
11
+ kotlin(" jvm" ) version Versions .kotlin
12
+ kotlin(" plugin.allopen" ) version Versions .kotlin
13
+ kotlin(" plugin.serialization" ) version Versions .kotlin apply false
14
+ with (Plugins .Dokka ) { id(id) version (version) }
15
+ with (Plugins .Licenser ) { id(id) version (version) }
24
16
`java- library`
17
+ `java- test- fixtures`
25
18
`maven- publish`
26
19
signing
27
- `java- test- fixtures`
28
- kotlin(" jvm" ) version kotlinVersion
29
- kotlin(" plugin.allopen" ) version kotlinVersion
30
- id(" org.jetbrains.dokka" ) version " 1.7.20"
31
-
32
- id(" org.cadixdev.licenser" ) version " 0.6.1"
33
20
jacoco
34
21
}
35
22
36
- repositories {
37
- mavenCentral()
38
- }
39
-
40
23
allprojects {
41
24
group = rootProject.group
42
25
version = rootProject.version
43
26
44
27
apply {
45
- plugin(" maven-publish" )
46
28
plugin(" kotlin" )
47
29
plugin(" org.jetbrains.kotlin.plugin.allopen" )
48
- plugin(" org.cadixdev.licenser" )
49
- plugin(" jacoco" )
30
+ plugin(Plugins .Dokka .id)
31
+ plugin(Plugins .Licenser .id)
32
+ plugin(" maven-publish" )
50
33
plugin(" signing" )
51
- plugin(" org.jetbrains.dokka " )
34
+ plugin(" jacoco " )
52
35
}
53
36
54
37
repositories {
@@ -60,33 +43,26 @@ allprojects {
60
43
}
61
44
62
45
dependencies {
63
- implementation(group = " org.jetbrains.kotlinx" , name = " kotlinx-coroutines-core" , version = coroutinesVersion)
46
+ // Kotlin
47
+ implementation(platform(kotlin(" bom" )))
48
+ implementation(kotlin(" stdlib-jdk8" ))
64
49
65
- implementation(group = " org.jetbrains.kotlin" , name = " kotlin-stdlib-jdk8" , version = kotlinVersion)
66
- implementation(group = " org.jetbrains.kotlin" , name = " kotlin-reflect" , version = kotlinVersion)
50
+ // JUnit
51
+ testImplementation(platform(Libs .junit_bom))
52
+ testImplementation(Libs .junit_jupiter)
67
53
68
- testImplementation(" org.junit.jupiter:junit-jupiter" ) {
69
- version {
70
- strictly(junit5Version)
71
- }
72
- }
73
- testImplementation(group = " com.google.guava" , name = " guava" , version = " 31.1-jre" )
54
+ // Test dependencies
55
+ testRuntimeOnly(Libs .guava)
74
56
}
75
57
76
58
tasks {
77
-
78
- withType(DokkaTaskPartial ::class ).configureEach {
79
- dokkaSourceSets.configureEach {
80
- includes.from(" README.md" )
81
- }
82
- }
83
-
84
59
withType<JavaCompile > {
85
60
sourceCompatibility = " 1.8"
86
61
targetCompatibility = " 1.8"
87
62
options.encoding = " UTF-8"
88
63
options.compilerArgs = options.compilerArgs + " -Xlint:all"
89
64
}
65
+
90
66
withType<KotlinCompile > {
91
67
kotlinOptions {
92
68
jvmTarget = " 1.8"
@@ -99,6 +75,7 @@ allprojects {
99
75
allWarningsAsErrors = false
100
76
}
101
77
}
78
+
102
79
compileTestKotlin {
103
80
kotlinOptions {
104
81
jvmTarget = " 1.8"
@@ -111,6 +88,15 @@ allprojects {
111
88
}
112
89
}
113
90
91
+ withType<Test > {
92
+ useJUnitPlatform()
93
+ testLogging {
94
+ events(" passed" , " skipped" , " failed" )
95
+ }
96
+ finalizedBy(jacocoTestReport) // report is always generated after tests run
97
+ jvmArgs = listOf (" -Xmx2g" , " -XX:+HeapDumpOnOutOfMemoryError" , " -XX:HeapDumpPath=heapdump.hprof" )
98
+ }
99
+
114
100
jacocoTestReport {
115
101
dependsOn(test) // tests are required to run before generating the report
116
102
classDirectories.setFrom(files(classDirectories.files.map {
@@ -124,13 +110,10 @@ allprojects {
124
110
}
125
111
}
126
112
127
- withType<Test > {
128
- useJUnitPlatform()
129
- jvmArgs = listOf (" -Xmx2g" , " -XX:+HeapDumpOnOutOfMemoryError" , " -XX:HeapDumpPath=heapdump.hprof" )
130
- testLogging {
131
- events(" passed" , " skipped" , " failed" )
113
+ withType<DokkaTaskPartial > {
114
+ dokkaSourceSets.configureEach {
115
+ includes.from(" README.md" )
132
116
}
133
- finalizedBy(jacocoTestReport) // report is always generated after tests run
134
117
}
135
118
}
136
119
@@ -145,7 +128,18 @@ allprojects {
145
128
}
146
129
}
147
130
148
- val repoUrl: String? = project.properties[" repoUrl" ] as ? String ? : " https://maven.pkg.github.com/UnitTestBot/jacodb"
131
+ tasks.dokkaHtmlMultiModule {
132
+ removeChildTasks(
133
+ listOf (
134
+ project(" :jacodb-examples" ),
135
+ project(" :jacodb-cli" ),
136
+ project(" :jacodb-benchmarks" )
137
+ )
138
+ )
139
+ }
140
+
141
+ val repoUrl: String? = project.properties[" repoUrl" ] as ? String
142
+ ? : " https://maven.pkg.github.com/UnitTestBot/jacodb"
149
143
150
144
if (! repoUrl.isNullOrEmpty()) {
151
145
configure(
@@ -207,22 +201,6 @@ if (!repoUrl.isNullOrEmpty()) {
207
201
}
208
202
}
209
203
210
- configure(listOf (rootProject)) {
211
- tasks {
212
- dokkaHtmlMultiModule {
213
- removeChildTasks(
214
- listOf (
215
- project(" :jacodb-examples" ),
216
- project(" :jacodb-cli" ),
217
- project(" :jacodb-benchmarks" )
218
- )
219
- )
220
- }
221
- }
222
- }
223
-
224
-
225
-
226
204
fun MavenPublication.signPublication (project : Project ) = with (project) {
227
205
signing {
228
206
val gpgKey: String? by project
@@ -290,4 +268,9 @@ fun MavenPublication.addPom() {
290
268
}
291
269
}
292
270
}
293
- }
271
+ }
272
+
273
+ tasks.wrapper {
274
+ gradleVersion = " 8.3"
275
+ distributionType = Wrapper .DistributionType .ALL
276
+ }
0 commit comments