Search in sources :

Example 11 with ChangedSources

use of com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources in project intellij by bazelbuild.

the class FastBuildChangedFilesServiceTest method successfulBuildWithNoModifications.

@Test
public void successfulBuildWithNoModifications() {
    BuildOutput buildOutput = BuildOutput.create(new File("deploy.jar"), ImmutableMap.of(Label.create("//java:all_files"), sources("java/com/google/Hello.java").build()), BLAZE_INFO);
    changedFilesService.newBuild(Label.create("//java:all_files"), Futures.immediateFuture(buildOutput));
    ChangedSources changedSources = changedFilesService.getAndResetChangedSources(Label.create("//java:all_files"));
    assertThat(changedSources.needsFullCompile()).isFalse();
    assertThat(changedSources.changedSources()).isEmpty();
}
Also used : BuildOutput(com.google.idea.blaze.java.fastbuild.FastBuildState.BuildOutput) ChangedSources(com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources) File(java.io.File) Test(org.junit.Test)

Example 12 with ChangedSources

use of com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources in project intellij by bazelbuild.

the class FastBuildChangedFilesServiceTest method returnsAllFilesOnUnfinishedBuild.

@Test
public void returnsAllFilesOnUnfinishedBuild() {
    changedFilesService.newBuild(Label.create("//java:all_files"), SettableFuture.create());
    workspace.createFile(WorkspacePath.createIfValid("java/com/google/Hello.java"));
    workspace.createFile(WorkspacePath.createIfValid("java/com/google/Goodbye.java"));
    ChangedSources changedSources = changedFilesService.getAndResetChangedSources(Label.create("//java:all_files"));
    assertThat(changedSources.needsFullCompile()).isFalse();
    assertThat(changedSources.changedSources()).containsExactly(artifactLocationDecoder.decode(source("java/com/google/Hello.java")), artifactLocationDecoder.decode(source("java/com/google/Goodbye.java")));
}
Also used : ChangedSources(com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources) Test(org.junit.Test)

Example 13 with ChangedSources

use of com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources in project intellij by bazelbuild.

the class FastBuildServiceImpl method updateBuild.

private FastBuildState updateBuild(BlazeContext context, Label label, FastBuildParameters buildParameters, @Nullable FastBuildState existingBuildState) {
    context.output(FastBuildLogOutput.keyValue("label", label.toString()));
    if (existingBuildState != null && !existingBuildState.newBuildOutput().isDone()) {
        // Don't start a new build if an existing one is still running.
        context.output(FastBuildLogOutput.keyValue("reused_existing_build_future", "true"));
        return existingBuildState;
    }
    BuildOutput completedBuildOutput = getCompletedBuild(existingBuildState);
    ChangedSources changedSources = ChangedSources.fullCompile();
    if (completedBuildOutput != null) {
        changedSources = changedFilesManager.getAndResetChangedSources(label);
    }
    if (changedSources.needsFullCompile()) {
        File compileDirectory = getCompilerOutputDirectory(existingBuildState);
        ListenableFuture<BuildOutput> newBuildOutput = buildDeployJarAsync(context, label, buildParameters);
        changedFilesManager.newBuild(label, newBuildOutput);
        return FastBuildState.create(newBuildOutput, compileDirectory, buildParameters);
    } else {
        existingBuildState = existingBuildState.withCompletedBuildOutput(completedBuildOutput);
        return performIncrementalCompilation(context, label, existingBuildState, changedSources.changedSources());
    }
}
Also used : BuildOutput(com.google.idea.blaze.java.fastbuild.FastBuildState.BuildOutput) ChangedSources(com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources) File(java.io.File)

Aggregations

ChangedSources (com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources)13 File (java.io.File)12 Test (org.junit.Test)12 BuildOutput (com.google.idea.blaze.java.fastbuild.FastBuildState.BuildOutput)9