Rebuild all kotlin files when EAP flag is changed
Original commit: b9dbe69232
This commit is contained in:
@@ -17,5 +17,6 @@
|
||||
<orderEntry type="module" module-name="build-common" scope="TEST" />
|
||||
<orderEntry type="library" scope="TEST" name="jps-test" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="idea-full" level="project" />
|
||||
<orderEntry type="module" module-name="incremental-compilation-impl" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -33,6 +33,7 @@ import org.jetbrains.jps.builders.CompileScopeTestBuilder
|
||||
import org.jetbrains.jps.builders.JpsBuildTestCase
|
||||
import org.jetbrains.jps.builders.TestProjectBuilderLogger
|
||||
import org.jetbrains.jps.builders.impl.BuildDataPathsImpl
|
||||
import org.jetbrains.jps.builders.impl.logging.ProjectBuilderLoggerImpl
|
||||
import org.jetbrains.jps.builders.logging.BuildLoggingManager
|
||||
import org.jetbrains.jps.cmdline.ProjectDescriptor
|
||||
import org.jetbrains.jps.incremental.BuilderRegistry
|
||||
@@ -49,9 +50,14 @@ import org.jetbrains.jps.model.module.JpsModule
|
||||
import org.jetbrains.jps.util.JpsPathUtil
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||
import org.jetbrains.kotlin.codegen.JvmCodegenUtil
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.daemon.common.COMPILE_DAEMON_ENABLED_PROPERTY
|
||||
import org.jetbrains.kotlin.incremental.CacheVersion
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.incremental.withIC
|
||||
import org.jetbrains.kotlin.jps.build.KotlinJpsBuildTest.LibraryDependency.*
|
||||
import org.jetbrains.kotlin.load.kotlin.DeserializedDescriptorResolver
|
||||
import org.jetbrains.kotlin.load.kotlin.DeserializedDescriptorResolver.Companion.TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
@@ -785,6 +791,34 @@ class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
fun testEAPToReleaseIC() {
|
||||
fun setPreRelease(value: Boolean) {
|
||||
System.setProperty(TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY, value.toString())
|
||||
}
|
||||
|
||||
try {
|
||||
withIC {
|
||||
initProject(JVM_MOCK_RUNTIME)
|
||||
|
||||
setPreRelease(true)
|
||||
makeAll().assertSuccessful()
|
||||
assertCompiled(KotlinBuilder.KOTLIN_BUILDER_NAME, "src/Bar.kt", "src/Foo.kt")
|
||||
|
||||
touch("src/Foo.kt").apply()
|
||||
makeAll()
|
||||
assertCompiled(KotlinBuilder.KOTLIN_BUILDER_NAME, "src/Foo.kt")
|
||||
|
||||
setPreRelease(false)
|
||||
touch("src/Foo.kt").apply()
|
||||
makeAll().assertSuccessful()
|
||||
assertCompiled(KotlinBuilder.KOTLIN_BUILDER_NAME, "src/Bar.kt", "src/Foo.kt")
|
||||
}
|
||||
}
|
||||
finally {
|
||||
System.clearProperty(TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY)
|
||||
}
|
||||
}
|
||||
|
||||
fun testGetDependentTargets() {
|
||||
fun addModuleWithSourceAndTestRoot(name: String): JpsModule {
|
||||
return addModule(name, "src/").apply {
|
||||
|
||||
@@ -37,9 +37,7 @@ import org.jetbrains.jps.model.JpsProject
|
||||
import org.jetbrains.jps.model.java.JpsJavaClasspathKind
|
||||
import org.jetbrains.jps.model.java.JpsJavaExtensionService
|
||||
import org.jetbrains.jps.model.module.JpsModule
|
||||
import org.jetbrains.kotlin.build.GeneratedFile
|
||||
import org.jetbrains.kotlin.build.GeneratedJvmClass
|
||||
import org.jetbrains.kotlin.build.isModuleMappingFile
|
||||
import org.jetbrains.kotlin.build.*
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
@@ -47,11 +45,8 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
|
||||
import org.jetbrains.kotlin.compilerRunner.*
|
||||
import org.jetbrains.kotlin.config.CompilerRunnerConstants
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.config.CompilerRunnerConstants.INTERNAL_ERROR_PREFIX
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.config.Services
|
||||
import org.jetbrains.kotlin.daemon.common.isDaemonEnabled
|
||||
import org.jetbrains.kotlin.incremental.*
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
@@ -63,9 +58,8 @@ import org.jetbrains.kotlin.modules.TargetId
|
||||
import org.jetbrains.kotlin.preloading.ClassCondition
|
||||
import org.jetbrains.kotlin.progress.CompilationCanceledException
|
||||
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
||||
import org.jetbrains.kotlin.utils.JsLibraryUtils
|
||||
import org.jetbrains.kotlin.utils.PathUtil
|
||||
import org.jetbrains.kotlin.utils.keysToMap
|
||||
import org.jetbrains.kotlin.build.JvmBuildMetaInfo
|
||||
import org.jetbrains.kotlin.utils.*
|
||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
@@ -115,7 +109,37 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
|
||||
val cacheVersionsProvider = CacheVersionProvider(dataManager.dataPaths)
|
||||
val allVersions = cacheVersionsProvider.allVersions(targets)
|
||||
val actions = allVersions.map { it.checkVersion() }.toSet()
|
||||
val actions = allVersions.map { it.checkVersion() }.toMutableSet()
|
||||
|
||||
if (!JpsUtils.isJsKotlinModule(chunk.representativeTarget())) {
|
||||
val args = compilerArgumentsForChunk(chunk)
|
||||
val currentBuildMetaInfo = JvmBuildMetaInfo(args)
|
||||
|
||||
for (target in chunk.targets) {
|
||||
val file = jvmBuildMetaInfoFile(target, dataManager)
|
||||
if (!file.exists()) continue
|
||||
|
||||
val lastBuildMetaInfo =
|
||||
try {
|
||||
JvmBuildMetaInfo.deserializeFromString(file.readText()) ?: continue
|
||||
}
|
||||
catch (e: Exception) {
|
||||
LOG.error("Could not deserialize jvm build meta info", e)
|
||||
continue
|
||||
}
|
||||
|
||||
val lastBuildLangVersion = LanguageVersion.fromVersionString(lastBuildMetaInfo.languageVersionString)
|
||||
// reuse logic from compiler?
|
||||
if (lastBuildLangVersion != LanguageVersion.KOTLIN_1_0
|
||||
&& lastBuildMetaInfo.isEAP
|
||||
&& !currentBuildMetaInfo.isEAP
|
||||
) {
|
||||
// If EAP->Non-EAP build with IC, then rebuild all kotlin
|
||||
LOG.info("Last build was compiled with EAP-plugin. Performing non-incremental rebuild (kotlin only)")
|
||||
actions.add(CacheVersion.Action.REBUILD_ALL_KOTLIN)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val fsOperations = FSOperationsHelper(context, chunk, LOG)
|
||||
applyActionsOnCacheVersionChange(actions, cacheVersionsProvider, context, dataManager, targets, fsOperations)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="IDEA_JDK" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="kotlinProject" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
</component>
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/kotlinProject.iml" filepath="$PROJECT_DIR$/kotlinProject.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="IDEA_JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
class Bar() {
|
||||
fun bar() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
class Foo() {
|
||||
fun foo() {
|
||||
Bar().bar()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user