[JS IR] Use util-klib tool to filter klib in JS IR gradle plugin
This commit is contained in:
@@ -262,6 +262,16 @@ fun createKotlinLibraryComponents(
|
||||
|
||||
fun createKotlinLibrary(libraryFile: File): KotlinLibrary = resolveSingleFileKlib(libraryFile)
|
||||
|
||||
fun isKotlinLibrary(libraryFile: File): Boolean = try {
|
||||
createKotlinLibrary(libraryFile)
|
||||
true
|
||||
} catch (e: Throwable) {
|
||||
false
|
||||
}
|
||||
|
||||
fun isKotlinLibrary(libraryFile: java.io.File): Boolean =
|
||||
isKotlinLibrary(File(libraryFile.absolutePath))
|
||||
|
||||
val File.isPre_1_4_Library: Boolean
|
||||
get() {
|
||||
val baseAccess = BaseLibraryAccess<KotlinLibraryLayout>(this, null)
|
||||
|
||||
+2
-2
@@ -244,7 +244,7 @@ abstract class AbstractKotlin2JsGradlePluginIT(private val irBackend: Boolean) :
|
||||
assertSuccessful()
|
||||
checkIrCompilationMessage()
|
||||
if (irBackend) {
|
||||
assertFileExists(kotlinClassesDir() + "manifest")
|
||||
assertFileExists(kotlinClassesDir() + "default/manifest")
|
||||
} else {
|
||||
assertFileExists(kotlinClassesDir() + "kotlin2JsNoOutputFileProject.js")
|
||||
}
|
||||
@@ -265,7 +265,7 @@ abstract class AbstractKotlin2JsGradlePluginIT(private val irBackend: Boolean) :
|
||||
":compileTestKotlin2Js"
|
||||
)
|
||||
if (irBackend) {
|
||||
assertFileExists("build/kotlin2js/main/manifest")
|
||||
assertFileExists("build/kotlin2js/main/default/manifest")
|
||||
} else {
|
||||
assertFileExists("build/kotlin2js/main/module.js")
|
||||
}
|
||||
|
||||
+3
-2
@@ -37,6 +37,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.ownModuleName
|
||||
import org.jetbrains.kotlin.gradle.report.BuildReportMode
|
||||
import org.jetbrains.kotlin.gradle.utils.*
|
||||
import org.jetbrains.kotlin.incremental.ChangedFiles
|
||||
import org.jetbrains.kotlin.library.impl.isKotlinLibrary
|
||||
import org.jetbrains.kotlin.utils.LibraryUtils
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
@@ -547,7 +548,7 @@ open class Kotlin2JsCompile : AbstractKotlinCompile<K2JSCompilerArguments>(), Ko
|
||||
}
|
||||
|
||||
private fun isHybridKotlinJsLibrary(file: File): Boolean =
|
||||
LibraryUtils.isKotlinJavascriptLibrary(file) && LibraryUtils.isKotlinJavascriptIrLibrary(file)
|
||||
LibraryUtils.isKotlinJavascriptLibrary(file) && isKotlinLibrary(file)
|
||||
|
||||
private fun KotlinJsOptions.isPreIrBackendDisabled(): Boolean =
|
||||
listOf(
|
||||
@@ -570,7 +571,7 @@ open class Kotlin2JsCompile : AbstractKotlinCompile<K2JSCompilerArguments>(), Ko
|
||||
private val libraryFilter: (File) -> Boolean
|
||||
get() = if (kotlinOptions.isIrBackendEnabled()) {
|
||||
if (kotlinOptions.isPreIrBackendDisabled()) {
|
||||
LibraryUtils::isKotlinJavascriptIrLibrary
|
||||
::isKotlinLibrary
|
||||
} else {
|
||||
::isHybridKotlinJsLibrary
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user