File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
common/src/main/kotlin/component Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 11package component
22
3- import org.jetbrains.kotlin.library.impl.isKotlinLibrary
3+ import org.jetbrains.kotlin.library.loader.KlibLoader
4+ import org.jetbrains.kotlin.library.loader.KlibPlatformChecker
45import java.io.File
56
67// NOTE: if new class paths are added, please add them to `JavaExec` task's inputs in build.gradle.kts as well
@@ -41,13 +42,13 @@ class KotlinEnvironment(
4142
4243 val JS_LIBRARIES = additionalJsClasspath
4344 .map { it.absolutePath }
44- .filter { isKotlinLibrary( File (it) ) }
45+ .filter { isJsKlib(it ) }
4546 val WASM_LIBRARIES = additionalWasmClasspath
4647 .map { it.absolutePath }
47- .filter { isKotlinLibrary( File (it) ) }
48+ .filter { isWasmKlib(it ) }
4849 val COMPOSE_WASM_LIBRARIES = additionalComposeWasmClasspath
4950 .map { it.absolutePath }
50- .filter { isKotlinLibrary( File (it) ) }
51+ .filter { isWasmKlib(it ) }
5152 val COMPOSE_WASM_COMPILER_PLUGINS = composeWasmCompilerPlugins
5253 .map { it.absolutePath }
5354
@@ -59,4 +60,13 @@ class KotlinEnvironment(
5960 return f()
6061 }
6162
63+ private fun isJsKlib (path : String ) = KlibLoader {
64+ libraryPaths(path)
65+ platformChecker(KlibPlatformChecker .JS )
66+ }.load().librariesStdlibFirst.isNotEmpty()
67+
68+ private fun isWasmKlib (path : String ) = KlibLoader {
69+ libraryPaths(path)
70+ platformChecker(KlibPlatformChecker .Wasm ())
71+ }.load().librariesStdlibFirst.isNotEmpty()
6272}
You can’t perform that action at this time.
0 commit comments