Use separate system properties to control IC for JVM and JS
Also this commit effectively disables JS IC by default
#KT-25563 fixed
Original commit: 0b18380770
This commit is contained in:
+1
-1
@@ -33,7 +33,7 @@ abstract class AbstractIncrementalCacheVersionChangedTest : AbstractIncrementalJ
|
||||
}
|
||||
|
||||
if (modifiedFiles.none { it.endsWith("do-not-change-cache-versions") }) {
|
||||
val cacheVersionProvider = CacheVersionProvider(paths)
|
||||
val cacheVersionProvider = CacheVersionProvider(paths, isIncrementalCompilationEnabled = true)
|
||||
val versions = getVersions(cacheVersionProvider, targets)
|
||||
val versionFiles = versions.map { it.formatVersionFile }.filter { it.exists() }
|
||||
versionFiles.forEach { it.writeText("777") }
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ abstract class AbstractIncrementalJpsTest(
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
lookupsDuringTest = hashSetOf()
|
||||
isICEnabledBackup = IncrementalCompilation.isEnabled()
|
||||
isICEnabledBackup = IncrementalCompilation.isEnabledForJvm()
|
||||
IncrementalCompilation.setIsEnabled(true)
|
||||
|
||||
if (DEBUG_LOGGING_ENABLED) {
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ abstract class AbstractIncrementalLazyCachesTest : AbstractIncrementalJpsTest()
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
isICEnabledBackup = IncrementalCompilation.isEnabled()
|
||||
isICEnabledBackup = IncrementalCompilation.isEnabledForJvm()
|
||||
IncrementalCompilation.setIsEnabled(true)
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ abstract class AbstractIncrementalLazyCachesTest : AbstractIncrementalJpsTest()
|
||||
val targets = projectDescriptor.allModuleTargets
|
||||
val dataManager = projectDescriptor.dataManager
|
||||
val paths = dataManager.dataPaths
|
||||
val versions = CacheVersionProvider(paths)
|
||||
val versions = CacheVersionProvider(paths, isIncrementalCompilationEnabled = true)
|
||||
|
||||
dumpCachesForTarget(p, paths, KotlinDataContainerTarget, versions.dataContainerVersion().formatVersionFile)
|
||||
|
||||
|
||||
+1
-1
@@ -163,7 +163,7 @@ abstract class AbstractLookupTrackerTest : TestWithWorkingDir() {
|
||||
super.setUp()
|
||||
srcDir = File(workingDir, "src").apply { mkdirs() }
|
||||
outDir = File(workingDir, "out")
|
||||
isICEnabledBackup = IncrementalCompilation.isEnabled()
|
||||
isICEnabledBackup = IncrementalCompilation.isEnabledForJvm()
|
||||
IncrementalCompilation.setIsEnabled(true)
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ import org.jetbrains.kotlin.config.KotlinCompilerVersion.TEST_IS_PRE_RELEASE_SYS
|
||||
import org.jetbrains.kotlin.incremental.CacheVersion
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.incremental.withIC
|
||||
import org.jetbrains.kotlin.jps.model.JpsKotlinCompilerSettings
|
||||
import org.jetbrains.kotlin.jps.build.KotlinJpsBuildTest.LibraryDependency.*
|
||||
import org.jetbrains.kotlin.jps.model.kotlinCommonCompilerArguments
|
||||
import org.jetbrains.kotlin.jps.model.kotlinCompilerArguments
|
||||
@@ -451,7 +450,7 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
assertFilesExistInOutput(module, "Foo.class", "Bar.class")
|
||||
assertFilesNotExistInOutput(module, *EXCLUDE_FILES)
|
||||
|
||||
if (IncrementalCompilation.isEnabled()) {
|
||||
if (IncrementalCompilation.isEnabledForJvm()) {
|
||||
checkWhen(touch("src/foo.kt"), null, arrayOf(module("kotlinProject"), klass("kotlinProject", "Foo")))
|
||||
}
|
||||
else {
|
||||
@@ -470,7 +469,7 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
assertFilesExistInOutput(module, "Foo.class", "Bar.class")
|
||||
assertFilesNotExistInOutput(module, *EXCLUDE_FILES)
|
||||
|
||||
if (IncrementalCompilation.isEnabled()) {
|
||||
if (IncrementalCompilation.isEnabledForJvm()) {
|
||||
checkWhen(touch("src/foo.kt"), null, arrayOf(module("kotlinProject"), klass("kotlinProject", "Foo")))
|
||||
checkWhen(touch("src/dir/subdir/bar.kt"), null, arrayOf(module("kotlinProject"), klass("kotlinProject", "Bar")))
|
||||
}
|
||||
@@ -491,7 +490,7 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
assertFilesExistInOutput(module, "Foo.class", "Bar.class")
|
||||
assertFilesNotExistInOutput(module, *EXCLUDE_FILES)
|
||||
|
||||
if (IncrementalCompilation.isEnabled()) {
|
||||
if (IncrementalCompilation.isEnabledForJvm()) {
|
||||
checkWhen(touch("src/foo.kt"), null, arrayOf(module("kotlinProject"), klass("kotlinProject", "Foo")))
|
||||
}
|
||||
else {
|
||||
@@ -508,7 +507,7 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
fun testKotlinProjectTwoFilesInOnePackage() {
|
||||
doTest()
|
||||
|
||||
if (IncrementalCompilation.isEnabled()) {
|
||||
if (IncrementalCompilation.isEnabledForJvm()) {
|
||||
checkWhen(touch("src/test1.kt"), null, packageClasses("kotlinProject", "src/test1.kt", "_DefaultPackage"))
|
||||
checkWhen(touch("src/test2.kt"), null, packageClasses("kotlinProject", "src/test2.kt", "_DefaultPackage"))
|
||||
}
|
||||
@@ -577,7 +576,7 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
|
||||
result.assertSuccessful()
|
||||
|
||||
if (IncrementalCompilation.isEnabled()) {
|
||||
if (IncrementalCompilation.isEnabledForJvm()) {
|
||||
checkWhen(touch("src/kt2.kt"), null, packageClasses("kotlinProject", "src/kt2.kt", "kt2.Kt2Kt"))
|
||||
checkWhen(touch("module2/src/kt1.kt"), null, packageClasses("module2", "module2/src/kt1.kt", "kt1.Kt1Kt"))
|
||||
}
|
||||
@@ -600,7 +599,7 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
UsefulTestCase.assertSameElements(getMethodsOfClass(facadeWithB), "<clinit>", "b", "getB", "setB")
|
||||
|
||||
|
||||
if (IncrementalCompilation.isEnabled()) {
|
||||
if (IncrementalCompilation.isEnabledForJvm()) {
|
||||
checkWhen(touch("module1/src/a.kt"), null, packageClasses("module1", "module1/src/a.kt", "test.TestPackage"))
|
||||
checkWhen(touch("module2/src/b.kt"), null, packageClasses("module2", "module2/src/b.kt", "test.TestPackage"))
|
||||
}
|
||||
@@ -622,7 +621,7 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
UsefulTestCase.assertSameElements(getMethodsOfClass(facadeWithA), "<clinit>", "a", "funA", "getA")
|
||||
UsefulTestCase.assertSameElements(getMethodsOfClass(facadeWithB), "<clinit>", "b", "funB", "getB", "setB")
|
||||
|
||||
if (IncrementalCompilation.isEnabled()) {
|
||||
if (IncrementalCompilation.isEnabledForJvm()) {
|
||||
checkWhen(touch("module1/src/a.kt"), null, packageClasses("module1", "module1/src/a.kt", "test.TestPackage"))
|
||||
checkWhen(touch("module2/src/b.kt"), null, packageClasses("module2", "module2/src/b.kt", "test.TestPackage"))
|
||||
}
|
||||
@@ -903,7 +902,7 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
||||
initProject(JVM_MOCK_RUNTIME)
|
||||
buildAllModules().assertSuccessful()
|
||||
|
||||
if (IncrementalCompilation.isEnabled()) {
|
||||
if (IncrementalCompilation.isEnabledForJvm()) {
|
||||
checkWhen(touch("src/utils.kt"), null, packageClasses("kotlinProject", "src/utils.kt", "_DefaultPackage"))
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-2
@@ -22,7 +22,6 @@ import org.jetbrains.jps.builders.JpsBuildTestCase
|
||||
import org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||
import org.jetbrains.kotlin.config.LanguageVersion
|
||||
import org.jetbrains.kotlin.jps.model.JpsKotlinCompilerSettings
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
import org.jetbrains.kotlin.daemon.common.COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS
|
||||
import org.jetbrains.kotlin.daemon.common.COMPILE_DAEMON_ENABLED_PROPERTY
|
||||
@@ -36,7 +35,7 @@ class KotlinJpsBuildTestIncremental : KotlinJpsBuildTest() {
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
isICEnabledBackup = IncrementalCompilation.isEnabled()
|
||||
isICEnabledBackup = IncrementalCompilation.isEnabledForJvm()
|
||||
IncrementalCompilation.setIsEnabled(true)
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ 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.JvmBuildMetaInfo
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.ERROR
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.INFO
|
||||
@@ -88,7 +87,8 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
|
||||
override fun buildStarted(context: CompileContext) {
|
||||
LOG.debug("==========================================")
|
||||
LOG.info("is Kotlin incremental compilation enabled: ${IncrementalCompilation.isEnabled()}")
|
||||
LOG.info("is Kotlin incremental compilation enabled for JVM: ${IncrementalCompilation.isEnabledForJvm()}")
|
||||
LOG.info("is Kotlin incremental compilation enabled for JS: ${IncrementalCompilation.isEnabledForJs()}")
|
||||
LOG.info("is Kotlin compiler daemon enabled: ${isDaemonEnabled()}")
|
||||
|
||||
val historyLabel = context.getBuilderParameter("history label")
|
||||
@@ -128,8 +128,13 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
)
|
||||
val fsOperations = FSOperationsHelper(context, chunk, roundDirtyFiles, LOG)
|
||||
|
||||
if (System.getProperty(SKIP_CACHE_VERSION_CHECK_PROPERTY) == null) {
|
||||
val cacheVersionsProvider = CacheVersionProvider(dataManager.dataPaths)
|
||||
val jpsRepresentativeTarget = chunk.representativeTarget()
|
||||
val representativeTarget = context.kotlinBuildTargets[jpsRepresentativeTarget]
|
||||
if (representativeTarget == null) {
|
||||
LOG.warn("Unable to find Kotlin build target for JPS target ${jpsRepresentativeTarget.presentableName}")
|
||||
}
|
||||
if (System.getProperty(SKIP_CACHE_VERSION_CHECK_PROPERTY) == null && representativeTarget != null) {
|
||||
val cacheVersionsProvider = CacheVersionProvider(dataManager.dataPaths, representativeTarget.isIncrementalCompilationEnabled)
|
||||
val actions = checkCachesVersions(context, cacheVersionsProvider, chunk)
|
||||
applyActionsOnCacheVersionChange(actions, cacheVersionsProvider, context, dataManager, targets, fsOperations)
|
||||
if (CacheVersion.Action.REBUILD_ALL_KOTLIN in actions) {
|
||||
@@ -280,7 +285,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
|| targets.any { rebuildAfterCacheVersionChanged[it] == true }
|
||||
|
||||
if (kotlinDirtyFilesHolder.hasDirtyOrRemovedFiles) {
|
||||
if (!isChunkRebuilding && !IncrementalCompilation.isEnabled()) {
|
||||
if (!isChunkRebuilding && !representativeTarget.isIncrementalCompilationEnabled) {
|
||||
targets.forEach { rebuildAfterCacheVersionChanged[it] = true }
|
||||
return CHUNK_REBUILD_REQUIRED
|
||||
}
|
||||
@@ -300,7 +305,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
}
|
||||
|
||||
val project = projectDescriptor.project
|
||||
val lookupTracker = getLookupTracker(project)
|
||||
val lookupTracker = getLookupTracker(project, representativeTarget)
|
||||
val exceptActualTracer = ExpectActualTrackerImpl()
|
||||
val incrementalCaches = getIncrementalCaches(chunk, context)
|
||||
val environment = createCompileEnvironment(
|
||||
@@ -366,7 +371,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
incrementalCaches
|
||||
)
|
||||
|
||||
if (!IncrementalCompilation.isEnabled()) {
|
||||
if (!representativeTarget.isIncrementalCompilationEnabled) {
|
||||
return OK
|
||||
}
|
||||
|
||||
@@ -477,7 +482,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
|
||||
private fun doCompileModuleChunk(
|
||||
chunk: ModuleChunk,
|
||||
kotlinTarget: KotlinModuleBuildTarget<*>,
|
||||
representativeTarget: KotlinModuleBuildTarget<*>,
|
||||
commonArguments: CommonCompilerArguments,
|
||||
context: CompileContext,
|
||||
dirtyFilesHolder: KotlinDirtySourceFilesHolder,
|
||||
@@ -486,26 +491,25 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
incrementalCaches: Map<ModuleBuildTarget, JpsIncrementalCache>
|
||||
): OutputItemsCollector? {
|
||||
|
||||
val representativeTarget = chunk.representativeTarget()
|
||||
|
||||
fun concatenate(strings: Array<String>?, cp: List<String>) = arrayOf(*strings.orEmpty(), *cp.toTypedArray())
|
||||
|
||||
for (argumentProvider in ServiceLoader.load(KotlinJpsCompilerArgumentsProvider::class.java)) {
|
||||
val jpsModuleBuildTarget = representativeTarget.jpsModuleBuildTarget
|
||||
// appending to pluginOptions
|
||||
commonArguments.pluginOptions = concatenate(
|
||||
commonArguments.pluginOptions,
|
||||
argumentProvider.getExtraArguments(representativeTarget, context)
|
||||
argumentProvider.getExtraArguments(jpsModuleBuildTarget, context)
|
||||
)
|
||||
// appending to classpath
|
||||
commonArguments.pluginClasspaths = concatenate(
|
||||
commonArguments.pluginClasspaths,
|
||||
argumentProvider.getClasspath(representativeTarget, context)
|
||||
argumentProvider.getClasspath(jpsModuleBuildTarget, context)
|
||||
)
|
||||
|
||||
LOG.debug("Plugin loaded: ${argumentProvider::class.java.simpleName}")
|
||||
}
|
||||
|
||||
if (IncrementalCompilation.isEnabled()) {
|
||||
if (representativeTarget.isIncrementalCompilationEnabled) {
|
||||
for (target in chunk.targets) {
|
||||
val cache = incrementalCaches[target]
|
||||
val targetDirtyFiles = dirtyFilesHolder.byTarget[target]
|
||||
@@ -519,7 +523,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
}
|
||||
}
|
||||
|
||||
val isDoneSomething = kotlinTarget.compileModuleChunk(chunk, commonArguments, dirtyFilesHolder, environment)
|
||||
val isDoneSomething = representativeTarget.compileModuleChunk(chunk, commonArguments, dirtyFilesHolder, environment)
|
||||
|
||||
return if (isDoneSomething) environment.outputItemsCollector else null
|
||||
}
|
||||
@@ -663,10 +667,10 @@ private fun ChangesCollector.getDirtyFiles(
|
||||
return dirtyFilesFromLookups + mapClassesFqNamesToFiles(caches, dirtyClassFqNames, reporter)
|
||||
}
|
||||
|
||||
private fun getLookupTracker(project: JpsProject): LookupTracker {
|
||||
private fun getLookupTracker(project: JpsProject, representativeTarget: KotlinModuleBuildTarget<*>): LookupTracker {
|
||||
val testLookupTracker = project.testingContext?.lookupTracker ?: LookupTracker.DO_NOTHING
|
||||
|
||||
if (IncrementalCompilation.isEnabled()) return LookupTrackerImpl(testLookupTracker)
|
||||
if (representativeTarget.isIncrementalCompilationEnabled) return LookupTrackerImpl(testLookupTracker)
|
||||
|
||||
return testLookupTracker
|
||||
}
|
||||
|
||||
@@ -25,20 +25,23 @@ import org.jetbrains.kotlin.incremental.normalCacheVersion
|
||||
import java.io.File
|
||||
|
||||
|
||||
class CacheVersionProvider(private val paths: BuildDataPaths) {
|
||||
class CacheVersionProvider(
|
||||
private val paths: BuildDataPaths,
|
||||
private val isIncrementalCompilationEnabled: Boolean
|
||||
) {
|
||||
private val BuildTarget<*>.dataRoot: File
|
||||
get() = paths.getTargetDataRoot(this)
|
||||
|
||||
fun normalVersion(target: ModuleBuildTarget): CacheVersion = normalCacheVersion(target.dataRoot)
|
||||
fun normalVersion(target: ModuleBuildTarget): CacheVersion = normalCacheVersion(target.dataRoot, isIncrementalCompilationEnabled)
|
||||
|
||||
fun dataContainerVersion(): CacheVersion = dataContainerCacheVersion(KotlinDataContainerTarget.dataRoot)
|
||||
fun dataContainerVersion(): CacheVersion = dataContainerCacheVersion(KotlinDataContainerTarget.dataRoot, isIncrementalCompilationEnabled)
|
||||
|
||||
fun allVersions(targets: Iterable<ModuleBuildTarget>): Iterable<CacheVersion> {
|
||||
val versions = arrayListOf<CacheVersion>()
|
||||
versions.add(dataContainerCacheVersion(KotlinDataContainerTarget.dataRoot))
|
||||
versions.add(dataContainerCacheVersion(KotlinDataContainerTarget.dataRoot, isIncrementalCompilationEnabled))
|
||||
|
||||
for (dataRoot in targets.map { it.dataRoot }) {
|
||||
versions.add(normalCacheVersion(dataRoot))
|
||||
versions.add(normalCacheVersion(dataRoot, isIncrementalCompilationEnabled))
|
||||
}
|
||||
|
||||
return versions
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments
|
||||
import org.jetbrains.kotlin.compilerRunner.JpsCompilerEnvironment
|
||||
import org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||
import org.jetbrains.kotlin.jps.build.KotlinDirtySourceFilesHolder
|
||||
import org.jetbrains.kotlin.jps.model.k2MetadataCompilerArguments
|
||||
import org.jetbrains.kotlin.jps.model.kotlinCompilerSettings
|
||||
@@ -26,6 +27,9 @@ private const val COMMON_BUILD_META_INFO_FILE_NAME = "common-build-meta-info.txt
|
||||
class KotlinCommonModuleBuildTarget(context: CompileContext, jpsModuleBuildTarget: ModuleBuildTarget) :
|
||||
KotlinModuleBuildTarget<CommonBuildMetaInfo>(context, jpsModuleBuildTarget) {
|
||||
|
||||
override val isIncrementalCompilationEnabled: Boolean
|
||||
get() = false
|
||||
|
||||
override val buildMetaInfoFactory
|
||||
get() = CommonBuildMetaInfo
|
||||
|
||||
|
||||
@@ -45,6 +45,9 @@ private const val JS_BUILD_META_INFO_FILE_NAME = "js-build-meta-info.txt"
|
||||
class KotlinJsModuleBuildTarget(compileContext: CompileContext, jpsModuleBuildTarget: ModuleBuildTarget) :
|
||||
KotlinModuleBuildTarget<JsBuildMetaInfo>(compileContext, jpsModuleBuildTarget) {
|
||||
|
||||
override val isIncrementalCompilationEnabled: Boolean
|
||||
get() = IncrementalCompilation.isEnabledForJs()
|
||||
|
||||
override val buildMetaInfoFactory
|
||||
get() = JsBuildMetaInfo
|
||||
|
||||
@@ -68,7 +71,7 @@ class KotlinJsModuleBuildTarget(compileContext: CompileContext, jpsModuleBuildTa
|
||||
with(builder) {
|
||||
register(IncrementalResultsConsumer::class.java, IncrementalResultsConsumerImpl())
|
||||
|
||||
if (IncrementalCompilation.isEnabled() && !isFirstBuild) {
|
||||
if (isIncrementalCompilationEnabled && !isFirstBuild) {
|
||||
val cache = incrementalCaches[jpsModuleBuildTarget] as IncrementalJsCache
|
||||
|
||||
register(
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.compilerRunner.JpsCompilerEnvironment
|
||||
import org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||
import org.jetbrains.kotlin.config.Services
|
||||
import org.jetbrains.kotlin.incremental.ChangesCollector
|
||||
import org.jetbrains.kotlin.incremental.IncrementalCompilationComponentsImpl
|
||||
@@ -53,6 +54,9 @@ private const val JVM_BUILD_META_INFO_FILE_NAME = "jvm-build-meta-info.txt"
|
||||
class KotlinJvmModuleBuildTarget(compileContext: CompileContext, jpsModuleBuildTarget: ModuleBuildTarget) :
|
||||
KotlinModuleBuildTarget<JvmBuildMetaInfo>(compileContext, jpsModuleBuildTarget) {
|
||||
|
||||
override val isIncrementalCompilationEnabled: Boolean
|
||||
get() = IncrementalCompilation.isEnabledForJvm()
|
||||
|
||||
override fun createCacheStorage(paths: BuildDataPaths) = JpsIncrementalJvmCache(jpsModuleBuildTarget, paths)
|
||||
|
||||
override val buildMetaInfoFactory
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.config.Services
|
||||
import org.jetbrains.kotlin.incremental.CacheVersion
|
||||
import org.jetbrains.kotlin.incremental.ChangesCollector
|
||||
import org.jetbrains.kotlin.incremental.ExpectActualTrackerImpl
|
||||
import org.jetbrains.kotlin.incremental.LookupTrackerImpl
|
||||
import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.jps.build.KotlinBuilder
|
||||
@@ -52,6 +53,8 @@ abstract class KotlinModuleBuildTarget<BuildMetaInfoType : BuildMetaInfo>(
|
||||
val context: CompileContext,
|
||||
val jpsModuleBuildTarget: ModuleBuildTarget
|
||||
) {
|
||||
abstract val isIncrementalCompilationEnabled: Boolean
|
||||
|
||||
val module: JpsModule
|
||||
get() = jpsModuleBuildTarget.module
|
||||
|
||||
@@ -241,8 +244,10 @@ abstract class KotlinModuleBuildTarget<BuildMetaInfoType : BuildMetaInfo>(
|
||||
// Should not be cached since may be vary in different rounds
|
||||
|
||||
val jpsModuleTarget = target.jpsModuleBuildTarget
|
||||
return if (IncrementalCompilation.isEnabled()) dirtyFilesHolder.getDirtyFiles(jpsModuleTarget)
|
||||
else target.sourceFiles
|
||||
return when {
|
||||
isIncrementalCompilationEnabled -> dirtyFilesHolder.getDirtyFiles(jpsModuleTarget)
|
||||
else -> target.sourceFiles
|
||||
}
|
||||
}
|
||||
|
||||
protected fun checkShouldCompileAndLog(dirtyFilesHolder: KotlinDirtySourceFilesHolder, moduleSources: Collection<File>) =
|
||||
@@ -278,7 +283,7 @@ abstract class KotlinModuleBuildTarget<BuildMetaInfoType : BuildMetaInfo>(
|
||||
fun saveVersions(context: CompileContext, chunk: ModuleChunk, commonArguments: CommonCompilerArguments) {
|
||||
val dataManager = context.projectDescriptor.dataManager
|
||||
val targets = chunk.targets
|
||||
val cacheVersionsProvider = CacheVersionProvider(dataManager.dataPaths)
|
||||
val cacheVersionsProvider = CacheVersionProvider(dataManager.dataPaths, isIncrementalCompilationEnabled)
|
||||
cacheVersionsProvider.allVersions(targets).forEach { it.saveIfNeeded() }
|
||||
|
||||
val buildMetaInfo = buildMetaInfoFactory.create(commonArguments)
|
||||
|
||||
Reference in New Issue
Block a user