Skip to content

Commit 753646f

Browse files
committed
KT-37264 workaround for metadata compilation problem
1 parent 7472aa6 commit 753646f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

kotlinx-coroutines-core/build.gradle

+20
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,23 @@ task testsJar(type: Jar, dependsOn: jvmTestClasses) {
225225
artifacts {
226226
archives testsJar
227227
}
228+
229+
// KT-37264 Workaround for metadata compilation problem (provide an empty metadata instead)
230+
afterEvaluate {
231+
def emptySrcDir = new File(buildDir, "tmp/emptySrc")
232+
emptySrcDir.mkdirs()
233+
def emptySrcFile = new File(emptySrcDir, "EmptyKtFile.kt")
234+
emptySrcFile.createNewFile()
235+
def emptySrcDirs = project.objects.sourceDirectorySet("emptySrc", "empty sources for Kotlin common compilations")
236+
emptySrcDirs.srcDir(emptySrcDir)
237+
tasks.matching { it.name == "compileConcurrentMainKotlinMetadata" }.all {
238+
doFirst {
239+
emptySrcFile.text = "package kotlinx.coroutines"
240+
source = fileTree(emptySrcDir)
241+
}
242+
}
243+
kotlin.metadata { }.compilations.matching { it.name in ["nativeMain", "nativeDarwinMain", "nativeOtherMain"] }.all {
244+
it.getAllSources$kotlin_gradle_plugin().clear()
245+
it.getAllSources$kotlin_gradle_plugin().add(emptySrcDirs)
246+
}
247+
}

0 commit comments

Comments
 (0)