Skip to content

Commit ea8d2c0

Browse files
remove moditet plugin
1 parent cdc7eb9 commit ea8d2c0

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ repositories {
1010

1111
dependencies {
1212
api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
13-
api("org.moditect:moditect-gradle-plugin:1.0.0-rc3")
13+
api("org.moditect:moditect:1.0.0.RC1")
1414
api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.6")
1515
}
Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
11

22
plugins {
33
id("kotlin")
4-
id("org.moditect.gradleplugin")
54
}
65

7-
moditect {
8-
// Generate a multi-release jar, the module descriptor will be located at META-INF/versions/9/module-info.class
9-
addMainModuleInfo {
10-
jvmVersion.set("9")
11-
overwriteExistingFiles.set(true)
12-
module {
13-
moduleInfoFile = file("src/main/moditect/module-info.java")
6+
val moditect by tasks.registering {
7+
doLast {
8+
// Generate a multi-release modulized jar, module descriptor position: META-INF/versions/9/module-info.class
9+
val inputJar = tasks.jar.flatMap { it.archiveFile }.map { it.asFile.toPath() }.get()
10+
val outputDir = file("build/moditect").apply { mkdirs() }.toPath()
11+
val moduleInfo = file("src/main/moditect/module-info.java").readText()
12+
val version = project.version.toString()
13+
org.moditect.commands.AddModuleInfo(moduleInfo, null, version, inputJar, outputDir, "9", true).run()
14+
15+
// Replace the original jar with the modulized jar.
16+
copy {
17+
from(outputDir.resolve(inputJar.fileName))
18+
into(inputJar.parent)
1419
}
1520
}
21+
}
1622

17-
// Let kotlin compiler know the module descriptor.
18-
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
19-
sourceSets.main {
20-
kotlin.srcDir("src/main/moditect")
21-
}
23+
tasks {
24+
moditect {
25+
dependsOn(jar)
2226
}
27+
jar {
28+
finalizedBy(moditect)
29+
}
30+
}
2331

24-
// Workaround to avoid circular task dependencies, see https://github.com/moditect/moditect-gradle-plugin/issues/14
25-
afterEvaluate {
26-
val compileJava = tasks.compileJava.get()
27-
val addDependenciesModuleInfo = tasks.addDependenciesModuleInfo.get()
28-
compileJava.setDependsOn(compileJava.dependsOn - addDependenciesModuleInfo)
32+
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
33+
// Let kotlin compiler know the module descriptor.
34+
sourceSets.main {
35+
kotlin.srcDir("src/main/moditect")
2936
}
3037
}

ktorm-core/ktorm-core.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ val testOutput by configurations.creating {
1919
}
2020

2121
val testJar by tasks.registering(Jar::class) {
22-
dependsOn("testClasses")
22+
dependsOn(tasks.testClasses)
2323
from(sourceSets.test.map { it.output })
2424
archiveClassifier.set("test")
2525
}

0 commit comments

Comments
 (0)