mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
proper 'incremental' flag processing for modules
This commit is contained in:
@@ -51,7 +51,7 @@ public abstract class Builder {
|
||||
|
||||
//noinspection SynchronizationOnLocalVariableOrMethodParameter
|
||||
synchronized (globalMappings) {
|
||||
if (!context.isProjectRebuild()) {
|
||||
if (!context.isProjectRebuild() && context.shouldDifferentiate(chunk, context.isCompilingTests())) {
|
||||
final Set<File> allCompiledFiles = getAllCompiledFilesContainer(context);
|
||||
final Set<File> allAffectedFiles = getAllAffectedFilesContainer(context);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.jetbrains.jps.incremental;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -31,6 +32,8 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
private final BuildDataManager myDataManager;
|
||||
private final ModuleRootsIndex myRootsIndex;
|
||||
|
||||
private final Set<Pair<Module, DirtyMarkScope>> myNonIncrementalModules = new HashSet<Pair<Module, DirtyMarkScope>>();
|
||||
|
||||
private final ProjectPaths myProjectPaths;
|
||||
private volatile boolean myErrorsFound = false;
|
||||
private final long myCompilationStartStamp;
|
||||
@@ -110,10 +113,30 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
}
|
||||
|
||||
for (Module module : dirtyModules) {
|
||||
markDirtyFiles(module, myTsStorage, true, DirtyMarkScope.BOTH, null);
|
||||
markDirtyFiles(module, myTsStorage, true, isCompilingTests()? DirtyMarkScope.TESTS : DirtyMarkScope.BOTH, null);
|
||||
if (isMake()) {
|
||||
if (!isCompilingTests()) {
|
||||
myNonIncrementalModules.add(new Pair<Module, DirtyMarkScope>(module, DirtyMarkScope.PRODUCTION));
|
||||
}
|
||||
myNonIncrementalModules.add(new Pair<Module, DirtyMarkScope>(module, DirtyMarkScope.TESTS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean shouldDifferentiate(ModuleChunk chunk, boolean forTests) {
|
||||
if (!isMake()) {
|
||||
// the check makes sense only in make mode
|
||||
return true;
|
||||
}
|
||||
final DirtyMarkScope dirtyScope = forTests ? DirtyMarkScope.TESTS : DirtyMarkScope.PRODUCTION;
|
||||
for (Module module : chunk.getModules()) {
|
||||
if (myNonIncrementalModules.contains(new Pair<Module, DirtyMarkScope>(module, dirtyScope))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Mappings createDelta() {
|
||||
return myDataManager.getMappings().createDelta();
|
||||
}
|
||||
@@ -140,7 +163,12 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
try {
|
||||
if (!myErrorsFound && !myCancelStatus.isCanceled()) {
|
||||
final boolean compilingTests = isCompilingTests();
|
||||
final DirtyMarkScope dirtyScope = compilingTests ? DirtyMarkScope.TESTS : DirtyMarkScope.PRODUCTION;
|
||||
for (Module module : chunk.getModules()) {
|
||||
if (isMake()) {
|
||||
// ensure non-incremental flag cleared
|
||||
myNonIncrementalModules.remove(new Pair<Module, DirtyMarkScope>(module, dirtyScope));
|
||||
}
|
||||
if (isProjectRebuild()) {
|
||||
myFsState.markInitialScanPerformed(module, compilingTests);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user