Skip to content

Commit 440da96

Browse files
committed
e: Module kotlin.stdlib cannot be found in the module graph
1 parent 1b9567e commit 440da96

File tree

1 file changed

+11
-29
lines changed

1 file changed

+11
-29
lines changed

build.gradle.kts

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
kotlin("jvm") version "1.3.72"
3+
java
34
}
45

56
val moduleName = "com.github.kotlin_graphics.kotlin_unsigned"
@@ -13,6 +14,15 @@ repositories {
1314

1415
dependencies {
1516
implementation(kotlin("stdlib-jdk8"))
17+
18+
attributesSchema.attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE).compatibilityRules.add(ModularJarCompatibilityRule::class)
19+
components { withModule<ModularKotlinRule>(kotlin("stdlib-jdk8")) }
20+
21+
testImplementation("io.kotlintest:kotlintest-runner-junit5:$kotlintest_version")
22+
}
23+
24+
java {
25+
modularity.inferModulePath.set(true)
1626
}
1727

1828
//java {
@@ -60,31 +70,8 @@ tasks.compileJava {
6070
options.compilerArgs = listOf("--patch-module", "$moduleName=${sourceSets.main.get().output.asPath}")
6171
}
6272

63-
//compileJava {
64-
// // this is needed because we have a separate compile step in this example with the 'module-info.java' is in 'main/java' and the Kotlin code is in 'main/kotlin'
65-
// options.compilerArgs = ["--patch-module", "$moduleName=${sourceSets["main"].output.asPath}"]
66-
//// dependsOn(':compileKotlin')
67-
//// doFirst {
68-
//// options.compilerArgs = [
69-
//// '--module-path', classpath.asPath,
70-
//// '--patch-module', "$moduleName=${sourceSets["main"].output.asPath}"]
71-
//// classpath = files()
72-
//// }
73-
//}
74-
//
75-
//jar {
76-
// inputs.property("moduleName", moduleName)
77-
//// manifest.attributes('Automatic-Module-Name': moduleName)
78-
//// duplicatesStrategy = DuplicatesStrategy.EXCLUDE
79-
//}
80-
//
73+
8174
//test.useJUnitPlatform()
82-
//
83-
//plugins.withType(JavaPlugin).configureEach {
84-
// java {
85-
// modularity.inferModulePath = true
86-
// }
87-
//}
8875

8976
// == Add access to the 'modular' variant of kotlin("stdlib"): Put this into a buildSrc plugin and reuse it in all your subprojects
9077
configurations.all {
@@ -96,11 +83,6 @@ configurations.all {
9683
}
9784
}
9885

99-
dependencies {
100-
attributesSchema.attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE).compatibilityRules.add(ModularJarCompatibilityRule::class)
101-
components { withModule<ModularKotlinRule>(kotlin("stdlib")) }
102-
}
103-
10486
abstract class ModularJarCompatibilityRule : AttributeCompatibilityRule<LibraryElements> {
10587
override fun execute(details: CompatibilityCheckDetails<LibraryElements>): Unit = details.run {
10688
if (producerValue?.name == LibraryElements.JAR && consumerValue?.name == "modular-jar")

0 commit comments

Comments
 (0)