mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Exception -> IOException
This commit is contained in:
@@ -15,6 +15,7 @@ import org.jetbrains.jps.incremental.storage.SourceToOutputMapping;
|
||||
import org.jetbrains.jps.incremental.storage.TimestampStorage;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -80,14 +81,14 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
return myIsProjectRebuild;
|
||||
}
|
||||
|
||||
public void markDirty(final File file) throws Exception {
|
||||
public void markDirty(final File file) throws IOException {
|
||||
final RootDescriptor descriptor = getModuleAndRoot(file);
|
||||
if (descriptor != null) {
|
||||
myFsState.markDirty(file, descriptor, myTsStorage);
|
||||
}
|
||||
}
|
||||
|
||||
public void markDirty(final ModuleChunk chunk) throws Exception {
|
||||
public void markDirty(final ModuleChunk chunk) throws IOException {
|
||||
myFsState.clearContextRoundData();
|
||||
final Set<Module> modules = chunk.getModules();
|
||||
for (Module module : modules) {
|
||||
@@ -95,7 +96,7 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
}
|
||||
}
|
||||
|
||||
public void markDirtyRecursively(ModuleChunk chunk) throws Exception {
|
||||
public void markDirtyRecursively(ModuleChunk chunk) throws IOException {
|
||||
final Set<Module> modules = chunk.getModules();
|
||||
final Set<Module> dirtyModules = new HashSet<Module>(modules);
|
||||
|
||||
@@ -170,7 +171,7 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
myFsState.beforeNextRoundStart();
|
||||
}
|
||||
|
||||
void onChunkBuildComplete(@NotNull ModuleChunk chunk) throws Exception {
|
||||
void onChunkBuildComplete(@NotNull ModuleChunk chunk) throws IOException {
|
||||
myDataManager.flush(true);
|
||||
|
||||
try {
|
||||
@@ -225,13 +226,13 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
myDelegateMessageHandler.processMessage(msg);
|
||||
}
|
||||
|
||||
public void processFilesToRecompile(ModuleChunk chunk, FileProcessor processor) throws Exception {
|
||||
public void processFilesToRecompile(ModuleChunk chunk, FileProcessor processor) throws IOException {
|
||||
for (Module module : chunk.getModules()) {
|
||||
myFsState.processFilesToRecompile(this, module, processor);
|
||||
}
|
||||
}
|
||||
|
||||
final void ensureFSStateInitialized(ModuleChunk chunk) throws Exception {
|
||||
final void ensureFSStateInitialized(ModuleChunk chunk) throws IOException {
|
||||
for (Module module : chunk.getModules()) {
|
||||
if (isProjectRebuild()) {
|
||||
markDirtyFiles(module, myTsStorage, true, isCompilingTests() ? DirtyMarkScope.TESTS : DirtyMarkScope.PRODUCTION, null);
|
||||
@@ -252,7 +253,7 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
}
|
||||
}
|
||||
|
||||
private void initModuleFSState(Module module) throws Exception {
|
||||
private void initModuleFSState(Module module) throws IOException {
|
||||
final HashSet<File> currentFiles = new HashSet<File>();
|
||||
markDirtyFiles(module, myTsStorage, false, isCompilingTests() ? DirtyMarkScope.TESTS : DirtyMarkScope.PRODUCTION, currentFiles);
|
||||
|
||||
@@ -296,7 +297,7 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
PRODUCTION, TESTS, BOTH
|
||||
}
|
||||
|
||||
private void markDirtyFiles(Module module, final TimestampStorage tsStorage, final boolean forceMarkDirty, @NotNull final DirtyMarkScope scope, @Nullable final Set<File> currentFiles) throws Exception {
|
||||
private void markDirtyFiles(Module module, final TimestampStorage tsStorage, final boolean forceMarkDirty, @NotNull final DirtyMarkScope scope, @Nullable final Set<File> currentFiles) throws IOException {
|
||||
final Set<File> excludes = new HashSet<File>();
|
||||
for (String excludePath : module.getExcludes()) {
|
||||
excludes.add(new File(excludePath));
|
||||
@@ -323,7 +324,7 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
|
||||
}
|
||||
}
|
||||
|
||||
private void traverseRecursively(final RootDescriptor rd, final File file, Set<File> excludes, @NotNull final TimestampStorage tsStorage, final boolean forceDirty, @Nullable Set<File> currentFiles) throws Exception {
|
||||
private void traverseRecursively(final RootDescriptor rd, final File file, Set<File> excludes, @NotNull final TimestampStorage tsStorage, final boolean forceDirty, @Nullable Set<File> currentFiles) throws IOException {
|
||||
if (file.isDirectory()) {
|
||||
if (!PathUtil.isUnder(excludes, file)) {
|
||||
final File[] children = file.listFiles();
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.jetbrains.jps.ModuleChunk;
|
||||
import org.jetbrains.jps.incremental.storage.TimestampStorage;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -66,7 +67,7 @@ public class FSState {
|
||||
getDelta(rd.module).clearRecompile(rd.root, rd.isTestRoot);
|
||||
}
|
||||
|
||||
public void markDirty(final File file, final RootDescriptor rd, final @Nullable TimestampStorage tsStorage) throws Exception {
|
||||
public void markDirty(final File file, final RootDescriptor rd, final @Nullable TimestampStorage tsStorage) throws IOException {
|
||||
final FilesDelta roundDelta = myCurrentRoundDelta;
|
||||
if (roundDelta != null) {
|
||||
if (myContextModules.contains(rd.module)) {
|
||||
@@ -83,7 +84,7 @@ public class FSState {
|
||||
/**
|
||||
* @return true if marked something, false otherwise
|
||||
*/
|
||||
public boolean markAllUpToDate(CompileScope scope, final RootDescriptor rd, final TimestampStorage tsStorage, final long compilationStartStamp) throws Exception {
|
||||
public boolean markAllUpToDate(CompileScope scope, final RootDescriptor rd, final TimestampStorage tsStorage, final long compilationStartStamp) throws IOException {
|
||||
boolean marked = false;
|
||||
final FilesDelta delta = getDelta(rd.module);
|
||||
final Set<File> files = delta.clearRecompile(rd.root, rd.isTestRoot);
|
||||
@@ -115,7 +116,7 @@ public class FSState {
|
||||
return marked;
|
||||
}
|
||||
|
||||
public boolean processFilesToRecompile(CompileContext context, final Module module, final FileProcessor processor) throws Exception {
|
||||
public boolean processFilesToRecompile(CompileContext context, final Module module, final FileProcessor processor) throws IOException {
|
||||
final FilesDelta lastRoundDelta = myLastRoundDelta;
|
||||
final FilesDelta delta = lastRoundDelta != null? lastRoundDelta : getDelta(module);
|
||||
final Map<File, Set<File>> data = delta.getSourcesToRecompile(context.isCompilingTests());
|
||||
@@ -140,7 +141,7 @@ public class FSState {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void registerDeleted(final Module module, final File file, final boolean isTest, @Nullable TimestampStorage tsStorage) throws Exception {
|
||||
public void registerDeleted(final Module module, final File file, final boolean isTest, @Nullable TimestampStorage tsStorage) throws IOException {
|
||||
getDelta(module).addDeleted(file, isTest);
|
||||
if (tsStorage != null) {
|
||||
tsStorage.remove(file);
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.jetbrains.jps.incremental;
|
||||
import org.jetbrains.jps.Module;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -12,5 +13,5 @@ public interface FileProcessor {
|
||||
/**
|
||||
* @return true if processing should continue, false if should stop
|
||||
*/
|
||||
boolean apply(Module module, File file, String sourceRoot) throws Exception;
|
||||
boolean apply(Module module, File file, String sourceRoot) throws IOException;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.jetbrains.jps.Module;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -37,7 +38,7 @@ public class FilesCollector implements FileProcessor{
|
||||
return myContainer;
|
||||
}
|
||||
|
||||
public boolean apply(Module module, File file, String sourceRoot) throws Exception {
|
||||
public boolean apply(Module module, File file, String sourceRoot) throws IOException {
|
||||
if (myFilter.accept(file)) {
|
||||
myContainer.add(file);
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ public class IncProjectBuilder {
|
||||
private final Map<Module, SourceToOutputMapping> storageMap = new HashMap<Module, SourceToOutputMapping>();
|
||||
|
||||
@Override
|
||||
public boolean apply(Module module, File file, String sourceRoot) throws Exception {
|
||||
public boolean apply(Module module, File file, String sourceRoot) throws IOException {
|
||||
SourceToOutputMapping srcToOut = storageMap.get(module);
|
||||
if (srcToOut == null) {
|
||||
srcToOut = dataManager.getSourceToOutputMap(module.getName().toLowerCase(Locale.US), compilingTests);
|
||||
|
||||
@@ -43,7 +43,7 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
* @return true if additional compilation pass is required, false otherwise
|
||||
* @throws Exception
|
||||
*/
|
||||
public final boolean updateMappings(CompileContext context, final Mappings delta, ModuleChunk chunk, Collection<File> filesToCompile, Collection<File> successfullyCompiled) throws Exception {
|
||||
public final boolean updateMappings(CompileContext context, final Mappings delta, ModuleChunk chunk, Collection<File> filesToCompile, Collection<File> successfullyCompiled) throws IOException {
|
||||
try {
|
||||
boolean additionalPassRequired = false;
|
||||
|
||||
@@ -115,7 +115,7 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean chunkContainsAffectedFiles(CompileContext context, ModuleChunk chunk, final Set<File> affected) throws Exception {
|
||||
private static boolean chunkContainsAffectedFiles(CompileContext context, ModuleChunk chunk, final Set<File> affected) throws IOException {
|
||||
final Set<Module> chunkModules = new HashSet<Module>(chunk.getModules());
|
||||
if (!chunkModules.isEmpty()) {
|
||||
for (File file : affected) {
|
||||
|
||||
+5
-5
@@ -47,7 +47,7 @@ public class ArtifactSourceFilesState {
|
||||
myMappingsFile = new File(mappingsDir, String.valueOf(artifactId));
|
||||
}
|
||||
|
||||
public ArtifactSourceToOutputMapping getOrCreateMapping() throws Exception {
|
||||
public ArtifactSourceToOutputMapping getOrCreateMapping() throws IOException {
|
||||
if (myMapping == null) {
|
||||
myMapping = new ArtifactSourceToOutputMapping(myMappingsFile);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class ArtifactSourceFilesState {
|
||||
return myDeletedFiles;
|
||||
}
|
||||
|
||||
public void initState() throws Exception {
|
||||
public void initState() throws IOException {
|
||||
/*
|
||||
if (!myInitialized.compareAndSet(false, true)) {
|
||||
return;
|
||||
@@ -80,7 +80,7 @@ public class ArtifactSourceFilesState {
|
||||
myDeletedFiles.clear();
|
||||
getOrCreateInstructions().processRoots(new ArtifactRootProcessor() {
|
||||
@Override
|
||||
public void process(ArtifactSourceRoot root, Collection<DestinationInfo> destinations) throws Exception {
|
||||
public void process(ArtifactSourceRoot root, Collection<DestinationInfo> destinations) throws IOException {
|
||||
final File rootFile = root.getRootFile();
|
||||
if (rootFile.exists()) {
|
||||
processRecursively(rootFile, root.getFilter(), currentPaths);
|
||||
@@ -101,7 +101,7 @@ public class ArtifactSourceFilesState {
|
||||
return myTimestampStorage;
|
||||
}
|
||||
|
||||
private void processRecursively(File file, SourceFileFilter filter, Set<String> currentPaths) throws Exception {
|
||||
private void processRecursively(File file, SourceFileFilter filter, Set<String> currentPaths) throws IOException {
|
||||
final String filePath = FileUtil.toSystemIndependentName(FileUtil.toCanonicalPath(file.getPath()));
|
||||
if (!filter.accept(filePath)) return;
|
||||
|
||||
@@ -148,7 +148,7 @@ public class ArtifactSourceFilesState {
|
||||
return instructionsBuilder;
|
||||
}
|
||||
|
||||
public void updateTimestamps(Set<String> deletedFiles, Set<String> changedFiles) throws Exception {
|
||||
public void updateTimestamps(Set<String> deletedFiles, Set<String> changedFiles) throws IOException {
|
||||
for (String filePath : deletedFiles) {
|
||||
final ArtifactSourceTimestampStorage.PerArtifactTimestamp[] state = myTimestampStorage.getState(filePath);
|
||||
if (state == null) continue;
|
||||
|
||||
+2
-2
@@ -37,11 +37,11 @@ public class ArtifactSourceTimestampStorage extends AbstractStateStorage<String,
|
||||
}
|
||||
};
|
||||
|
||||
public ArtifactSourceTimestampStorage(@NonNls File storePath) throws Exception {
|
||||
public ArtifactSourceTimestampStorage(@NonNls File storePath) throws IOException {
|
||||
super(storePath, new EnumeratorStringDescriptor(), TIMESTAMP_EXTERNALIZER);
|
||||
}
|
||||
|
||||
public void markDirty(String filePath) throws Exception {
|
||||
public void markDirty(String filePath) throws IOException {
|
||||
update(filePath, null);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class ArtifactSourceToOutputMapping extends AbstractStateStorage<String,
|
||||
}
|
||||
};
|
||||
|
||||
public ArtifactSourceToOutputMapping(@NonNls File storePath) throws Exception {
|
||||
public ArtifactSourceToOutputMapping(@NonNls File storePath) throws IOException {
|
||||
super(storePath, new EnumeratorStringDescriptor(), STRING_ARRAY_EXTERNALIZER);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public class ArtifactsBuildData {
|
||||
private final File myArtifactsDataDir;
|
||||
private final File myMappingsDir;
|
||||
|
||||
public ArtifactsBuildData(File artifactsDataDir) throws Exception {
|
||||
public ArtifactsBuildData(File artifactsDataDir) throws IOException {
|
||||
myArtifactsDataDir = artifactsDataDir;
|
||||
myTimestampStorage = new ArtifactSourceTimestampStorage(new File(artifactsDataDir, "timestamps"));
|
||||
myArtifactState = new HashMap<Artifact, ArtifactSourceFilesState>();
|
||||
|
||||
+3
-2
@@ -20,6 +20,7 @@ import org.jetbrains.jps.incremental.messages.UptoDateFilesSavedEvent;
|
||||
import org.jetbrains.jps.incremental.storage.BuildDataManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -92,7 +93,7 @@ public class IncArtifactBuilder extends ProjectLevelBuilder {
|
||||
final List<String> outputs = new SmartList<String>();
|
||||
instructions.processContainingRoots(filePath, new ArtifactRootProcessor() {
|
||||
@Override
|
||||
public void process(ArtifactSourceRoot root, Collection<DestinationInfo> destinations) throws Exception {
|
||||
public void process(ArtifactSourceRoot root, Collection<DestinationInfo> destinations) throws IOException {
|
||||
for (DestinationInfo destination : destinations) {
|
||||
if (destination instanceof ExplodedDestinationInfo) {
|
||||
root.copyFromRoot(filePath, destination.getOutputPath(), outputs);
|
||||
@@ -125,7 +126,7 @@ public class IncArtifactBuilder extends ProjectLevelBuilder {
|
||||
}
|
||||
|
||||
private static Set<String> deleteOutdatedFiles(Set<String> deletedFiles, CompileContext context,
|
||||
ArtifactSourceToOutputMapping mapping) throws Exception {
|
||||
ArtifactSourceToOutputMapping mapping) throws IOException {
|
||||
if (deletedFiles.isEmpty()) return Collections.emptySet();
|
||||
|
||||
context.processMessage(new ProgressMessage("Deleting outdated files..."));
|
||||
|
||||
+4
-2
@@ -2,13 +2,15 @@ package org.jetbrains.jps.incremental.artifacts.instructions;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public interface ArtifactInstructionsBuilder {
|
||||
void processRoots(ArtifactRootProcessor processor) throws Exception;
|
||||
void processRoots(ArtifactRootProcessor processor) throws IOException;
|
||||
|
||||
void processContainingRoots(String filePath, ArtifactRootProcessor processor) throws Exception;
|
||||
void processContainingRoots(String filePath, ArtifactRootProcessor processor) throws IOException;
|
||||
|
||||
@Nullable
|
||||
JarInfo getJarInfo(String outputPath);
|
||||
|
||||
+3
-2
@@ -7,6 +7,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.incremental.ModuleRootsIndex;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -70,14 +71,14 @@ public class ArtifactInstructionsBuilderImpl implements ArtifactInstructionsBuil
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processRoots(ArtifactRootProcessor processor) throws Exception {
|
||||
public void processRoots(ArtifactRootProcessor processor) throws IOException {
|
||||
for (Map.Entry<ArtifactSourceRoot, Collection<DestinationInfo>> entry : myInstructions.entrySet()) {
|
||||
processor.process(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processContainingRoots(String filePath, ArtifactRootProcessor processor) throws Exception {
|
||||
public void processContainingRoots(String filePath, ArtifactRootProcessor processor) throws IOException {
|
||||
//todo[nik] improve?
|
||||
for (Map.Entry<ArtifactSourceRoot, Collection<DestinationInfo>> entry : myInstructions.entrySet()) {
|
||||
final ArtifactSourceRoot root = entry.getKey();
|
||||
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
package org.jetbrains.jps.incremental.artifacts.instructions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public interface ArtifactRootProcessor {
|
||||
void process(ArtifactSourceRoot root, Collection<DestinationInfo> destinations) throws Exception;
|
||||
void process(ArtifactSourceRoot root, Collection<DestinationInfo> destinations) throws IOException;
|
||||
}
|
||||
|
||||
@@ -140,11 +140,11 @@ public class GroovyBuilder extends ModuleLevelBuilder {
|
||||
return FileUtil.toCanonicalPath(dir.getPath());
|
||||
}
|
||||
|
||||
private static List<File> collectChangedFiles(CompileContext context, ModuleChunk chunk) throws Exception {
|
||||
private static List<File> collectChangedFiles(CompileContext context, ModuleChunk chunk) throws IOException {
|
||||
final List<File> toCompile = new ArrayList<File>();
|
||||
context.processFilesToRecompile(chunk, new FileProcessor() {
|
||||
@Override
|
||||
public boolean apply(Module module, File file, String sourceRoot) throws Exception {
|
||||
public boolean apply(Module module, File file, String sourceRoot) throws IOException {
|
||||
final String path = file.getPath();
|
||||
if (isGroovyFile(path)) { //todo file type check
|
||||
toCompile.add(file);
|
||||
@@ -159,7 +159,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
|
||||
ModuleChunk chunk,
|
||||
List<File> toCompile,
|
||||
String moduleOutputPath,
|
||||
List<GroovycOSProcessHandler.OutputItem> successfullyCompiled) throws Exception {
|
||||
List<GroovycOSProcessHandler.OutputItem> successfullyCompiled) throws IOException {
|
||||
final Mappings delta = context.createDelta();
|
||||
final List<File> successfullyCompiledFiles = new ArrayList<File>();
|
||||
if (!successfullyCompiled.isEmpty()) {
|
||||
@@ -207,7 +207,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
|
||||
return path.endsWith(".groovy") || path.endsWith(".gpp");
|
||||
}
|
||||
|
||||
private static Map<String, String> buildClassToSourceMap(ModuleChunk chunk, CompileContext context, Set<String> toCompilePaths, String moduleOutputPath) throws Exception {
|
||||
private static Map<String, String> buildClassToSourceMap(ModuleChunk chunk, CompileContext context, Set<String> toCompilePaths, String moduleOutputPath) throws IOException {
|
||||
final Map<String, String> class2Src = new HashMap<String, String>();
|
||||
for (Module module : chunk.getModules()) {
|
||||
final String moduleName = module.getName().toLowerCase(Locale.US);
|
||||
|
||||
@@ -132,7 +132,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
final Set<File> formsToCompile = new HashSet<File>();
|
||||
|
||||
context.processFilesToRecompile(chunk, new FileProcessor() {
|
||||
public boolean apply(Module module, File file, String sourceRoot) throws Exception {
|
||||
public boolean apply(Module module, File file, String sourceRoot) throws IOException {
|
||||
if (JAVA_SOURCES_FILTER.accept(file)) {
|
||||
filesToCompile.add(file);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ResourcesBuilder extends ModuleLevelBuilder {
|
||||
// todo: process all files in case of rebuild or wholeModuleDirty
|
||||
// todo: otherwise avoid traverwing the whole module and use dirty file list taken from params
|
||||
context.processFilesToRecompile(chunk, new FileProcessor() {
|
||||
public boolean apply(final Module module, final File file, final String sourceRoot) throws Exception {
|
||||
public boolean apply(final Module module, final File file, final String sourceRoot) throws IOException {
|
||||
if (finalPatterns.isResourceFile(file, sourceRoot)) {
|
||||
try {
|
||||
context.processMessage(new ProgressMessage("Copying " + file.getPath()));
|
||||
@@ -79,7 +79,7 @@ public class ResourcesBuilder extends ModuleLevelBuilder {
|
||||
Module module,
|
||||
File file,
|
||||
String sourceRoot,
|
||||
final SourceToOutputMapping outputToSourceMapping) throws Exception {
|
||||
final SourceToOutputMapping outputToSourceMapping) throws IOException {
|
||||
final String outputRoot = context.isCompilingTests() ? module.getTestOutputPath() : module.getOutputPath();
|
||||
final String relativePath = FileUtil.getRelativePath(sourceRoot, FileUtil.toSystemIndependentName(file.getPath()), '/');
|
||||
final String prefix = module.getSourceRootPrefixes().get(sourceRoot);
|
||||
|
||||
+9
-9
@@ -20,7 +20,7 @@ public abstract class AbstractStateStorage<Key, T> {
|
||||
private final DataExternalizer<T> myStateExternalizer;
|
||||
protected final Object myDataLock = new Object();
|
||||
|
||||
public AbstractStateStorage(@NonNls File storePath, KeyDescriptor<Key> keyDescriptor, DataExternalizer<T> stateExternalizer) throws Exception {
|
||||
public AbstractStateStorage(@NonNls File storePath, KeyDescriptor<Key> keyDescriptor, DataExternalizer<T> stateExternalizer) throws IOException {
|
||||
myBaseFile = storePath;
|
||||
myKeyDescriptor = keyDescriptor;
|
||||
myStateExternalizer = stateExternalizer;
|
||||
@@ -58,14 +58,14 @@ public abstract class AbstractStateStorage<Key, T> {
|
||||
try {
|
||||
myMap = createMap(myBaseFile);
|
||||
}
|
||||
catch (Exception ignored) {
|
||||
catch (IOException ignored) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void update(Key key, @Nullable T state) throws Exception {
|
||||
public void update(Key key, @Nullable T state) throws IOException {
|
||||
if (state != null) {
|
||||
synchronized (myDataLock) {
|
||||
myMap.put(key, state);
|
||||
@@ -76,7 +76,7 @@ public abstract class AbstractStateStorage<Key, T> {
|
||||
}
|
||||
}
|
||||
|
||||
public void appendData(final Key key, final T data) throws Exception {
|
||||
public void appendData(final Key key, final T data) throws IOException {
|
||||
synchronized (myDataLock) {
|
||||
myMap.appendData(key, new PersistentHashMap.ValueDataAppender() {
|
||||
public void append(DataOutput out) throws IOException {
|
||||
@@ -86,32 +86,32 @@ public abstract class AbstractStateStorage<Key, T> {
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(Key key) throws Exception {
|
||||
public void remove(Key key) throws IOException {
|
||||
synchronized (myDataLock) {
|
||||
myMap.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
public T getState(Key key) throws Exception {
|
||||
public T getState(Key key) throws IOException {
|
||||
synchronized (myDataLock) {
|
||||
return myMap.get(key);
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<Key> getKeys() throws Exception {
|
||||
public Collection<Key> getKeys() throws IOException {
|
||||
synchronized (myDataLock) {
|
||||
return myMap.getAllKeysWithExistingMapping();
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator<Key> getKeysIterator() throws Exception {
|
||||
public Iterator<Key> getKeysIterator() throws IOException {
|
||||
synchronized (myDataLock) {
|
||||
return myMap.getAllKeysWithExistingMapping().iterator();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private PersistentHashMap<Key, T> createMap(final File file) throws Exception {
|
||||
private PersistentHashMap<Key, T> createMap(final File file) throws IOException {
|
||||
FileUtil.createIfDoesntExist(file);
|
||||
return new PersistentHashMap<Key,T>(file, myKeyDescriptor, myStateExternalizer);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class BuildDataManager {
|
||||
private final ArtifactsBuildData myArtifactsBuildData;
|
||||
private final Mappings myMappings;
|
||||
|
||||
public BuildDataManager(String projectName, final boolean useMemoryTempCaches) throws Exception {
|
||||
public BuildDataManager(String projectName, final boolean useMemoryTempCaches) throws IOException {
|
||||
myProjectName = projectName;
|
||||
mySrcToFormMap = new SourceToFormMapping(new File(getSourceToFormsRoot(), "data"));
|
||||
myMappings = new Mappings(getMappingsRoot(), useMemoryTempCaches);
|
||||
@@ -39,7 +39,7 @@ public class BuildDataManager {
|
||||
myArtifactsBuildData = new ArtifactsBuildData(artifactsDataDir);
|
||||
}
|
||||
|
||||
public SourceToOutputMapping getSourceToOutputMap(String moduleName, boolean testSources) throws Exception {
|
||||
public SourceToOutputMapping getSourceToOutputMap(String moduleName, boolean testSources) throws IOException {
|
||||
final Map<String, SourceToOutputMapping> storageMap = testSources? myTestSourceToOutputs : myProductionSourceToOutputs;
|
||||
SourceToOutputMapping mapping;
|
||||
synchronized (mySourceToOutputLock) {
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ProjectTimestamps {
|
||||
private final String myProjectName;
|
||||
private final TimestampStorage myTimestamps;
|
||||
|
||||
public ProjectTimestamps(String projectName) throws Exception {
|
||||
public ProjectTimestamps(String projectName) throws IOException {
|
||||
myProjectName = projectName;
|
||||
myTimestamps = new TimestampStorage(new File(getTimestampsRoot(projectName), "data"));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.io.EnumeratorStringDescriptor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -11,23 +12,23 @@ import java.io.File;
|
||||
*/
|
||||
public class SourceToFormMapping extends AbstractStateStorage<String, String>{
|
||||
|
||||
public SourceToFormMapping(File storePath) throws Exception {
|
||||
public SourceToFormMapping(File storePath) throws IOException {
|
||||
super(storePath, new EnumeratorStringDescriptor(), new EnumeratorStringDescriptor());
|
||||
}
|
||||
|
||||
public void update(String srcPath, String formPath) throws Exception {
|
||||
public void update(String srcPath, String formPath) throws IOException {
|
||||
super.update(FileUtil.toSystemIndependentName(srcPath), FileUtil.toSystemIndependentName(formPath));
|
||||
}
|
||||
|
||||
public final void appendData(String srcPath, String formPath) throws Exception {
|
||||
public final void appendData(String srcPath, String formPath) throws IOException {
|
||||
update(srcPath, formPath);
|
||||
}
|
||||
|
||||
public void remove(String srcPath) throws Exception {
|
||||
public void remove(String srcPath) throws IOException {
|
||||
super.remove(FileUtil.toSystemIndependentName(srcPath));
|
||||
}
|
||||
|
||||
public String getState(String srcPath) throws Exception {
|
||||
public String getState(String srcPath) throws IOException {
|
||||
return super.getState(FileUtil.toSystemIndependentName(srcPath));
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -20,34 +20,34 @@ import java.util.List;
|
||||
*/
|
||||
public final class SourceToOutputMapping extends AbstractStateStorage<String, Collection<String>> {
|
||||
|
||||
public SourceToOutputMapping(File storePath) throws Exception {
|
||||
public SourceToOutputMapping(File storePath) throws IOException {
|
||||
super(storePath, new EnumeratorStringDescriptor(), new StringCollectionExternalizer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull String srcPath, @NotNull Collection<String> outputs) throws Exception {
|
||||
public void update(@NotNull String srcPath, @NotNull Collection<String> outputs) throws IOException {
|
||||
super.update(FileUtil.toSystemIndependentName(srcPath), normalizePaths(outputs));
|
||||
}
|
||||
|
||||
public void update(@NotNull String srcPath, @NotNull String outputPath) throws Exception {
|
||||
public void update(@NotNull String srcPath, @NotNull String outputPath) throws IOException {
|
||||
super.update(FileUtil.toSystemIndependentName(srcPath), Collections.singleton(FileUtil.toSystemIndependentName(outputPath)));
|
||||
}
|
||||
|
||||
public void appendData(String srcPath, String outputPath) throws Exception {
|
||||
public void appendData(String srcPath, String outputPath) throws IOException {
|
||||
super.appendData(FileUtil.toSystemIndependentName(srcPath), Collections.singleton(FileUtil.toSystemIndependentName(outputPath)));
|
||||
}
|
||||
|
||||
public void appendData(String srcPath, Collection<String> data) throws Exception {
|
||||
public void appendData(String srcPath, Collection<String> data) throws IOException {
|
||||
super.appendData(FileUtil.toSystemIndependentName(srcPath), normalizePaths(data));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(@NotNull String srcPath) throws Exception {
|
||||
public void remove(@NotNull String srcPath) throws IOException {
|
||||
super.remove(FileUtil.toSystemIndependentName(srcPath));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getState(@NotNull String srcPath) throws Exception {
|
||||
public Collection<String> getState(@NotNull String srcPath) throws IOException {
|
||||
return super.getState(FileUtil.toSystemIndependentName(srcPath));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,20 +15,20 @@ import java.io.IOException;
|
||||
*/
|
||||
public class TimestampStorage extends AbstractStateStorage<File, TimestampValidityState> {
|
||||
|
||||
public TimestampStorage(File storePath) throws Exception {
|
||||
public TimestampStorage(File storePath) throws IOException {
|
||||
super(storePath, new FileKeyDescriptor(), new StateExternalizer());
|
||||
}
|
||||
|
||||
public long getStamp(File file) throws Exception {
|
||||
public long getStamp(File file) throws IOException {
|
||||
final TimestampValidityState state = getState(file);
|
||||
return state != null? state.getTimestamp() : -1L;
|
||||
}
|
||||
|
||||
public void saveStamp(File file, long timestamp) throws Exception {
|
||||
public void saveStamp(File file, long timestamp) throws IOException {
|
||||
update(file, new TimestampValidityState(timestamp));
|
||||
}
|
||||
|
||||
public void markDirty(File file) throws Exception {
|
||||
public void markDirty(File file) throws IOException {
|
||||
update(file, null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user