[JS] Migrate tests onto IR compiler with outputDir API instead of outputFile

^KT-61117 fixed
This commit is contained in:
Ilya Goncharov
2023-11-29 11:21:56 +00:00
committed by Space Team
parent e50f6e6bca
commit 08e3cb300a
38 changed files with 208 additions and 201 deletions
@@ -23,17 +23,17 @@ import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumerImpl
import org.jetbrains.kotlin.incremental.js.IrTranslationResultValue import org.jetbrains.kotlin.incremental.js.IrTranslationResultValue
import org.jetbrains.kotlin.incremental.js.TranslationResultValue import org.jetbrains.kotlin.incremental.js.TranslationResultValue
import org.jetbrains.kotlin.incremental.storage.* import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf
import org.jetbrains.kotlin.library.metadata.KlibMetadataSerializerProtocol
import org.jetbrains.kotlin.metadata.ProtoBuf import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolverImpl import org.jetbrains.kotlin.metadata.deserialization.NameResolverImpl
import org.jetbrains.kotlin.metadata.deserialization.getExtensionOrNull import org.jetbrains.kotlin.metadata.deserialization.getExtensionOrNull
import org.jetbrains.kotlin.metadata.js.JsProtoBuf
import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.name.parentOrNull import org.jetbrains.kotlin.name.parentOrNull
import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol
import org.jetbrains.kotlin.serialization.deserialization.getClassId import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
import java.io.DataInput import java.io.DataInput
import java.io.DataOutput import java.io.DataOutput
@@ -371,7 +371,7 @@ private class ProtoDataProvider(private val serializerProtocol: SerializerExtens
// TODO: remove this method once AbstractJsProtoComparisonTest is fixed // TODO: remove this method once AbstractJsProtoComparisonTest is fixed
fun getProtoData(sourceFile: File, metadata: ByteArray): Map<ClassId, ProtoData> { fun getProtoData(sourceFile: File, metadata: ByteArray): Map<ClassId, ProtoData> {
val classes = hashMapOf<ClassId, ProtoData>() val classes = hashMapOf<ClassId, ProtoData>()
val proto = ProtoBuf.PackageFragment.parseFrom(metadata, JsSerializerProtocol.extensionRegistry) val proto = ProtoBuf.PackageFragment.parseFrom(metadata, KlibMetadataSerializerProtocol.extensionRegistry)
val nameResolver = NameResolverImpl(proto.strings, proto.qualifiedNames) val nameResolver = NameResolverImpl(proto.strings, proto.qualifiedNames)
proto.class_List.forEach { proto.class_List.forEach {
@@ -380,7 +380,7 @@ fun getProtoData(sourceFile: File, metadata: ByteArray): Map<ClassId, ProtoData>
} }
proto.`package`.apply { proto.`package`.apply {
val packageFqName = getExtensionOrNull(JsProtoBuf.packageFqName)?.let(nameResolver::getPackageFqName)?.let(::FqName) ?: FqName.ROOT val packageFqName = getExtensionOrNull(KlibMetadataProtoBuf.packageFqName)?.let(nameResolver::getPackageFqName)?.let(::FqName) ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt")) val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName) classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
} }
@@ -21,8 +21,10 @@ import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufClassKind
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufPackageKind import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufPackageKind
import org.jetbrains.kotlin.incremental.storage.ProtoMapValue import org.jetbrains.kotlin.incremental.storage.ProtoMapValue
import org.jetbrains.kotlin.metadata.ProtoBuf import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.ProtoBuf.Type
import org.jetbrains.kotlin.metadata.deserialization.Flags import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.deserialization.TypeTable
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite import org.jetbrains.kotlin.protobuf.MessageLite
@@ -260,10 +262,40 @@ class DifferenceCalculatorForClass(
isClassAffected = true isClassAffected = true
areSubclassesAffected = true areSubclassesAffected = true
val oldSupertypes = oldProto.supertypeList.map { oldNameResolver.getClassId(it.className).asSingleFqName() } val oldTypeTable = oldProto.typeTableOrNull?.let { TypeTable(it) }
val newSupertypes = newProto.supertypeList.map { newNameResolver.getClassId(it.className).asSingleFqName() } val newTypeTable = newProto.typeTableOrNull?.let { TypeTable(it) }
fun getSupertypes(supertypeList: List<Type>, nameResolver: NameResolver): List<FqName> {
return supertypeList.map { nameResolver.getClassId(it.className).asSingleFqName() }
}
fun getSupertypesById(supertypeIdList: List<Int>, typeTable: TypeTable?, nameResolver: NameResolver): List<FqName> {
return supertypeIdList.mapNotNull { id ->
typeTable?.get(id)?.className?.let {
nameResolver.getClassId(it).asSingleFqName()
}
}
}
val oldSupertypes = getSupertypes(oldProto.supertypeList, oldNameResolver)
val newSupertypes = getSupertypes(newProto.supertypeList, newNameResolver)
val oldSupertypesById = getSupertypesById(
oldProto.supertypeIdList,
oldTypeTable,
oldNameResolver
)
val newSupertypesById = getSupertypesById(
newProto.supertypeIdList,
newTypeTable,
newNameResolver
)
val changed = (oldSupertypes union newSupertypes) subtract (oldSupertypes intersect newSupertypes) val changed = (oldSupertypes union newSupertypes) subtract (oldSupertypes intersect newSupertypes)
changedSupertypes.addAll(changed) val changedById = (oldSupertypesById union newSupertypesById) subtract (oldSupertypesById intersect newSupertypesById)
val elements: Set<FqName> = changed + changedById
changedSupertypes.addAll(elements)
} }
ProtoBufClassKind.JVM_EXT_CLASS_MODULE_NAME, ProtoBufClassKind.JVM_EXT_CLASS_MODULE_NAME,
ProtoBufClassKind.JS_EXT_CLASS_CONTAINING_FILE_ID -> { ProtoBufClassKind.JS_EXT_CLASS_CONTAINING_FILE_ID -> {
@@ -2,15 +2,17 @@ package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder
import org.jetbrains.kotlin.incremental.utils.TestCompilationResult
import org.jetbrains.kotlin.incremental.utils.TestICReporter
import org.jetbrains.kotlin.incremental.utils.TestMessageCollector
import java.io.File import java.io.File
abstract class AbstractIncrementalK1JsKlibCompilerRunnerTest : AbstractIncrementalK1JsLegacyCompilerRunnerTest() { abstract class AbstractIncrementalK1JsKlibCompilerRunnerTest : AbstractIncrementalCompilerRunnerTestBase<K2JSCompilerArguments>() {
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments = override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments =
K2JSCompilerArguments().apply { K2JSCompilerArguments().apply {
libraries = "build/js-ir-runtime/full-runtime.klib" libraries = "build/js-ir-runtime/full-runtime.klib"
outputDir = destinationDir.path outputDir = destinationDir.path
moduleName = testDir.name moduleName = testDir.name
outputFile = null
sourceMap = false sourceMap = false
irProduceKlibDir = false irProduceKlibDir = false
irProduceKlibFile = true irProduceKlibFile = true
@@ -19,7 +21,22 @@ abstract class AbstractIncrementalK1JsKlibCompilerRunnerTest : AbstractIncrement
} }
override val buildLogFinder: BuildLogFinder override val buildLogFinder: BuildLogFinder
get() = super.buildLogFinder.copy(isKlibEnabled = true) get() = super.buildLogFinder.copy(
isKlibEnabled = true,
isJsEnabled = true,
isScopeExpansionEnabled = scopeExpansionMode != CompileScopeExpansionMode.NEVER,
)
override fun make(cacheDir: File, outDir: File, sourceRoots: Iterable<File>, args: K2JSCompilerArguments): TestCompilationResult {
val reporter = TestICReporter()
val messageCollector = TestMessageCollector()
makeJsIncrementally(cacheDir, sourceRoots, args, buildHistoryFile(cacheDir), messageCollector, reporter, scopeExpansionMode)
return TestCompilationResult(reporter, messageCollector)
}
protected open val scopeExpansionMode = CompileScopeExpansionMode.NEVER
override fun failFile(testDir: File): File = testDir.resolve("fail_js_legacy.txt")
} }
abstract class AbstractIncrementalK1JsKlibCompilerWithScopeExpansionRunnerTest : AbstractIncrementalK1JsKlibCompilerRunnerTest() { abstract class AbstractIncrementalK1JsKlibCompilerWithScopeExpansionRunnerTest : AbstractIncrementalK1JsKlibCompilerRunnerTest() {
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
import java.io.File import java.io.File
abstract class AbstractIncrementalK1JsLegacyCompilerRunnerWithFriendModulesDisabledTest : AbstractIncrementalK1JsLegacyCompilerRunnerTest() { abstract class AbstractIncrementalK1JsKlibCompilerRunnerWithFriendModulesDisabledTest : AbstractIncrementalK1JsKlibCompilerRunnerTest() {
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments = override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments =
super.createCompilerArguments(destinationDir, testDir).apply { super.createCompilerArguments(destinationDir, testDir).apply {
friendModulesDisabled = true friendModulesDisabled = true
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
import java.io.File import java.io.File
abstract class AbstractIncrementalK1JsLegacyMultiplatformJsCompilerRunnerTest : AbstractIncrementalK1JsLegacyCompilerRunnerTest() { abstract class AbstractIncrementalK1JsKlibMultiplatformJsCompilerRunnerTest : AbstractIncrementalK1JsKlibCompilerRunnerTest() {
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments { override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments {
return super.createCompilerArguments(destinationDir, testDir).apply { return super.createCompilerArguments(destinationDir, testDir).apply {
multiPlatform = true multiPlatform = true
@@ -1,52 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder
import org.jetbrains.kotlin.incremental.utils.TestCompilationResult
import org.jetbrains.kotlin.incremental.utils.TestICReporter
import org.jetbrains.kotlin.incremental.utils.TestMessageCollector
import java.io.File
abstract class AbstractIncrementalK1JsLegacyCompilerRunnerTest : AbstractIncrementalCompilerRunnerTestBase<K2JSCompilerArguments>() {
override fun make(cacheDir: File, outDir: File, sourceRoots: Iterable<File>, args: K2JSCompilerArguments): TestCompilationResult {
val reporter = TestICReporter()
val messageCollector = TestMessageCollector()
makeJsIncrementally(cacheDir, sourceRoots, args, buildHistoryFile(cacheDir), messageCollector, reporter, scopeExpansionMode)
return TestCompilationResult(reporter, messageCollector)
}
override val buildLogFinder: BuildLogFinder
get() = super.buildLogFinder.copy(
isJsEnabled = true,
isScopeExpansionEnabled = scopeExpansionMode != CompileScopeExpansionMode.NEVER
)
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments =
K2JSCompilerArguments().apply {
outputFile = File(destinationDir, "${testDir.name}.js").path
sourceMap = true
metaInfo = true
forceDeprecatedLegacyCompilerUsage = true
languageVersion = "1.9"
}
protected open val scopeExpansionMode = CompileScopeExpansionMode.NEVER
override fun failFile(testDir: File): File = testDir.resolve("fail_js_legacy.txt")
}
@@ -20,7 +20,7 @@ import java.util.regex.Pattern;
@TestMetadata("jps/jps-plugin/testData/incremental/js/friendsModuleDisabled") @TestMetadata("jps/jps-plugin/testData/incremental/js/friendsModuleDisabled")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
public class IncrementalK1JsLegacyCompilerRunnerWithFriendModulesDisabledTestGenerated extends AbstractIncrementalK1JsLegacyCompilerRunnerWithFriendModulesDisabledTest { public class IncrementalK1JsKlibCompilerRunnerWithFriendModulesDisabledTestGenerated extends AbstractIncrementalK1JsKlibCompilerRunnerWithFriendModulesDisabledTest {
private void runTest(String testDataFilePath) throws Exception { private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
} }
@@ -20,7 +20,7 @@ import java.util.regex.Pattern;
@TestMetadata("jps/jps-plugin/testData/incremental/mpp/allPlatforms") @TestMetadata("jps/jps-plugin/testData/incremental/mpp/allPlatforms")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
public class IncrementalK1JsLegacyMultiplatformJsCompilerRunnerTestGenerated extends AbstractIncrementalK1JsLegacyMultiplatformJsCompilerRunnerTest { public class IncrementalK1JsKlibMultiplatformJsCompilerRunnerTestGenerated extends AbstractIncrementalK1JsKlibMultiplatformJsCompilerRunnerTest {
private void runTest(String testDataFilePath) throws Exception { private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
} }
@@ -42,7 +42,7 @@ public class IncrementalK1JsLegacyMultiplatformJsCompilerRunnerTestGenerated ext
@TestMetadata("jps/jps-plugin/testData/incremental/mpp/allPlatforms/touchActual") @TestMetadata("jps/jps-plugin/testData/incremental/mpp/allPlatforms/touchActual")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
public static class TouchActual extends AbstractIncrementalK1JsLegacyMultiplatformJsCompilerRunnerTest { public static class TouchActual extends AbstractIncrementalK1JsKlibMultiplatformJsCompilerRunnerTest {
private void runTest(String testDataFilePath) throws Exception { private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
} }
@@ -55,7 +55,7 @@ public class IncrementalK1JsLegacyMultiplatformJsCompilerRunnerTestGenerated ext
@TestMetadata("jps/jps-plugin/testData/incremental/mpp/allPlatforms/touchExpect") @TestMetadata("jps/jps-plugin/testData/incremental/mpp/allPlatforms/touchExpect")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
public static class TouchExpect extends AbstractIncrementalK1JsLegacyMultiplatformJsCompilerRunnerTest { public static class TouchExpect extends AbstractIncrementalK1JsKlibMultiplatformJsCompilerRunnerTest {
private void runTest(String testDataFilePath) throws Exception { private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
} }
+8 -4
View File
@@ -1,5 +1,9 @@
$TESTDATA_DIR$/../kotlinPackage.kt $TESTDATA_DIR$/../kotlinPackage.kt
-no-stdlib -Xir-produce-klib-dir
-Xforce-deprecated-legacy-compiler-usage -Xir-only
-output -libraries
$TEMP_DIR$/out.js $STDLIB_JS$
-ir-output-dir
$TEMP_DIR$
-ir-output-name
out
@@ -5,10 +5,6 @@
<target name="build"> <target name="build">
<mkdir dir="${temp.library.path}"/> <mkdir dir="${temp.library.path}"/>
<kotlin2js src="${library.path}" noStdlib="true" output="${temp.library.path}/jslib-example.js" metaInfo="true">
<compilerarg value="-Xforce-deprecated-legacy-compiler-usage"/>
</kotlin2js>
<kotlin2js src="${test.data}/root1" noStdlib="true" output="${temp}/out.js" main="call"> <kotlin2js src="${test.data}/root1" noStdlib="true" output="${temp}/out.js" main="call">
<libraries> <libraries>
<pathelement path="${temp.library.path}"/> <pathelement path="${temp.library.path}"/>
@@ -146,7 +146,7 @@ fun main(args: Array<String>) {
model("incremental/js", extension = null, excludeParentDirs = true) model("incremental/js", extension = null, excludeParentDirs = true)
} }
testClass<AbstractIncrementalK1JsLegacyCompilerRunnerWithFriendModulesDisabledTest> { testClass<AbstractIncrementalK1JsKlibCompilerRunnerWithFriendModulesDisabledTest> {
model("incremental/js/friendsModuleDisabled", extension = null, recursive = false) model("incremental/js/friendsModuleDisabled", extension = null, recursive = false)
} }
@@ -154,7 +154,7 @@ fun main(args: Array<String>) {
model("incremental/mpp/allPlatforms", extension = null, excludeParentDirs = true) model("incremental/mpp/allPlatforms", extension = null, excludeParentDirs = true)
model("incremental/mpp/jvmOnlyK1", extension = null, excludeParentDirs = true) model("incremental/mpp/jvmOnlyK1", extension = null, excludeParentDirs = true)
} }
testClass<AbstractIncrementalK1JsLegacyMultiplatformJsCompilerRunnerTest> { testClass<AbstractIncrementalK1JsKlibMultiplatformJsCompilerRunnerTest> {
model("incremental/mpp/allPlatforms", extension = null, excludeParentDirs = true) model("incremental/mpp/allPlatforms", extension = null, excludeParentDirs = true)
} }
//TODO: write a proper k2 multiplatform test runner KT-63183 //TODO: write a proper k2 multiplatform test runner KT-63183
@@ -181,10 +181,12 @@ private fun readV2AndLaterConfig(
} }
productionOutputPath = element.getChild("productionOutputPath")?.let { productionOutputPath = element.getChild("productionOutputPath")?.let {
(it.content.firstOrNull() as? Text)?.textTrim?.let(FileUtilRt::toSystemDependentName) (it.content.firstOrNull() as? Text)?.textTrim?.let(FileUtilRt::toSystemDependentName)
} ?: (compilerArguments as? K2JSCompilerArguments)?.outputFile } ?: (compilerArguments as? K2JSCompilerArguments)?.outputDir
?: (compilerArguments as? K2JSCompilerArguments)?.outputFile
testOutputPath = element.getChild("testOutputPath")?.let { testOutputPath = element.getChild("testOutputPath")?.let {
(it.content.firstOrNull() as? Text)?.textTrim?.let(FileUtilRt::toSystemDependentName) (it.content.firstOrNull() as? Text)?.textTrim?.let(FileUtilRt::toSystemDependentName)
} ?: (compilerArguments as? K2JSCompilerArguments)?.outputFile } ?: (compilerArguments as? K2JSCompilerArguments)?.outputDir
?: (compilerArguments as? K2JSCompilerArguments)?.outputFile
} }
} }
@@ -239,7 +241,7 @@ fun CommonCompilerArguments.convertPathsToSystemIndependent() {
} }
is K2JSCompilerArguments -> { is K2JSCompilerArguments -> {
outputFile = outputFile?.let(FileUtilRt::toSystemIndependentName) outputDir = (outputDir ?: outputFile)?.let(FileUtilRt::toSystemIndependentName)
libraries = libraries?.let(FileUtilRt::toSystemIndependentName) libraries = libraries?.let(FileUtilRt::toSystemIndependentName)
} }
@@ -354,14 +356,16 @@ private fun KotlinFacetSettings.writeConfig(element: Element) {
if (pureKotlinSourceFolders.isNotEmpty()) { if (pureKotlinSourceFolders.isNotEmpty()) {
element.setAttribute("pureKotlinSourceFolders", pureKotlinSourceFolders.joinToString(";")) element.setAttribute("pureKotlinSourceFolders", pureKotlinSourceFolders.joinToString(";"))
} }
productionOutputPath?.let { (compilerArguments as? K2JSCompilerArguments)?.let { compilerArguments ->
if (it != (compilerArguments as? K2JSCompilerArguments)?.outputFile) { productionOutputPath?.let {
element.addContent(Element("productionOutputPath").apply { addContent(FileUtilRt.toSystemIndependentName(it)) }) if (it != compilerArguments.outputDir && it != compilerArguments.outputFile) {
element.addContent(Element("productionOutputPath").apply { addContent(FileUtilRt.toSystemIndependentName(it)) })
}
} }
} testOutputPath?.let {
testOutputPath?.let { if (it != compilerArguments.outputDir && it != compilerArguments.outputFile) {
if (it != (compilerArguments as? K2JSCompilerArguments)?.outputFile) { element.addContent(Element("testOutputPath").apply { addContent(FileUtilRt.toSystemIndependentName(it)) })
element.addContent(Element("testOutputPath").apply { addContent(FileUtilRt.toSystemIndependentName(it)) }) }
} }
} }
compilerSettings?.copyOf()?.let { compilerSettings?.copyOf()?.let {
@@ -237,7 +237,8 @@ class CompilerArgumentsContentProspectorTest {
K2JSCompilerArguments::wasm K2JSCompilerArguments::wasm
) )
private val k2JSCompilerArgumentsStringProperties = commonCompilerArgumentsStringProperties + listOf( private val k2JSCompilerArgumentsStringProperties = commonCompilerArgumentsStringProperties + listOf(
K2JSCompilerArguments::outputFile, K2JSCompilerArguments::outputDir,
K2JSCompilerArguments::moduleName,
K2JSCompilerArguments::libraries, K2JSCompilerArguments::libraries,
K2JSCompilerArguments::sourceMapPrefix, K2JSCompilerArguments::sourceMapPrefix,
K2JSCompilerArguments::sourceMapBaseDirs, K2JSCompilerArguments::sourceMapBaseDirs,
@@ -99,9 +99,6 @@ abstract class AbstractJvmLookupTrackerTest : AbstractLookupTrackerTest() {
} }
abstract class AbstractJsKlibLookupTrackerTest : AbstractJsLookupTrackerTest() { abstract class AbstractJsKlibLookupTrackerTest : AbstractJsLookupTrackerTest() {
override val jsStdlibFile: File
get() = File(System.getProperty("jps.testData.js-ir-runtime") ?: "build/js-ir-runtime/full-runtime.klib")
override fun configureAdditionalArgs(args: K2JSCompilerArguments) { override fun configureAdditionalArgs(args: K2JSCompilerArguments) {
args.irProduceKlibDir = true args.irProduceKlibDir = true
args.irOnly = true args.irOnly = true
@@ -157,7 +154,6 @@ abstract class AbstractJsLookupTrackerTest : AbstractLookupTrackerTest() {
get() = PathUtil.kotlinPathsForDistDirectoryForTests.jsStdLibKlibPath get() = PathUtil.kotlinPathsForDistDirectoryForTests.jsStdLibKlibPath
protected open fun configureAdditionalArgs(args: K2JSCompilerArguments) { protected open fun configureAdditionalArgs(args: K2JSCompilerArguments) {
args.outputFile = File(outDir, "out.js").canonicalPath
} }
override fun runCompiler(filesToCompile: Iterable<File>, env: JpsCompilerEnvironment): Any? { override fun runCompiler(filesToCompile: Iterable<File>, env: JpsCompilerEnvironment): Any? {
@@ -166,7 +162,6 @@ abstract class AbstractJsLookupTrackerTest : AbstractLookupTrackerTest() {
libraries = libPaths.joinToString(File.pathSeparator) libraries = libPaths.joinToString(File.pathSeparator)
reportOutputFiles = true reportOutputFiles = true
freeArgs = filesToCompile.map { it.canonicalPath } freeArgs = filesToCompile.map { it.canonicalPath }
forceDeprecatedLegacyCompilerUsage = true
useFirLT = false useFirLT = false
} }
configureAdditionalArgs(args) configureAdditionalArgs(args)
@@ -90,9 +90,7 @@ abstract class KotlinJpsBuildTestBase : AbstractKotlinJpsBuildTestCase() {
protected fun setupKotlinJSFacet() { protected fun setupKotlinJSFacet() {
myProject.modules.forEach { myProject.modules.forEach {
val facet = KotlinFacetSettings() val facet = KotlinFacetSettings()
facet.compilerArguments = K2JSCompilerArguments().apply { facet.compilerArguments = K2JSCompilerArguments()
forceDeprecatedLegacyCompilerUsage = true
}
facet.targetPlatform = JsPlatforms.defaultJsPlatform facet.targetPlatform = JsPlatforms.defaultJsPlatform
it.container.setChild( it.container.setChild(
@@ -264,7 +264,6 @@ class ModulesTxtBuilder {
"js" -> settings.compilerArguments = "js" -> settings.compilerArguments =
K2JSCompilerArguments().also { K2JSCompilerArguments().also {
settings.targetPlatform = JsPlatforms.defaultJsPlatform settings.targetPlatform = JsPlatforms.defaultJsPlatform
it.forceDeprecatedLegacyCompilerUsage = true
} }
"native" -> settings.compilerArguments = "native" -> settings.compilerArguments =
K2NativeCompilerArguments().also { settings.targetPlatform = NativePlatforms.unspecifiedNativePlatform } K2NativeCompilerArguments().also { settings.targetPlatform = NativePlatforms.unspecifiedNativePlatform }
@@ -16,7 +16,6 @@
package org.jetbrains.kotlin.jps.incremental package org.jetbrains.kotlin.jps.incremental
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants
import org.jetbrains.kotlin.compilerRunner.OutputItemsCollectorImpl import org.jetbrains.kotlin.compilerRunner.OutputItemsCollectorImpl
@@ -27,10 +26,15 @@ import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumer
import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumerImpl import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumerImpl
import org.jetbrains.kotlin.incremental.utils.TestMessageCollector import org.jetbrains.kotlin.incremental.utils.TestMessageCollector
import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.test.kotlinPathsForDistDirectoryForTests
import org.jetbrains.kotlin.utils.PathUtil
import org.junit.Assert import org.junit.Assert
import java.io.File import java.io.File
abstract class AbstractJsProtoComparisonTest : AbstractProtoComparisonTest<ProtoData>() { abstract class AbstractJsProtoComparisonTest : AbstractProtoComparisonTest<ProtoData>() {
protected open val jsStdlibFile: File
get() = PathUtil.kotlinPathsForDistDirectoryForTests.jsStdLibKlibPath
override fun expectedOutputFile(testDir: File): File = override fun expectedOutputFile(testDir: File): File =
File(testDir, "result-js.out") File(testDir, "result-js.out")
.takeIf { it.exists() } .takeIf { it.exists() }
@@ -47,11 +51,13 @@ abstract class AbstractJsProtoComparisonTest : AbstractProtoComparisonTest<Proto
val messageCollector = TestMessageCollector() val messageCollector = TestMessageCollector()
val outputItemsCollector = OutputItemsCollectorImpl() val outputItemsCollector = OutputItemsCollectorImpl()
val args = K2JSCompilerArguments().apply { val args = K2JSCompilerArguments().apply {
outputFile = File(outputDir, "out.js").canonicalPath this.outputDir = outputDir.normalize().absolutePath
metaInfo = true moduleName = "out"
libraries = jsStdlibFile.absolutePath
irProduceKlibDir = true
irOnly = true
main = K2JsArgumentConstants.NO_CALL main = K2JsArgumentConstants.NO_CALL
freeArgs = ktFiles freeArgs = ktFiles
forceDeprecatedLegacyCompilerUsage = true
languageVersion = "1.9" languageVersion = "1.9"
} }
@@ -343,11 +343,12 @@ class JpsKotlinCompilerRunner {
settings: K2JSCompilerArguments, settings: K2JSCompilerArguments,
) { ) {
with(settings) { with(settings) {
noStdlib = true
freeArgs = allSourceFiles.map { it.path }.toMutableList() freeArgs = allSourceFiles.map { it.path }.toMutableList()
irProduceKlibDir = true
irOnly = true
commonSources = _commonSources.map { it.path }.toTypedArray() commonSources = _commonSources.map { it.path }.toTypedArray()
outputFile = _outputFile.path outputDir = _outputFile.parent
metaInfo = true moduleName = _outputFile.nameWithoutExtension
libraries = _libraries.joinToString(File.pathSeparator) libraries = _libraries.joinToString(File.pathSeparator)
friendModules = _friendModules.joinToString(File.pathSeparator) friendModules = _friendModules.joinToString(File.pathSeparator)
} }
@@ -22,10 +22,9 @@ import org.jetbrains.jps.incremental.ModuleBuildTarget
import org.jetbrains.jps.incremental.storage.BuildDataManager import org.jetbrains.jps.incremental.storage.BuildDataManager
import org.jetbrains.jps.incremental.storage.StorageOwner import org.jetbrains.jps.incremental.storage.StorageOwner
import org.jetbrains.kotlin.incremental.* import org.jetbrains.kotlin.incremental.*
import org.jetbrains.kotlin.incremental.storage.FileToPathConverter
import org.jetbrains.kotlin.jps.build.KotlinBuilder import org.jetbrains.kotlin.jps.build.KotlinBuilder
import org.jetbrains.kotlin.jps.targets.KotlinModuleBuildTarget import org.jetbrains.kotlin.jps.targets.KotlinModuleBuildTarget
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol import org.jetbrains.kotlin.library.metadata.KlibMetadataSerializerProtocol
import java.io.File import java.io.File
interface JpsIncrementalCache : IncrementalCacheCommon, StorageOwner { interface JpsIncrementalCache : IncrementalCacheCommon, StorageOwner {
@@ -52,7 +51,7 @@ class JpsIncrementalJsCache(
target: ModuleBuildTarget, target: ModuleBuildTarget,
paths: BuildDataPaths, paths: BuildDataPaths,
icContext: IncrementalCompilationContext icContext: IncrementalCompilationContext
) : IncrementalJsCache(paths.getTargetDataRoot(target), icContext, JsSerializerProtocol), JpsIncrementalCache { ) : IncrementalJsCache(paths.getTargetDataRoot(target), icContext, KlibMetadataSerializerProtocol), JpsIncrementalCache {
override fun addJpsDependentCache(cache: JpsIncrementalCache) { override fun addJpsDependentCache(cache: JpsIncrementalCache) {
if (cache is JpsIncrementalJsCache) { if (cache is JpsIncrementalJsCache) {
addDependentCache(cache) addDependentCache(cache)
@@ -1,10 +1,10 @@
PROTO DIFFERENCE in test/AnnotationAdded: JS_EXT_CLASS_ANNOTATION_LIST PROTO DIFFERENCE in test/AnnotationAdded: KLIB_EXT_CLASS_ANNOTATION_LIST
CHANGES in test/AnnotationAdded: CLASS_SIGNATURE CHANGES in test/AnnotationAdded: CLASS_SIGNATURE
PROTO DIFFERENCE in test/AnnotationListBecomeEmpty: FLAGS, JS_EXT_CLASS_ANNOTATION_LIST PROTO DIFFERENCE in test/AnnotationListBecomeEmpty: FLAGS, KLIB_EXT_CLASS_ANNOTATION_LIST
CHANGES in test/AnnotationListBecomeEmpty: CLASS_SIGNATURE CHANGES in test/AnnotationListBecomeEmpty: CLASS_SIGNATURE
PROTO DIFFERENCE in test/AnnotationListBecomeNotEmpty: FLAGS, JS_EXT_CLASS_ANNOTATION_LIST PROTO DIFFERENCE in test/AnnotationListBecomeNotEmpty: FLAGS, KLIB_EXT_CLASS_ANNOTATION_LIST
CHANGES in test/AnnotationListBecomeNotEmpty: CLASS_SIGNATURE CHANGES in test/AnnotationListBecomeNotEmpty: CLASS_SIGNATURE
PROTO DIFFERENCE in test/AnnotationRemoved: JS_EXT_CLASS_ANNOTATION_LIST PROTO DIFFERENCE in test/AnnotationRemoved: KLIB_EXT_CLASS_ANNOTATION_LIST
CHANGES in test/AnnotationRemoved: CLASS_SIGNATURE CHANGES in test/AnnotationRemoved: CLASS_SIGNATURE
PROTO DIFFERENCE in test/AnnotationReplaced: JS_EXT_CLASS_ANNOTATION_LIST PROTO DIFFERENCE in test/AnnotationReplaced: KLIB_EXT_CLASS_ANNOTATION_LIST
CHANGES in test/AnnotationReplaced: CLASS_SIGNATURE CHANGES in test/AnnotationReplaced: CLASS_SIGNATURE
@@ -2,10 +2,10 @@ PROTO DIFFERENCE in test/AbstractFlagAdded: FLAGS
CHANGES in test/AbstractFlagAdded: CLASS_SIGNATURE CHANGES in test/AbstractFlagAdded: CLASS_SIGNATURE
PROTO DIFFERENCE in test/AbstractFlagRemoved: FLAGS PROTO DIFFERENCE in test/AbstractFlagRemoved: FLAGS
CHANGES in test/AbstractFlagRemoved: CLASS_SIGNATURE CHANGES in test/AbstractFlagRemoved: CLASS_SIGNATURE
PROTO DIFFERENCE in test/AnnotationFlagAdded: FLAGS, SUPERTYPE_LIST PROTO DIFFERENCE in test/AnnotationFlagAdded: FLAGS, SUPERTYPE_ID_LIST
CHANGES in test/AnnotationFlagAdded: CLASS_SIGNATURE, PARENTS CHANGES in test/AnnotationFlagAdded: CLASS_SIGNATURE, PARENTS
[kotlin.Annotation, kotlin.Any] [kotlin.Annotation, kotlin.Any]
PROTO DIFFERENCE in test/AnnotationFlagRemoved: FLAGS, SUPERTYPE_LIST PROTO DIFFERENCE in test/AnnotationFlagRemoved: FLAGS, SUPERTYPE_ID_LIST
CHANGES in test/AnnotationFlagRemoved: CLASS_SIGNATURE, PARENTS CHANGES in test/AnnotationFlagRemoved: CLASS_SIGNATURE, PARENTS
[kotlin.Annotation, kotlin.Any] [kotlin.Annotation, kotlin.Any]
PROTO DIFFERENCE in test/DataFlagAdded: FLAGS, FUNCTION_LIST PROTO DIFFERENCE in test/DataFlagAdded: FLAGS, FUNCTION_LIST
@@ -14,10 +14,10 @@ CHANGES in test/DataFlagAdded: CLASS_SIGNATURE, MEMBERS
PROTO DIFFERENCE in test/DataFlagRemoved: FLAGS, FUNCTION_LIST PROTO DIFFERENCE in test/DataFlagRemoved: FLAGS, FUNCTION_LIST
CHANGES in test/DataFlagRemoved: CLASS_SIGNATURE, MEMBERS CHANGES in test/DataFlagRemoved: CLASS_SIGNATURE, MEMBERS
[component1, copy, equals, hashCode, toString] [component1, copy, equals, hashCode, toString]
PROTO DIFFERENCE in test/EnumFlagAdded: CONSTRUCTOR_LIST, FLAGS, SUPERTYPE_LIST PROTO DIFFERENCE in test/EnumFlagAdded: CONSTRUCTOR_LIST, FLAGS, SUPERTYPE_ID_LIST
CHANGES in test/EnumFlagAdded: CLASS_SIGNATURE, PARENTS CHANGES in test/EnumFlagAdded: CLASS_SIGNATURE, PARENTS
[kotlin.Any, kotlin.Enum] [kotlin.Any, kotlin.Enum]
PROTO DIFFERENCE in test/EnumFlagRemoved: CONSTRUCTOR_LIST, FLAGS, SUPERTYPE_LIST PROTO DIFFERENCE in test/EnumFlagRemoved: CONSTRUCTOR_LIST, FLAGS, SUPERTYPE_ID_LIST
CHANGES in test/EnumFlagRemoved: CLASS_SIGNATURE, PARENTS CHANGES in test/EnumFlagRemoved: CLASS_SIGNATURE, PARENTS
[kotlin.Any, kotlin.Enum] [kotlin.Any, kotlin.Enum]
PROTO DIFFERENCE in test/InnerClassHolder.InnerFlagAdded: FLAGS PROTO DIFFERENCE in test/InnerClassHolder.InnerFlagAdded: FLAGS
@@ -0,0 +1,3 @@
PROTO DIFFERENCE in test/ClassWithSuperTypeListChanged: SUPERTYPE_ID_LIST
CHANGES in test/ClassWithSuperTypeListChanged: CLASS_SIGNATURE, PARENTS
[kotlin.Any, kotlin.Throwable]
@@ -0,0 +1,3 @@
PROTO DIFFERENCE in test/Base.Nested1.Nested2: SUPERTYPE_ID_LIST
CHANGES in test/Base.Nested1.Nested2: CLASS_SIGNATURE, PARENTS
[kotlin.Any, test.Base]
@@ -0,0 +1,8 @@
ADDED test/Impl11
PROTO DIFFERENCE in test/Base1: SEALED_SUBCLASS_FQ_NAME_LIST
CHANGES in test/Base1: CLASS_SIGNATURE
PROTO DIFFERENCE in test/Base2: SEALED_SUBCLASS_FQ_NAME_LIST
CHANGES in test/Base2: CLASS_SIGNATURE
PROTO DIFFERENCE in test/Impl22: SUPERTYPE_ID_LIST
CHANGES in test/Impl22: CLASS_SIGNATURE, PARENTS
[kotlin.Any, test.Base2]
@@ -0,0 +1,8 @@
REMOVED test/Impl11
PROTO DIFFERENCE in test/Base1: SEALED_SUBCLASS_FQ_NAME_LIST
CHANGES in test/Base1: CLASS_SIGNATURE
PROTO DIFFERENCE in test/Base2: SEALED_SUBCLASS_FQ_NAME_LIST
CHANGES in test/Base2: CLASS_SIGNATURE
PROTO DIFFERENCE in test/Impl22: SUPERTYPE_ID_LIST
CHANGES in test/Impl22: CLASS_SIGNATURE, PARENTS
[kotlin.Any, test.Base2]
@@ -0,0 +1,9 @@
ADDED test/Base1.Nested2
PROTO DIFFERENCE in test/Base1: NESTED_CLASS_NAME_LIST, SEALED_SUBCLASS_FQ_NAME_LIST
CHANGES in test/Base1: CLASS_SIGNATURE, MEMBERS
[Nested2]
PROTO DIFFERENCE in test/Base2: SEALED_SUBCLASS_FQ_NAME_LIST
CHANGES in test/Base2: CLASS_SIGNATURE
PROTO DIFFERENCE in test/Base2.Nested2: SUPERTYPE_ID_LIST
CHANGES in test/Base2.Nested2: CLASS_SIGNATURE, PARENTS
[kotlin.Any, test.Base2]
@@ -0,0 +1,13 @@
ADDED test/Base1.Nested1.Nested2.Nested3
ADDED test/Base2.Nested1.Nested3
PROTO DIFFERENCE in test/Base1.Nested1.Nested2: NESTED_CLASS_NAME_LIST, SEALED_SUBCLASS_FQ_NAME_LIST
CHANGES in test/Base1.Nested1.Nested2: CLASS_SIGNATURE, MEMBERS
[Nested3]
PROTO DIFFERENCE in test/Base2.Nested1: NESTED_CLASS_NAME_LIST, SEALED_SUBCLASS_FQ_NAME_LIST
CHANGES in test/Base2.Nested1: CLASS_SIGNATURE, MEMBERS
[Nested3]
PROTO DIFFERENCE in test/Base3.Nested1: SEALED_SUBCLASS_FQ_NAME_LIST
CHANGES in test/Base3.Nested1: CLASS_SIGNATURE
PROTO DIFFERENCE in test/Base3.Nested1.Nested2: SUPERTYPE_ID_LIST
CHANGES in test/Base3.Nested1.Nested2: CLASS_SIGNATURE, PARENTS
[kotlin.Any, test.Base3.Nested1]
@@ -0,0 +1,9 @@
REMOVED test/Base1.Nested2
PROTO DIFFERENCE in test/Base1: NESTED_CLASS_NAME_LIST, SEALED_SUBCLASS_FQ_NAME_LIST
CHANGES in test/Base1: CLASS_SIGNATURE, MEMBERS
[Nested2]
PROTO DIFFERENCE in test/Base2: SEALED_SUBCLASS_FQ_NAME_LIST
CHANGES in test/Base2: CLASS_SIGNATURE
PROTO DIFFERENCE in test/Base2.Nested2: SUPERTYPE_ID_LIST
CHANGES in test/Base2.Nested2: CLASS_SIGNATURE, PARENTS
[kotlin.Any, test.Base2]
@@ -2,6 +2,3 @@ c [sourceSetHolder]
pJvm [compilationAndSourceSetHolder, jvm] pJvm [compilationAndSourceSetHolder, jvm]
pJvm -> c [include] pJvm -> c [include]
pJs [compilationAndSourceSetHolder, js]
pJs -> c [include]
@@ -1,34 +1,6 @@
================ Step #1 make compilation fail ================= ================ Step #1 make compilation fail =================
Building c Building c
Building pJs
Cleaning output files:
out/production/pJs/pJs.js
out/production/pJs/pJs.meta.js
out/production/pJs/pJs/root-package.kjsm
End of files
Complementary files. Marked as dirty by Kotlin:
pJs/src/fJs.kt
Compiling files:
c/src/f.kt
pJs/src/fJs.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
[pJs] Expecting a top level declaration
[pJs] Expecting a top level declaration
================ Step #2 fix error =================
Building c
Building pJs
Compiling files:
c/src/f.kt
pJs/src/fJs.kt
End of files
Exit code: OK
------------------------------------------
Building pJvm Building pJvm
Cleaning output files: Cleaning output files:
out/production/pJvm/META-INF/pJvm.kotlin_module out/production/pJvm/META-INF/pJvm.kotlin_module
@@ -42,5 +14,17 @@ Compiling files:
c/src/f.kt c/src/f.kt
pJvm/src/fJvm.kt pJvm/src/fJvm.kt
End of files End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
================ Step #2 fix error =================
Building c
Building pJvm
Compiling files:
c/src/f.kt
pJvm/src/fJvm.kt
End of files
Exit code: OK Exit code: OK
------------------------------------------ ------------------------------------------
@@ -2,6 +2,3 @@ c [sourceSetHolder]
pJvm [compilationAndSourceSetHolder, jvm] pJvm [compilationAndSourceSetHolder, jvm]
pJvm -> c [include] pJvm -> c [include]
pJs [compilationAndSourceSetHolder, js]
pJs -> c [include]
@@ -1,41 +1,6 @@
================ Step #1 make compilation fail ================= ================ Step #1 make compilation fail =================
Building c Building c
Building pJs
Cleaning output files:
out/production/pJs/pJs.js
out/production/pJs/pJs.meta.js
out/production/pJs/pJs/root-package.kjsm
End of files
Complementary files. Marked as dirty by Kotlin:
c/src/g.kt
pJs/src/fg.kt
Compiling files:
c/src/f.kt
c/src/g.kt
pJs/src/fg.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
[pJs] Expecting a top level declaration
[pJs] Expecting a top level declaration
================ Step #2 fix error =================
Building c
Building pJs
Complementary files. Marked as dirty by Kotlin:
c/src/g.kt
Compiling files:
c/src/f.kt
c/src/g.kt
pJs/src/fg.kt
End of files
Exit code: OK
------------------------------------------
ChunkBuildStarted. Marked as dirty by Kotlin:
c/src/g.kt
Building pJvm Building pJvm
Cleaning output files: Cleaning output files:
out/production/pJvm/META-INF/pJvm.kotlin_module out/production/pJvm/META-INF/pJvm.kotlin_module
@@ -51,5 +16,20 @@ Compiling files:
c/src/g.kt c/src/g.kt
pJvm/src/fg.kt pJvm/src/fg.kt
End of files End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
================ Step #2 fix error =================
Building c
Building pJvm
Complementary files. Marked as dirty by Kotlin:
c/src/g.kt
Compiling files:
c/src/f.kt
c/src/g.kt
pJvm/src/fg.kt
End of files
Exit code: OK Exit code: OK
------------------------------------------ ------------------------------------------
@@ -21,7 +21,8 @@ dependencies {
} }
tasks.named("compileKotlinJs", Kotlin2JsCompile) { tasks.named("compileKotlinJs", Kotlin2JsCompile) {
it.kotlinOptions.outputFile = "${buildDir}/kotlin2js/main/module.js" it.destinationDirectory = new File(buildDir, "kotlin2js/main")
it.kotlinOptions.moduleName = "module"
it.kotlinOptions.freeCompilerArgs += ["-Xir-produce-klib-dir", "-Xir-only"] it.kotlinOptions.freeCompilerArgs += ["-Xir-produce-klib-dir", "-Xir-only"]
} }
@@ -29,7 +29,8 @@ artifacts {
def outDir = "${buildDir}/kotlin2js/main/" def outDir = "${buildDir}/kotlin2js/main/"
compileKotlin2Js.kotlinOptions.outputFile = outDir + "test-library.js" compileKotlin2Js.destinationDirectory = new File(outDir)
compileKotlin2Js.kotlinOptions.moduleName = "test-library"
compileKotlin2Js.kotlinOptions.freeCompilerArgs += ["-Xir-produce-klib-dir"] compileKotlin2Js.kotlinOptions.freeCompilerArgs += ["-Xir-produce-klib-dir"]
@@ -21,7 +21,8 @@ dependencies {
} }
compileKotlin2Js.kotlinOptions.sourceMap = true compileKotlin2Js.kotlinOptions.sourceMap = true
compileKotlin2Js.kotlinOptions.outputFile = "${projectDir}/web/js/app.js" compileKotlin2Js.destinationDirectory = new File(projectDir, "web/js")
compileKotlin2Js.kotlinOptions.moduleName = "app"
compileKotlin2Js.kotlinOptions.suppressWarnings = true compileKotlin2Js.kotlinOptions.suppressWarnings = true
compileKotlin2Js.kotlinOptions.verbose = true compileKotlin2Js.kotlinOptions.verbose = true
@@ -100,9 +100,7 @@ public class K2JSCompilerMojo extends KotlinCompileMojoBase<K2JSCompilerArgument
@Override @Override
protected void configureSpecificCompilerArguments(@NotNull K2JSCompilerArguments arguments, @NotNull List<File> sourceRoots) throws MojoExecutionException { protected void configureSpecificCompilerArguments(@NotNull K2JSCompilerArguments arguments, @NotNull List<File> sourceRoots) throws MojoExecutionException {
arguments.setOutputFile(outputFile); arguments.setOutputDir(new File(outputFile).getParent());
arguments.setNoStdlib(true);
arguments.setMetaInfo(metaInfo);
arguments.setModuleKind(moduleKind); arguments.setModuleKind(moduleKind);
arguments.setMain(main); arguments.setMain(main);
arguments.setIrOnly(useIrBackend); arguments.setIrOnly(useIrBackend);
@@ -86,8 +86,7 @@ public class KotlinTestJSCompilerMojo extends K2JSCompilerMojo {
super.configureSpecificCompilerArguments(arguments, sourceRoots); super.configureSpecificCompilerArguments(arguments, sourceRoots);
arguments.setOutputFile(outputFile); arguments.setOutputDir(new File(outputFile).getParent());
arguments.setMetaInfo(metaInfo);
} }
@Override @Override
@@ -46,7 +46,3 @@ publishing {
} }
configureDefaultPublishing() configureDefaultPublishing()
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xforce-deprecated-legacy-compiler-usage"
}