@@ -5,7 +5,7 @@ import org.jetbrains.dokka.gradle.*
5
5
import org.jetbrains.kotlin.config.*
6
6
import org.jetbrains.kotlin.gradle.tasks.*
7
7
import java.net.*
8
- import java.nio.file.Path
8
+ import java.nio.file.*
9
9
10
10
plugins {
11
11
idea
@@ -33,6 +33,7 @@ plugins {
33
33
gradleRelease
34
34
binCompatValidator
35
35
dependencyAnalyze
36
+ extraJavaModuleInfo
36
37
plugins.common
37
38
// kotlinxAtomicfu
38
39
}
@@ -61,6 +62,7 @@ application {
61
62
" -Djdk.attach.allowAttachSelf=true" ,
62
63
" -Djdk.tracePinnedThreads=full" ,
63
64
" -Djava.security.egd=file:/dev/./urandom" ,
65
+ " -Djdk.includeInExceptions=hostInfo,jar" ,
64
66
" -XX:+UnlockDiagnosticVMOptions" ,
65
67
" -XX:+ShowHiddenFrames" ,
66
68
" -ea" ,
@@ -99,7 +101,8 @@ java {
99
101
languageVersion.set(JavaLanguageVersion .of(javaVersion))
100
102
vendor.set(JvmVendorSpec .ORACLE )
101
103
}
102
- // modularity.inferModulePath.set(false)
104
+
105
+ // modularity.inferModulePath.set(true)
103
106
}
104
107
105
108
// Add the generated templates to source set.
@@ -226,14 +229,24 @@ release {
226
229
revertOnFail = true
227
230
}
228
231
229
- // For dependencies that are needed for development only.
230
- val devOnly: Configuration by configurations.creating {
231
- // extendsFrom(configurations["testImplementation"])
232
- // or val testImplementation by configurations
232
+ // Create ShadowJar specific runtimeClasspath.
233
+ val shadowRuntime: Configuration by configurations.creating {
234
+ val runtimeClasspath by configurations.getting
235
+ extendsFrom(runtimeClasspath)
236
+ attributes { attribute(Usage .USAGE_ATTRIBUTE , objects.named(Usage .JAVA_RUNTIME )) }
233
237
}
234
238
239
+ // For dependencies that are needed for development only.
240
+ val devOnly: Configuration by configurations.creating
241
+
242
+ // Deactivate java-module-info plugin for all configs
235
243
configurations {
236
- devOnly
244
+ // runtimeClasspath...etc
245
+ all {
246
+ attributes {
247
+ attribute(Attribute .of(" javaModule" , Boolean ::class .javaObjectType), false )
248
+ }
249
+ }
237
250
}
238
251
239
252
// After the project configure
@@ -298,7 +311,7 @@ tasks {
298
311
299
312
// Jte templates
300
313
generateJte {
301
- sourceDirectory = Path .of( " src" , " main" , " templates" , " jte" )
314
+ sourceDirectory = Paths .get(project.projectDir.absolutePath, " src" , " main" , " templates" , " jte" )
302
315
contentType = ContentType .Plain
303
316
}
304
317
@@ -311,6 +324,7 @@ tasks {
311
324
useJUnitPlatform()
312
325
jvmArgs(" --enable-preview" )
313
326
classpath + = devOnly
327
+
314
328
testLogging {
315
329
events = setOf (
316
330
TestLogEvent .PASSED ,
@@ -386,6 +400,7 @@ tasks {
386
400
// Don't create modular shadow jar
387
401
exclude(" module-info.class" )
388
402
// relocate("okio", "shaded.okio")
403
+ configurations = listOf (shadowRuntime)
389
404
doLast {
390
405
val fatJar = archiveFile.get().asFile
391
406
println (" FatJar: ${fatJar.path} (${fatJar.length().toDouble() / (1_000 * 1_000 )} MB)" )
0 commit comments