Search in sources :

Example 16 with ProjectDescriptor

use of org.jetbrains.jps.cmdline.ProjectDescriptor in project intellij-community by JetBrains.

the class ChainedTargetsBuildListener method filesGenerated.

@Override
public void filesGenerated(FileGeneratedEvent event) {
    final ProjectDescriptor pd = myContext.getProjectDescriptor();
    final BuildFSState fsState = pd.fsState;
    for (Pair<String, String> pair : event.getPaths()) {
        final String relativePath = pair.getSecond();
        final File file = relativePath.equals(".") ? new File(pair.getFirst()) : new File(pair.getFirst(), relativePath);
        for (BuildRootDescriptor desc : pd.getBuildRootIndex().findAllParentDescriptors(file, myContext)) {
            if (!event.getSourceTarget().equals(desc.getTarget())) {
                // It is assumed that those files will be explicitly marked dirty by particular builder, if needed.
                try {
                    fsState.markDirty(myContext, file, desc, pd.timestamps.getStorage(), false);
                } catch (IOException ignored) {
                }
            }
        }
    }
}
Also used : BuildFSState(org.jetbrains.jps.incremental.fs.BuildFSState) BuildRootDescriptor(org.jetbrains.jps.builders.BuildRootDescriptor) ProjectDescriptor(org.jetbrains.jps.cmdline.ProjectDescriptor) IOException(java.io.IOException) File(java.io.File)

Example 17 with ProjectDescriptor

use of org.jetbrains.jps.cmdline.ProjectDescriptor in project intellij-community by JetBrains.

the class FSOperations method markDirtyIfNotDeleted.

public static void markDirtyIfNotDeleted(CompileContext context, final CompilationRound round, final File file) throws IOException {
    final JavaSourceRootDescriptor rd = context.getProjectDescriptor().getBuildRootIndex().findJavaRootDescriptor(context, file);
    if (rd != null) {
        final ProjectDescriptor pd = context.getProjectDescriptor();
        pd.fsState.markDirtyIfNotDeleted(context, round, file, rd, pd.timestamps.getStorage());
    }
}
Also used : ProjectDescriptor(org.jetbrains.jps.cmdline.ProjectDescriptor) JavaSourceRootDescriptor(org.jetbrains.jps.builders.java.JavaSourceRootDescriptor)

Example 18 with ProjectDescriptor

use of org.jetbrains.jps.cmdline.ProjectDescriptor in project intellij-community by JetBrains.

the class IncrementalTestCase method doTestBuild.

protected BuildResult doTestBuild(int makesCount) {
    StringBuilder log = new StringBuilder();
    String rootPath = FileUtil.toSystemIndependentName(workDir.getAbsolutePath()) + "/";
    final ProjectDescriptor pd = createProjectDescriptor(new BuildLoggingManager(new StringProjectBuilderLogger(rootPath, log)));
    BuildResult result = null;
    try {
        doBuild(pd, CompileScopeTestBuilder.rebuild().allModules()).assertSuccessful();
        for (int idx = 0; idx < makesCount; idx++) {
            modify(idx);
            result = doBuild(pd, CompileScopeTestBuilder.make().allModules());
        }
        File logFile = new File(baseDir.getAbsolutePath() + ".log");
        if (!logFile.exists()) {
            logFile = new File(baseDir, "build.log");
        }
        assertSameLinesWithFile(logFile.getAbsolutePath(), log.toString());
    } finally {
        pd.release();
    }
    assertNotNull(result);
    if (result.isSuccessful()) {
        checkMappingsAreSameAfterRebuild(result);
    }
    return result;
}
Also used : BuildResult(org.jetbrains.jps.builders.BuildResult) ProjectDescriptor(org.jetbrains.jps.cmdline.ProjectDescriptor) BuildLoggingManager(org.jetbrains.jps.builders.logging.BuildLoggingManager) File(java.io.File)

Aggregations

ProjectDescriptor (org.jetbrains.jps.cmdline.ProjectDescriptor)18 IOException (java.io.IOException)6 BuildFSState (org.jetbrains.jps.incremental.fs.BuildFSState)6 File (java.io.File)5 JavaSourceRootDescriptor (org.jetbrains.jps.builders.java.JavaSourceRootDescriptor)4 THashSet (gnu.trove.THashSet)3 Timestamps (org.jetbrains.jps.incremental.storage.Timestamps)3 ModuleExcludeIndex (org.jetbrains.jps.indices.ModuleExcludeIndex)3 MultiMap (com.intellij.util.containers.MultiMap)2 BuildDataPathsImpl (org.jetbrains.jps.builders.impl.BuildDataPathsImpl)2 BuildRootIndexImpl (org.jetbrains.jps.builders.impl.BuildRootIndexImpl)2 BuildTargetIndexImpl (org.jetbrains.jps.builders.impl.BuildTargetIndexImpl)2 BuildTargetRegistryImpl (org.jetbrains.jps.builders.impl.BuildTargetRegistryImpl)2 BuildDataPaths (org.jetbrains.jps.builders.storage.BuildDataPaths)2 SourceToOutputMapping (org.jetbrains.jps.builders.storage.SourceToOutputMapping)2 CompilerMessage (org.jetbrains.jps.incremental.messages.CompilerMessage)2 ProgressMessage (org.jetbrains.jps.incremental.messages.ProgressMessage)2 BuildDataManager (org.jetbrains.jps.incremental.storage.BuildDataManager)2 BuildTargetsState (org.jetbrains.jps.incremental.storage.BuildTargetsState)2 ProjectTimestamps (org.jetbrains.jps.incremental.storage.ProjectTimestamps)2