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();
}
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")));
}
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());
}
}
Aggregations