use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.
the class ObjectObjectPersistentMultiMaplet method put.
@Override
public void put(final K key, final Collection<V> value) {
try {
myCache.remove(key);
myMap.appendData(key, new PersistentHashMap.ValueDataAppender() {
public void append(DataOutput out) throws IOException {
for (V v : value) {
myValueExternalizer.save(out, v);
}
}
});
} catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.
the class BackwardReferenceIndexWriter method initialize.
static void initialize(@NotNull final CompileContext context, int attempt) {
final BuildDataManager dataManager = context.getProjectDescriptor().dataManager;
final File buildDir = dataManager.getDataPaths().getDataStorageRoot();
if (isEnabled()) {
boolean isRebuild = isRebuildInAllJavaModules(context);
if (!JavaCompilers.JAVAC_ID.equals(JavaBuilder.getUsedCompilerId(context)) || !JavaBuilder.IS_ENABLED.get(context, Boolean.TRUE)) {
CompilerBackwardReferenceIndex.removeIndexFiles(buildDir);
return;
}
if (isRebuild) {
CompilerBackwardReferenceIndex.removeIndexFiles(buildDir);
} else if (CompilerBackwardReferenceIndex.versionDiffers(buildDir)) {
CompilerBackwardReferenceIndex.removeIndexFiles(buildDir);
if ((attempt == 0 && areAllJavaModulesAffected(context))) {
throw new BuildDataCorruptedException("backward reference index should be updated to actual version");
} else {
// do not request a rebuild if a project is affected incompletely and version is changed, just disable indices
}
}
if (CompilerBackwardReferenceIndex.exist(buildDir) || isRebuild) {
ourInstance = new BackwardReferenceIndexWriter(new CompilerBackwardReferenceIndex(buildDir, false));
}
} else {
CompilerBackwardReferenceIndex.removeIndexFiles(buildDir);
}
}
use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.
the class CompilerBackwardReferenceIndex method saveVersion.
public void saveVersion(@NotNull File buildDir) {
File versionFile = new File(getIndexDir(buildDir), VERSION_FILE);
try {
FileUtil.createIfDoesntExist(versionFile);
final DataOutputStream os = new DataOutputStream(new FileOutputStream(versionFile));
try {
os.writeInt(CompilerIndices.VERSION);
} finally {
os.close();
}
} catch (IOException ex) {
LOG.error(ex);
throw new BuildDataCorruptedException(ex);
}
}
use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.
the class IntIntPersistentMultiMaplet method put.
@Override
public void put(final int key, final TIntHashSet value) {
try {
myCache.remove(key);
myMap.appendData(key, new PersistentHashMap.ValueDataAppender() {
public void append(final DataOutput out) throws IOException {
final Ref<IOException> exRef = new Ref<>();
value.forEach(value1 -> {
try {
DataInputOutputUtil.writeINT(out, value1);
} catch (IOException e) {
exRef.set(e);
return false;
}
return true;
});
final IOException exception = exRef.get();
if (exception != null) {
throw exception;
}
}
});
} catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.
the class IntIntPersistentMultiMaplet method close.
@Override
public void close() {
try {
myCache.clear();
myMap.close();
} catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
Aggregations