Compilation fixes
This commit is contained in:
@@ -66,7 +66,7 @@ abstract class IdePlatformKind {
|
||||
|
||||
|
||||
fun <Args : CommonCompilerArguments> platformByCompilerArguments(arguments: Args): TargetPlatform? =
|
||||
ALL_KINDS.firstNotNullResult { it.platformByCompilerArguments(arguments) }
|
||||
ALL_KINDS.firstNotNullOfOrNull { it.platformByCompilerArguments(arguments) }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ val TargetPlatform.idePlatformKind: IdePlatformKind
|
||||
when {
|
||||
list.size == 1 -> list.first()
|
||||
list.size > 1 -> list.first().also {
|
||||
Logger.getInstance(IdePlatformKind.javaClass).warn("Found more than one IdePlatformKind [$list] for target [$this].")
|
||||
Logger.getInstance(IdePlatformKind.Companion::class.java).warn("Found more than one IdePlatformKind [$list] for target [$this].")
|
||||
}
|
||||
else -> error("Unknown platform $this")
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ class CompilerArgumentsContentProspectorTest {
|
||||
CommonCompilerArguments::noCheckActual,
|
||||
CommonCompilerArguments::newInference,
|
||||
CommonCompilerArguments::inlineClasses,
|
||||
CommonCompilerArguments::polymorphicSignature,
|
||||
CommonCompilerArguments::legacySmartCastAfterTry,
|
||||
CommonCompilerArguments::effectSystem,
|
||||
CommonCompilerArguments::readDeserializedContracts,
|
||||
@@ -112,7 +111,6 @@ class CompilerArgumentsContentProspectorTest {
|
||||
private val commonCompilerArgumentsArrayProperties = listOf(
|
||||
CommonCompilerArguments::pluginOptions,
|
||||
CommonCompilerArguments::pluginClasspaths,
|
||||
CommonCompilerArguments::experimental,
|
||||
CommonCompilerArguments::useExperimental,
|
||||
CommonCompilerArguments::optIn,
|
||||
CommonCompilerArguments::commonSources,
|
||||
@@ -140,17 +138,14 @@ class CompilerArgumentsContentProspectorTest {
|
||||
K2JVMCompilerArguments::noCallAssertions,
|
||||
K2JVMCompilerArguments::noReceiverAssertions,
|
||||
K2JVMCompilerArguments::noParamAssertions,
|
||||
K2JVMCompilerArguments::strictJavaNullabilityAssertions,
|
||||
K2JVMCompilerArguments::noOptimize,
|
||||
K2JVMCompilerArguments::inheritMultifileParts,
|
||||
K2JVMCompilerArguments::useTypeTable,
|
||||
K2JVMCompilerArguments::skipRuntimeVersionCheck,
|
||||
K2JVMCompilerArguments::useOldClassFilesReading,
|
||||
K2JVMCompilerArguments::singleModule,
|
||||
K2JVMCompilerArguments::suppressMissingBuiltinsError,
|
||||
K2JVMCompilerArguments::useJavac,
|
||||
K2JVMCompilerArguments::compileJava,
|
||||
K2JVMCompilerArguments::noExceptionOnExplicitEqualsForBoxedNull,
|
||||
K2JVMCompilerArguments::disableStandardScript,
|
||||
K2JVMCompilerArguments::strictMetadataVersionSemantics,
|
||||
K2JVMCompilerArguments::suppressDeprecatedJvmTargetWarning,
|
||||
@@ -162,7 +157,6 @@ class CompilerArgumentsContentProspectorTest {
|
||||
K2JVMCompilerArguments::noKotlinNothingValueException,
|
||||
K2JVMCompilerArguments::noResetJarTimestamps,
|
||||
K2JVMCompilerArguments::noUnifiedNullChecks,
|
||||
K2JVMCompilerArguments::useOldSpilledVarTypeAnalysis,
|
||||
K2JVMCompilerArguments::useOldInlineClassesManglingScheme,
|
||||
K2JVMCompilerArguments::enableJvmPreview,
|
||||
)
|
||||
@@ -176,7 +170,6 @@ class CompilerArgumentsContentProspectorTest {
|
||||
K2JVMCompilerArguments::jvmTarget,
|
||||
K2JVMCompilerArguments::abiStability,
|
||||
K2JVMCompilerArguments::javaModulePath,
|
||||
K2JVMCompilerArguments::constructorCallNormalizationMode,
|
||||
K2JVMCompilerArguments::assertionsMode,
|
||||
K2JVMCompilerArguments::buildFile,
|
||||
K2JVMCompilerArguments::declarationsOutputPath,
|
||||
@@ -223,7 +216,6 @@ class CompilerArgumentsContentProspectorTest {
|
||||
K2JSCompilerArguments::irProduceKlibFile,
|
||||
K2JSCompilerArguments::irProduceJs,
|
||||
K2JSCompilerArguments::irDce,
|
||||
K2JSCompilerArguments::irDceDriven,
|
||||
K2JSCompilerArguments::irDcePrintReachabilityInfo,
|
||||
K2JSCompilerArguments::irPropertyLazyInitialization,
|
||||
K2JSCompilerArguments::irOnly,
|
||||
|
||||
@@ -32,6 +32,7 @@ dependencies {
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(project(":kotlin-test:kotlin-test-jvm"))
|
||||
testCompile(projectTests(":kotlin-build-common"))
|
||||
testApi(projectTests(":compiler:test-infrastructure-utils"))
|
||||
testCompileOnly(jpsStandalone()) { includeJars("jps-builders", "jps-builders-6") }
|
||||
Ide.IJ {
|
||||
testCompile(intellijDep("devkit"))
|
||||
|
||||
+1
@@ -68,6 +68,7 @@ abstract class AbstractIncrementalLazyCachesTest : AbstractIncrementalJpsTest()
|
||||
|
||||
when {
|
||||
name.endsWith("incremental-compilation") -> {
|
||||
@Suppress("DEPRECATION")
|
||||
IncrementalCompilation.setIsEnabledForJvm(modification.dataFile.readAsBool())
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -29,7 +29,6 @@ import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.compilerRunner.*
|
||||
import org.jetbrains.kotlin.config.Services
|
||||
import org.jetbrains.kotlin.idea.artifacts.TestKotlinArtifacts
|
||||
import org.jetbrains.kotlin.incremental.components.LookupInfo
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.incremental.components.Position
|
||||
@@ -87,7 +86,7 @@ abstract class AbstractJvmLookupTrackerTest : AbstractLookupTrackerTest() {
|
||||
sourcesToCompile = filesToCompile.toList(),
|
||||
commonSources = emptyList(),
|
||||
javaSourceRoots = listOf(JvmSourceRoot(srcDir, null)),
|
||||
classpath = listOf(outDir, TestKotlinArtifacts.kotlinStdlib).filter { it.exists() },
|
||||
classpath = listOf(outDir, ForTestCompileRuntime.runtimeJarForTests()).filter { it.exists() },
|
||||
friendDirs = emptyList()
|
||||
)
|
||||
|
||||
@@ -115,7 +114,7 @@ abstract class AbstractJvmLookupTrackerTest : AbstractLookupTrackerTest() {
|
||||
|
||||
abstract class AbstractJsKlibLookupTrackerTest : AbstractJsLookupTrackerTest() {
|
||||
override val jsStdlibFile: File
|
||||
get() = KotlinArtifacts.instance.kotlinStdlibJs
|
||||
get() = File("build/js-ir-runtime/full-runtime.klib")
|
||||
|
||||
override fun configureAdditionalArgs(args: K2JSCompilerArguments) {
|
||||
args.irProduceKlibDir = true
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import org.jetbrains.org.objectweb.asm.RecordComponentVisitor
|
||||
class AsmVersionForJpsBuildTest : TestCase() {
|
||||
// Kotlin compiler contains some version of ASM that is taken from a particular platform dependency
|
||||
fun testAsmVersionForBundledKotlinCompiler() {
|
||||
val field = RecordComponentVisitor::class.java.getDeclaredField("api").also { it.trySetAccessible() }
|
||||
val field = RecordComponentVisitor::class.java.getDeclaredField("api").also { it.isAccessible = true }
|
||||
val asmVersionForBundledCompiler = field.getInt(AbstractClassBuilder.EMPTY_RECORD_VISITOR)
|
||||
|
||||
assertEquals(Opcodes.ASM8, asmVersionForBundledCompiler)
|
||||
|
||||
+1
-2
@@ -30,7 +30,6 @@ import org.jetbrains.jps.util.JpsPathUtil
|
||||
import org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner
|
||||
import org.jetbrains.kotlin.test.WithMutedInDatabaseRunTest
|
||||
import org.jetbrains.kotlin.test.runTest
|
||||
import org.jetbrains.kotlin.test.AndroidStudioTestUtils
|
||||
|
||||
@WithMutedInDatabaseRunTest
|
||||
abstract class BaseKotlinJpsBuildTestCase : JpsBuildTestCase() {
|
||||
@@ -40,7 +39,7 @@ abstract class BaseKotlinJpsBuildTestCase : JpsBuildTestCase() {
|
||||
}
|
||||
|
||||
override fun shouldRunTest(): Boolean {
|
||||
return super.shouldRunTest() && !AndroidStudioTestUtils.skipIncompatibleTestAgainstAndroidStudio()
|
||||
return super.shouldRunTest()
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
|
||||
+2
-3
@@ -17,14 +17,13 @@
|
||||
package org.jetbrains.kotlin.jps.build
|
||||
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.Modification
|
||||
import org.jetbrains.kotlin.test.KotlinRoot
|
||||
|
||||
class IncrementalRenameModuleTest : AbstractIncrementalJpsTest() {
|
||||
fun testRenameModule() {
|
||||
doTest(KotlinRoot.DIR.path + "/jps/jps-plugin/testData/incremental/custom/renameModule/")
|
||||
doTest("jps-plugin/testData/incremental/custom/renameModule/")
|
||||
}
|
||||
|
||||
override fun performAdditionalModifications(modifications: List<Modification>) {
|
||||
projectDescriptor.project.modules.forEach { it.name += "Renamed" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ open class KotlinJpsBuildTest : KotlinJpsBuildTestBase() {
|
||||
val jslibJar = PathUtil.kotlinPathsForDistDirectory.jsStdLibJarPath
|
||||
val jslibDir = File(workDir, "KotlinJavaScript")
|
||||
try {
|
||||
Decompressor.Zip(jslibJar).extract(jslibDir.toPath())
|
||||
Decompressor.Zip(jslibJar).extract(jslibDir)
|
||||
}
|
||||
catch (ex: IOException) {
|
||||
throw IllegalStateException(ex.message)
|
||||
@@ -1116,14 +1116,3 @@ open class KotlinJpsBuildTest : KotlinJpsBuildTestBase() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun <R> withIC(enabled: Boolean = true, fn: () -> R): R {
|
||||
val isEnabledBackup = IncrementalCompilation.isEnabledForJvm()
|
||||
IncrementalCompilation.setIsEnabledForJvm(enabled)
|
||||
|
||||
try {
|
||||
return fn()
|
||||
} finally {
|
||||
IncrementalCompilation.setIsEnabledForJvm(isEnabledBackup)
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import org.jetbrains.kotlin.config.KotlinFacetSettings
|
||||
import org.jetbrains.kotlin.jps.model.JpsKotlinFacetModuleExtension
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import java.io.File
|
||||
import java.nio.file.Paths
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.utils.PathUtil
|
||||
import java.io.File
|
||||
|
||||
enum class KotlinJpsLibrary(val id: String, vararg val roots: File) {
|
||||
@Deprecated("Use JvmStdlib instead")
|
||||
MockRuntime(
|
||||
"kotlin-mock-runtime",
|
||||
PathUtil.kotlinPathsForDistDirectory.stdlibPath,
|
||||
|
||||
+4
@@ -16,14 +16,18 @@ class EnableICFixture(
|
||||
|
||||
fun setUp() {
|
||||
isICEnabledBackup = IncrementalCompilation.isEnabledForJvm()
|
||||
@Suppress("DEPRECATION")
|
||||
IncrementalCompilation.setIsEnabledForJvm(enableJvmIC)
|
||||
|
||||
isICEnabledForJsBackup = IncrementalCompilation.isEnabledForJs()
|
||||
@Suppress("DEPRECATION")
|
||||
IncrementalCompilation.setIsEnabledForJs(enableJsIC)
|
||||
}
|
||||
|
||||
fun tearDown() {
|
||||
@Suppress("DEPRECATION")
|
||||
IncrementalCompilation.setIsEnabledForJvm(isICEnabledBackup)
|
||||
@Suppress("DEPRECATION")
|
||||
IncrementalCompilation.setIsEnabledForJs(isICEnabledForJsBackup)
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.jvm.compiler
|
||||
|
||||
import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType
|
||||
import org.jetbrains.kotlin.build.JvmSourceRoot
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||
import org.jetbrains.kotlin.modules.KotlinModuleXmlBuilder
|
||||
import org.jetbrains.kotlin.test.MockLibraryUtil
|
||||
import org.jetbrains.kotlin.test.TestCaseWithTmpdir
|
||||
@@ -53,7 +54,8 @@ class ClasspathOrderTest : TestCaseWithTmpdir() {
|
||||
JavaModuleBuildTargetType.PRODUCTION.typeId,
|
||||
JavaModuleBuildTargetType.PRODUCTION.isTests,
|
||||
setOf(),
|
||||
emptyList()
|
||||
emptyList(),
|
||||
IncrementalCompilation.isEnabledForJvm()
|
||||
).asText().toString()
|
||||
|
||||
val xml = File(tmpdir, "module.xml")
|
||||
|
||||
+15
-14
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.modules;
|
||||
import junit.framework.TestCase;
|
||||
import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType;
|
||||
import org.jetbrains.kotlin.build.JvmSourceRoot;
|
||||
import org.jetbrains.kotlin.idea.test.TestUtilsKt;
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -27,10 +27,6 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
private static String getTestDataPath() {
|
||||
return TestUtilsKt.IDEA_TEST_DATA_DIR.getAbsolutePath() + "/modules.xml";
|
||||
}
|
||||
|
||||
public void testBasic() {
|
||||
String actual = new KotlinModuleXmlBuilder().addModule(
|
||||
"name",
|
||||
@@ -43,9 +39,10 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
JavaModuleBuildTargetType.PRODUCTION.getTypeId(),
|
||||
JavaModuleBuildTargetType.PRODUCTION.isTests(),
|
||||
Collections.emptySet(),
|
||||
Collections.emptyList()
|
||||
Collections.emptyList(),
|
||||
IncrementalCompilation.isEnabledForJvm()
|
||||
).asText().toString();
|
||||
KotlinTestUtils.assertEqualsToFile(new File(getTestDataPath() + "/basic.xml"), actual);
|
||||
KotlinTestUtils.assertEqualsToFile(new File("/basic.xml"), actual);
|
||||
}
|
||||
|
||||
public void testFiltered() {
|
||||
@@ -60,9 +57,10 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
JavaModuleBuildTargetType.PRODUCTION.getTypeId(),
|
||||
JavaModuleBuildTargetType.PRODUCTION.isTests(),
|
||||
Collections.singleton(new File("cp1")),
|
||||
Collections.emptyList()
|
||||
Collections.emptyList(),
|
||||
IncrementalCompilation.isEnabledForJvm()
|
||||
).asText().toString();
|
||||
KotlinTestUtils.assertEqualsToFile(new File(getTestDataPath() + "/filtered.xml"), actual);
|
||||
KotlinTestUtils.assertEqualsToFile(new File("/filtered.xml"), actual);
|
||||
}
|
||||
|
||||
public void testMultiple() {
|
||||
@@ -78,7 +76,8 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
JavaModuleBuildTargetType.PRODUCTION.getTypeId(),
|
||||
JavaModuleBuildTargetType.PRODUCTION.isTests(),
|
||||
Collections.singleton(new File("cp1")),
|
||||
Collections.emptyList()
|
||||
Collections.emptyList(),
|
||||
IncrementalCompilation.isEnabledForJvm()
|
||||
);
|
||||
builder.addModule(
|
||||
"name2",
|
||||
@@ -91,10 +90,11 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
JavaModuleBuildTargetType.TEST.getTypeId(),
|
||||
JavaModuleBuildTargetType.TEST.isTests(),
|
||||
Collections.singleton(new File("cp12")),
|
||||
Collections.emptyList()
|
||||
Collections.emptyList(),
|
||||
IncrementalCompilation.isEnabledForJvm()
|
||||
);
|
||||
String actual = builder.asText().toString();
|
||||
KotlinTestUtils.assertEqualsToFile(new File(getTestDataPath() + "/multiple.xml"), actual);
|
||||
KotlinTestUtils.assertEqualsToFile(new File("/multiple.xml"), actual);
|
||||
}
|
||||
|
||||
public void testModularJdkRoot() {
|
||||
@@ -109,8 +109,9 @@ public class KotlinModuleXmlGeneratorTest extends TestCase {
|
||||
JavaModuleBuildTargetType.PRODUCTION.getTypeId(),
|
||||
JavaModuleBuildTargetType.PRODUCTION.isTests(),
|
||||
Collections.emptySet(),
|
||||
Collections.emptyList()
|
||||
Collections.emptyList(),
|
||||
IncrementalCompilation.isEnabledForJvm()
|
||||
).asText().toString();
|
||||
KotlinTestUtils.assertEqualsToFile(new File(getTestDataPath() + "/modularJdkRoot.xml"), actual);
|
||||
KotlinTestUtils.assertEqualsToFile(new File("/modularJdkRoot.xml"), actual);
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.daemon.client.reportFromDaemon
|
||||
import org.jetbrains.kotlin.daemon.common.JpsCompilerServicesFacade
|
||||
import org.jetbrains.kotlin.daemon.common.SOCKET_ANY_FREE_PORT
|
||||
import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
|
||||
import org.jetbrains.kotlin.incremental.components.InlineConstTracker
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.incremental.js.IncrementalDataProvider
|
||||
import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumer
|
||||
@@ -36,6 +37,7 @@ internal class JpsCompilerServicesFacadeImpl(
|
||||
env.services[LookupTracker::class.java],
|
||||
env.services[CompilationCanceledStatus::class.java],
|
||||
env.services[ExpectActualTracker::class.java],
|
||||
env.services[InlineConstTracker::class.java],
|
||||
env.services[IncrementalResultsConsumer::class.java],
|
||||
env.services[IncrementalDataProvider::class.java],
|
||||
port
|
||||
|
||||
@@ -354,6 +354,7 @@ class JpsKotlinCompilerRunner {
|
||||
val daemonOptions = configureDaemonOptions()
|
||||
val additionalJvmParams = mutableListOf<String>()
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
IncrementalCompilation.toJvmArgs(additionalJvmParams)
|
||||
|
||||
val clientFlagFile = KotlinCompilerClient.getOrCreateClientFlagFile(daemonOptions)
|
||||
|
||||
@@ -203,7 +203,8 @@ class KotlinJvmModuleBuildTarget(kotlinContext: KotlinCompileContext, jpsModuleB
|
||||
isTests,
|
||||
// this excludes the output directories from the class path, to be removed for true incremental compilation
|
||||
outputDirs,
|
||||
friendDirs
|
||||
friendDirs,
|
||||
IncrementalCompilation.isEnabledForJvm()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user