11import org.jetbrains.dokka.gradle.DokkaTaskPartial
22import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
33
4- val kotlinVersion: String by rootProject
5- val coroutinesVersion: String by rootProject
6- val junit5Version: String by project
74val semVer: String? by project
85val includeDokka: String? by project
96
107group = " 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"
209
2110plugins {
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) }
2416 `java- library`
17+ `java- test- fixtures`
2518 `maven- publish`
2619 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"
3320 jacoco
3421}
3522
36- repositories {
37- mavenCentral()
38- }
39-
4023allprojects {
4124 group = rootProject.group
4225 version = rootProject.version
4326
4427 apply {
45- plugin(" maven-publish" )
4628 plugin(" kotlin" )
4729 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" )
5033 plugin(" signing" )
51- plugin(" org.jetbrains.dokka " )
34+ plugin(" jacoco " )
5235 }
5336
5437 repositories {
@@ -60,33 +43,26 @@ allprojects {
6043 }
6144
6245 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" ))
6449
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)
6753
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)
7456 }
7557
7658 tasks {
77-
78- withType(DokkaTaskPartial ::class ).configureEach {
79- dokkaSourceSets.configureEach {
80- includes.from(" README.md" )
81- }
82- }
83-
8459 withType<JavaCompile > {
8560 sourceCompatibility = " 1.8"
8661 targetCompatibility = " 1.8"
8762 options.encoding = " UTF-8"
8863 options.compilerArgs = options.compilerArgs + " -Xlint:all"
8964 }
65+
9066 withType<KotlinCompile > {
9167 kotlinOptions {
9268 jvmTarget = " 1.8"
@@ -99,6 +75,7 @@ allprojects {
9975 allWarningsAsErrors = false
10076 }
10177 }
78+
10279 compileTestKotlin {
10380 kotlinOptions {
10481 jvmTarget = " 1.8"
@@ -111,6 +88,15 @@ allprojects {
11188 }
11289 }
11390
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+
114100 jacocoTestReport {
115101 dependsOn(test) // tests are required to run before generating the report
116102 classDirectories.setFrom(files(classDirectories.files.map {
@@ -124,13 +110,10 @@ allprojects {
124110 }
125111 }
126112
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" )
132116 }
133- finalizedBy(jacocoTestReport) // report is always generated after tests run
134117 }
135118 }
136119
@@ -145,7 +128,18 @@ allprojects {
145128 }
146129}
147130
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"
149143
150144if (! repoUrl.isNullOrEmpty()) {
151145 configure(
@@ -207,22 +201,6 @@ if (!repoUrl.isNullOrEmpty()) {
207201 }
208202}
209203
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-
226204fun MavenPublication.signPublication (project : Project ) = with (project) {
227205 signing {
228206 val gpgKey: String? by project
@@ -290,4 +268,9 @@ fun MavenPublication.addPom() {
290268 }
291269 }
292270 }
293- }
271+ }
272+
273+ tasks.wrapper {
274+ gradleVersion = " 8.3"
275+ distributionType = Wrapper .DistributionType .ALL
276+ }
0 commit comments