use of com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources in project intellij by bazelbuild.
the class FastBuildChangedFilesServiceTest method unknownFilesAreIgnored_modifiedBeforeCompilationFinishes.
@Test
public void unknownFilesAreIgnored_modifiedBeforeCompilationFinishes() {
SettableFuture<BuildOutput> buildOutput = SettableFuture.create();
changedFilesService.newBuild(Label.create("//java:all_files"), buildOutput);
workspace.createFile(WorkspacePath.createIfValid("One.java"));
workspace.createFile(WorkspacePath.createIfValid("Three.java"));
buildOutput.set(BuildOutput.create(new File("deploy.jar"), ImmutableMap.of(Label.create("//java:all_files"), sources("One.java", "Two.java").build()), BLAZE_INFO));
ChangedSources changedSources = changedFilesService.getAndResetChangedSources(Label.create("//java:all_files"));
assertThat(changedSources.needsFullCompile()).isFalse();
assertThat(changedSources.changedSources()).containsExactly(artifactLocationDecoder.decode(source("One.java")));
}
use of com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources in project intellij by bazelbuild.
the class FastBuildChangedFilesServiceTest method graphOfLabels.
@Test
public void graphOfLabels() {
// A--> B -> D
// \
// \-> C -> B -> D
BuildOutput buildOutput = BuildOutput.create(new File("deploy.jar"), ImmutableMap.of(Label.create("//a:a"), sources("a.java").setDependencies(deps("//b:b", "//c:c")).build(), Label.create("//b:b"), sources("b.java").setDependencies(deps("//d:d")).build(), Label.create("//c:c"), sources("c.java").setDependencies(deps("//b:b")).build(), Label.create("//d:d"), sources("d.java").build()), BLAZE_INFO);
changedFilesService.newBuild(Label.create("//a:a"), Futures.immediateFuture(buildOutput));
workspace.createFile(WorkspacePath.createIfValid("d.java"));
ChangedSources changedSources = changedFilesService.getAndResetChangedSources(Label.create("//a:a"));
assertThat(changedSources.needsFullCompile()).isFalse();
assertThat(changedSources.changedSources()).containsExactly(artifactLocationDecoder.decode(source("d.java")));
}
use of com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources in project intellij by bazelbuild.
the class FastBuildChangedFilesServiceTest method suggestsRecompilation_modifiedBeforeCompilationFinishes.
@Test
public void suggestsRecompilation_modifiedBeforeCompilationFinishes() {
SettableFuture<BuildOutput> buildOutput = SettableFuture.create();
changedFilesService.newBuild(Label.create("//java:all_files"), buildOutput);
String[] filenames = new String[FastBuildChangedFilesService.MAX_FILES_TO_COLLECT + 1];
Arrays.setAll(filenames, i -> "File" + i + ".java");
Arrays.stream(filenames).map(WorkspacePath::createIfValid).forEach(workspace::createFile);
buildOutput.set(BuildOutput.create(new File("deploy.jar"), ImmutableMap.of(Label.create("//java:all_files"), sources(filenames).build()), BLAZE_INFO));
ChangedSources changedSources = changedFilesService.getAndResetChangedSources(Label.create("//java:all_files"));
assertThat(changedSources.needsFullCompile()).isTrue();
}
use of com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources in project intellij by bazelbuild.
the class FastBuildChangedFilesServiceTest method unknownFilesAreIgnored.
@Test
public void unknownFilesAreIgnored() {
changedFilesService.newBuild(Label.create("//java:all_files"), Futures.immediateFuture(BuildOutput.create(new File("deploy.jar"), ImmutableMap.of(Label.create("//java:all_files"), sources("One.java", "Two.java").build()), BLAZE_INFO)));
workspace.createFile(WorkspacePath.createIfValid("One.java"));
workspace.createFile(WorkspacePath.createIfValid("Three.java"));
ChangedSources changedSources = changedFilesService.getAndResetChangedSources(Label.create("//java:all_files"));
assertThat(changedSources.needsFullCompile()).isFalse();
assertThat(changedSources.changedSources()).containsExactly(artifactLocationDecoder.decode(source("One.java")));
}
use of com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources in project intellij by bazelbuild.
the class FastBuildChangedFilesServiceTest method successfulBuildWithNoSources.
@Test
public void successfulBuildWithNoSources() {
changedFilesService.newBuild(Label.create("//java:all_files"), Futures.immediateFuture(BuildOutput.create(new File("deploy.jar"), /* blazeData= */
ImmutableMap.of(), BLAZE_INFO)));
ChangedSources changedSources = changedFilesService.getAndResetChangedSources(Label.create("//java:all_files"));
assertThat(changedSources.needsFullCompile()).isFalse();
assertThat(changedSources.changedSources()).isEmpty();
}
Aggregations