Search in sources :

Example 11 with BuildDataCorruptedException

use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.

the class ClassRepr method save.

@Override
public void save(final DataOutput out) {
    try {
        super.save(out);
        DataInputOutputUtil.writeINT(out, myFileName);
        mySuperClass.save(out);
        RW.save(myInterfaces, out);
        RW.save(myFields, out);
        RW.save(myMethods, out);
        RW.save(myAnnotationTargets, UsageRepr.AnnotationUsage.elementTypeExternalizer, out);
        RW.writeUTF(out, myRetentionPolicy == null ? "" : myRetentionPolicy.toString());
        DataInputOutputUtil.writeINT(out, myOuterClassName);
        DataInputOutputUtil.writeINT(out, (myIsLocal ? LOCAL_MASK : 0) | (myIsAnonymous ? ANONYMOUS_MASK : 0));
        RW.save(myUsages, UsageRepr.externalizer(myContext), out);
    } catch (IOException e) {
        throw new BuildDataCorruptedException(e);
    }
}
Also used : BuildDataCorruptedException(org.jetbrains.jps.builders.storage.BuildDataCorruptedException)

Example 12 with BuildDataCorruptedException

use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.

the class IntIntPersistentMultiMaplet method remove.

@Override
public void remove(final int key) {
    try {
        myCache.remove(key);
        myMap.remove(key);
    } catch (IOException e) {
        throw new BuildDataCorruptedException(e);
    }
}
Also used : BuildDataCorruptedException(org.jetbrains.jps.builders.storage.BuildDataCorruptedException)

Example 13 with BuildDataCorruptedException

use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.

the class Proto method save.

@Override
public void save(final DataOutput out) {
    try {
        DataInputOutputUtil.writeINT(out, access);
        DataInputOutputUtil.writeINT(out, signature);
        DataInputOutputUtil.writeINT(out, name);
        RW.save(annotations, out);
    } catch (IOException e) {
        throw new BuildDataCorruptedException(e);
    }
}
Also used : BuildDataCorruptedException(org.jetbrains.jps.builders.storage.BuildDataCorruptedException) IOException(java.io.IOException)

Example 14 with BuildDataCorruptedException

use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.

the class RW method save.

public static <X extends Savable> void save(final Collection<X> x, final DataOutput out) {
    try {
        final int size = x.size();
        DataInputOutputUtil.writeINT(out, size);
        for (X s : x) {
            s.save(out);
        }
    } catch (IOException e) {
        throw new BuildDataCorruptedException(e);
    }
}
Also used : BuildDataCorruptedException(org.jetbrains.jps.builders.storage.BuildDataCorruptedException)

Example 15 with BuildDataCorruptedException

use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.

the class JavaBuilder method doBuild.

public ExitCode doBuild(@NotNull CompileContext context, @NotNull ModuleChunk chunk, @NotNull DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder, @NotNull OutputConsumer outputConsumer, @NotNull JavaCompilingTool compilingTool) throws ProjectBuildException, IOException {
    try {
        final Set<File> filesToCompile = new THashSet<>(FileUtil.FILE_HASHING_STRATEGY);
        dirtyFilesHolder.processDirtyFiles(new FileProcessor<JavaSourceRootDescriptor, ModuleBuildTarget>() {

            @Override
            public boolean apply(ModuleBuildTarget target, File file, JavaSourceRootDescriptor descriptor) throws IOException {
                if (JAVA_SOURCES_FILTER.accept(file) && ourCompilableModuleTypes.contains(target.getModule().getModuleType())) {
                    filesToCompile.add(file);
                }
                return true;
            }
        });
        if ((!filesToCompile.isEmpty() || dirtyFilesHolder.hasRemovedFiles()) && JpsJavaSdkType.parseVersion(getLanguageLevel(ContainerUtil.getFirstItem(chunk.getModules()))) >= 9) {
            // at the moment, there is no incremental compilation for module-info files, so they should be rebuilt on every change
            JavaModuleIndex index = getJavaModuleIndex(context);
            for (JpsModule module : chunk.getModules()) {
                ContainerUtil.addIfNotNull(filesToCompile, index.getModuleInfoFile(module));
            }
        }
        if (JavaBuilderUtil.isCompileJavaIncrementally(context)) {
            ProjectBuilderLogger logger = context.getLoggingManager().getProjectBuilderLogger();
            if (logger.isEnabled() && !filesToCompile.isEmpty()) {
                logger.logCompiledFiles(filesToCompile, BUILDER_NAME, "Compiling files:");
            }
        }
        return compile(context, chunk, dirtyFilesHolder, filesToCompile, outputConsumer, compilingTool);
    } catch (BuildDataCorruptedException | PersistentEnumeratorBase.CorruptedException | ProjectBuildException e) {
        throw e;
    } catch (Exception e) {
        LOG.info(e);
        String message = e.getMessage();
        if (message == null) {
            final ByteArrayOutputStream out = new ByteArrayOutputStream();
            final PrintStream stream = new PrintStream(out);
            try {
                e.printStackTrace(stream);
            } finally {
                stream.close();
            }
            message = "Internal error: \n" + out;
        }
        context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, message));
        throw new StopBuildException();
    }
}
Also used : JavaModuleIndex(org.jetbrains.jps.model.java.JavaModuleIndex) CompilerMessage(org.jetbrains.jps.incremental.messages.CompilerMessage) THashSet(gnu.trove.THashSet) BuildDataCorruptedException(org.jetbrains.jps.builders.storage.BuildDataCorruptedException) JpsModule(org.jetbrains.jps.model.module.JpsModule) BuildDataCorruptedException(org.jetbrains.jps.builders.storage.BuildDataCorruptedException) ProjectBuilderLogger(org.jetbrains.jps.builders.logging.ProjectBuilderLogger) BuildDataCorruptedException(org.jetbrains.jps.builders.storage.BuildDataCorruptedException) JavaSourceRootDescriptor(org.jetbrains.jps.builders.java.JavaSourceRootDescriptor)

Aggregations

BuildDataCorruptedException (org.jetbrains.jps.builders.storage.BuildDataCorruptedException)26 IOException (java.io.IOException)8 PersistentHashMap (com.intellij.util.io.PersistentHashMap)4 File (java.io.File)4 THashSet (gnu.trove.THashSet)3 NotNull (org.jetbrains.annotations.NotNull)3 DataExternalizer (com.intellij.util.io.DataExternalizer)2 DataInputOutputUtil (com.intellij.util.io.DataInputOutputUtil)2 java.io (java.io)2 CompilerMessage (org.jetbrains.jps.incremental.messages.CompilerMessage)2 ProgressMessage (org.jetbrains.jps.incremental.messages.ProgressMessage)2 JpsModule (org.jetbrains.jps.model.module.JpsModule)2 AtomicNotNullLazyValue (com.intellij.openapi.util.AtomicNotNullLazyValue)1 Pair (com.intellij.openapi.util.Pair)1 Ref (com.intellij.openapi.util.Ref)1 Processor (com.intellij.util.Processor)1 MultiMap (com.intellij.util.containers.MultiMap)1 SLRUCache (com.intellij.util.containers.SLRUCache)1 KeyDescriptor (com.intellij.util.io.KeyDescriptor)1 MappingFailedException (com.intellij.util.io.MappingFailedException)1