mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
fixes:
when registering delete path, remove it from 'toRecompile' list prevent infinite recursion on make when compiling mutually dependent files in successive compilation rounds mark dirty files on make considering module layout (sources were attributed to wrong chunk)
This commit is contained in:
@@ -71,10 +71,8 @@ public abstract class Builder {
|
||||
if (incremental) {
|
||||
final Set<File> newlyAffectedFiles = new HashSet<File>(allAffectedFiles);
|
||||
newlyAffectedFiles.removeAll(affectedBeforeDif);
|
||||
// todo: temp code
|
||||
for (String removedPath : removedPaths) {
|
||||
newlyAffectedFiles.remove(new File(removedPath));
|
||||
}
|
||||
newlyAffectedFiles.removeAll(allCompiledFiles); // the diff operation may have affected the class already compiled in thic compilation round
|
||||
|
||||
if (!newlyAffectedFiles.isEmpty()) {
|
||||
for (File file : newlyAffectedFiles) {
|
||||
context.markDirty(file);
|
||||
|
||||
@@ -126,6 +126,10 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
myCompilingTests = compilingTests;
|
||||
}
|
||||
|
||||
public void onChunkBuildStart(ModuleChunk chunk) {
|
||||
myFsState.setContextChunk(chunk);
|
||||
}
|
||||
|
||||
void beforeNextCompileRound(@NotNull ModuleChunk chunk) {
|
||||
myFsState.beforeNextRoundStart();
|
||||
}
|
||||
@@ -150,7 +154,7 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
}
|
||||
}
|
||||
finally {
|
||||
myFsState.clearRoundDeltas();
|
||||
myFsState.clearContextRoundData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +208,7 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
// can check if the file exists
|
||||
final File file = new File(path);
|
||||
if (!currentFiles.contains(file)) {
|
||||
myFsState.registerDeleted(module, path, isCompilingTests(), myTsStorage);
|
||||
myFsState.registerDeleted(module, file, isCompilingTests(), myTsStorage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,10 +228,6 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
return myRootsIndex.getModuleRoots(module);
|
||||
}
|
||||
|
||||
public int getTotalModuleCount() {
|
||||
return myRootsIndex.getTotalModuleCount();
|
||||
}
|
||||
|
||||
public void setDone(float done) {
|
||||
myDone = done;
|
||||
processMessage(new ProgressMessage("", done));
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.CompilerExcludes;
|
||||
import org.jetbrains.jps.Module;
|
||||
import org.jetbrains.jps.ModuleChunk;
|
||||
import org.jetbrains.jps.incremental.storage.TimestampStorage;
|
||||
|
||||
import java.io.File;
|
||||
@@ -18,6 +19,8 @@ public class FSState {
|
||||
private final Map<Module, FilesDelta> myDeltas = Collections.synchronizedMap(new HashMap<Module, FilesDelta>());
|
||||
private final Set<Module> myInitialTestsScanPerformed = Collections.synchronizedSet(new HashSet<Module>());
|
||||
private final Set<Module> myInitialProductionScanPerformed = Collections.synchronizedSet(new HashSet<Module>());
|
||||
|
||||
private final Set<Module> myContextModules = new HashSet<Module>();
|
||||
private volatile FilesDelta myCurrentRoundDelta;
|
||||
private volatile FilesDelta myLastRoundDelta;
|
||||
|
||||
@@ -25,7 +28,7 @@ public class FSState {
|
||||
}
|
||||
|
||||
public void onRebuild() {
|
||||
clearRoundDeltas();
|
||||
clearContextRoundData();
|
||||
myInitialProductionScanPerformed.clear();
|
||||
myInitialTestsScanPerformed.clear();
|
||||
myDeltas.clear();
|
||||
@@ -36,14 +39,19 @@ public class FSState {
|
||||
return map.add(module);
|
||||
}
|
||||
|
||||
public void setContextChunk(ModuleChunk chunk) {
|
||||
myContextModules.addAll(chunk.getModules());
|
||||
}
|
||||
|
||||
public void beforeNextRoundStart() {
|
||||
myLastRoundDelta = myCurrentRoundDelta;
|
||||
myCurrentRoundDelta = new FilesDelta();
|
||||
}
|
||||
|
||||
public void clearRoundDeltas() {
|
||||
public void clearContextRoundData() {
|
||||
myCurrentRoundDelta = null;
|
||||
myLastRoundDelta = null;
|
||||
myContextModules.clear();
|
||||
}
|
||||
|
||||
public void clearRecompile(RootDescriptor rd) {
|
||||
@@ -53,7 +61,9 @@ public class FSState {
|
||||
public void markDirty(final File file, final RootDescriptor rd, final @Nullable TimestampStorage tsStorage) throws Exception {
|
||||
final FilesDelta roundDelta = myCurrentRoundDelta;
|
||||
if (roundDelta != null) {
|
||||
roundDelta.markRecompile(rd.root, rd.isTestRoot, file);
|
||||
if (myContextModules.contains(rd.module)) {
|
||||
roundDelta.markRecompile(rd.root, rd.isTestRoot, file);
|
||||
}
|
||||
}
|
||||
final FilesDelta mainDelta = getDelta(rd.module);
|
||||
final boolean marked = mainDelta.markRecompile(rd.root, rd.isTestRoot, file);
|
||||
@@ -108,10 +118,10 @@ public class FSState {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void registerDeleted(final Module module, final String path, final boolean isTest, @Nullable TimestampStorage tsStorage) throws Exception {
|
||||
getDelta(module).addDeleted(path, isTest);
|
||||
public void registerDeleted(final Module module, final File file, final boolean isTest, @Nullable TimestampStorage tsStorage) throws Exception {
|
||||
getDelta(module).addDeleted(file, isTest);
|
||||
if (tsStorage != null) {
|
||||
tsStorage.remove(new File(path));
|
||||
tsStorage.remove(file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,9 +171,16 @@ public class FSState {
|
||||
return files.add(file);
|
||||
}
|
||||
|
||||
public void addDeleted(String path, boolean isTest) {
|
||||
final Set<String> map = isTest? myDeletedTests : myDeletedProduction;
|
||||
map.add(path);
|
||||
public void addDeleted(File file, boolean isTest) {
|
||||
// ensure the file is no more marked to recompilation
|
||||
final Map<File, Set<File>> toRecompile = isTest ? myTestsToRecompile : mySourcesToRecompile;
|
||||
synchronized (toRecompile) {
|
||||
for (Set<File> files : toRecompile.values()) {
|
||||
files.remove(file);
|
||||
}
|
||||
}
|
||||
final Set<String> deletedMap = isTest? myDeletedTests : myDeletedProduction;
|
||||
deletedMap.add(FileUtil.toCanonicalPath(file.getPath()));
|
||||
}
|
||||
|
||||
public void clearDeletedPaths(boolean isTest) {
|
||||
|
||||
@@ -273,6 +273,8 @@ public class IncProjectBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
context.onChunkBuildStart(chunk);
|
||||
|
||||
for (BuilderCategory category : BuilderCategory.values()) {
|
||||
runBuilders(context, chunk, category);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.jetbrains.jps.server;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.codehaus.groovy.runtime.MethodClosure;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.JavaSdk;
|
||||
@@ -66,7 +65,7 @@ class ServerState {
|
||||
try {
|
||||
final RootDescriptor moduleAndRoot = pd.rootsIndex.getModuleAndRoot(file);
|
||||
if (moduleAndRoot != null) {
|
||||
pd.fsState.registerDeleted(moduleAndRoot.module, FileUtil.toCanonicalPath(file.getPath()), moduleAndRoot.isTestRoot, pd.timestamps.getStorage());
|
||||
pd.fsState.registerDeleted(moduleAndRoot.module, file, moduleAndRoot.isTestRoot, pd.timestamps.getStorage());
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user