Skip to content

Commit 82112d6

Browse files
committed
Workaround resolving Gradle metadata in kotlin2js plugin
1 parent e961eb1 commit 82112d6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

js/example-frontend-js/build.gradle

+18
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@
55
apply plugin: 'kotlin-dce-js'
66
apply from: rootProject.file('gradle/node-js.gradle')
77

8+
// Workaround resolving new Gradle metadata with kotlin2js
9+
// TODO: Remove once plugin is fixed
10+
try {
11+
def jsCompilerType = Class.forName("org.jetbrains.kotlin.gradle.targets.js.JsCompilerType")
12+
def jsCompilerAttr = Attribute.of("org.jetbrains.kotlin.js.compiler", jsCompilerType)
13+
project.dependencies.attributesSchema.attribute(jsCompilerAttr)
14+
configurations {
15+
matching {
16+
it.name.endsWith("Classpath")
17+
}.forEach {
18+
it.attributes.attribute(jsCompilerAttr, jsCompilerType.legacy)
19+
}
20+
}
21+
} catch (java.lang.ClassNotFoundException e) {
22+
// org.jetbrains.kotlin.gradle.targets.js.JsCompilerType is missing in 1.3.x
23+
// But 1.3.x doesn't generate Gradle metadata, so this workaround is not needed
24+
}
25+
826
dependencies {
927
compile "org.jetbrains.kotlinx:kotlinx-html-js:$html_version"
1028
}

0 commit comments

Comments
 (0)