mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
when clearing target storage, do not clear src-out mapping which is handled in a special way
This commit is contained in:
@@ -57,13 +57,17 @@ public class BuildDataManager implements StorageOwner {
|
||||
synchronized (mySourceToOutputLock) {
|
||||
mapping = mySourceToOutputs.get(target);
|
||||
if (mapping == null) {
|
||||
mapping = new SourceToOutputMappingImpl(new File(myDataPaths.getTargetDataRoot(target), "src-out" + File.separator + "data"));
|
||||
mapping = new SourceToOutputMappingImpl(new File(getSourceToOutputMapRoot(target), "data"));
|
||||
mySourceToOutputs.put(target, mapping);
|
||||
}
|
||||
}
|
||||
return mapping;
|
||||
}
|
||||
|
||||
private File getSourceToOutputMapRoot(BuildTarget<?> target) {
|
||||
return new File(myDataPaths.getTargetDataRoot(target), "src-out");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public <S extends StorageOwner> S getStorage(@NotNull BuildTarget<?> target, @NotNull StorageProvider<S> provider) throws IOException {
|
||||
synchronized (myTargetStoragesLock) {
|
||||
@@ -94,17 +98,16 @@ public class BuildDataManager implements StorageOwner {
|
||||
}
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
synchronized (mySourceToOutputLock) {
|
||||
SourceToOutputMappingImpl mapping = mySourceToOutputs.remove(target);
|
||||
if (mapping != null) {
|
||||
mapping.close();
|
||||
// delete all data except src-out mapping which is cleaned in a special way
|
||||
final File[] targetData = myDataPaths.getTargetDataRoot(target).listFiles();
|
||||
if (targetData != null) {
|
||||
final File srcOutputMapRoot = getSourceToOutputMapRoot(target);
|
||||
for (File dataFile : targetData) {
|
||||
if (!FileUtil.filesEqual(dataFile, srcOutputMapRoot)) {
|
||||
FileUtil.delete(dataFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
FileUtil.delete(myDataPaths.getTargetDataRoot(target));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user