JPS: completely skip chunk containing only dummy targets

Such chunks were added in intellij-community, see
commit fdeae7754c593e78b6748dfa66ce7198c2780d35
(fdeae7754c)
This commit is contained in:
Alexey Tsvetkov
2017-07-19 20:47:55 +03:00
committed by Alexey Sedunov
parent 14f47f5df7
commit 21d760c908
3 changed files with 33 additions and 2 deletions

View File

@@ -445,7 +445,7 @@ abstract class AbstractIncrementalJpsTest(
}
override fun buildStarted(context: CompileContext, chunk: ModuleChunk) {
if (context.projectDescriptor.project.modules.size > 1) {
if (!chunk.isDummy(context) && context.projectDescriptor.project.modules.size > 1) {
logLine("Building ${chunk.modules.sortedBy { it.name }.joinToString { it.name }}")
}
}

View File

@@ -106,6 +106,8 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
override fun chunkBuildStarted(context: CompileContext, chunk: ModuleChunk) {
super.chunkBuildStarted(context, chunk)
if (chunk.isDummy(context)) return
context.testingContext?.buildLogger?.buildStarted(context, chunk)
if (JavaBuilderUtil.isForcedRecompilationAllJavaModules(context)) return
@@ -163,9 +165,11 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
applyActionsOnCacheVersionChange(actions, cacheVersionsProvider, context, dataManager, targets, fsOperations)
}
override fun chunkBuildFinished(context: CompileContext?, chunk: ModuleChunk?) {
override fun chunkBuildFinished(context: CompileContext, chunk: ModuleChunk) {
super.chunkBuildFinished(context, chunk)
if (chunk.isDummy(context)) return
LOG.debug("------------------------------------------")
}
@@ -175,6 +179,8 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
dirtyFilesHolder: DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget>,
outputConsumer: ModuleLevelBuilder.OutputConsumer
): ModuleLevelBuilder.ExitCode {
if (chunk.isDummy(context)) return NOTHING_DONE
val messageCollector = MessageCollectorAdapter(context)
val fsOperations = FSOperationsHelper(context, chunk, LOG)

View File

@@ -0,0 +1,25 @@
/*
* 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.jps.build
import org.jetbrains.jps.ModuleChunk
import org.jetbrains.jps.incremental.CompileContext
fun ModuleChunk.isDummy(context: CompileContext): Boolean {
val targetIndex = context.projectDescriptor.buildTargetIndex
return targets.all { targetIndex.isDummy(it) }
}