use of com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources in project intellij by bazelbuild.
the class FastBuildChangedFilesServiceTest method suggestsRecompilation.
@Test
public void suggestsRecompilation() {
String[] filenames = new String[FastBuildChangedFilesService.MAX_FILES_TO_COLLECT + 1];
Arrays.setAll(filenames, i -> "File" + i + ".java");
BuildOutput buildOutput = BuildOutput.create(new File("deploy.jar"), ImmutableMap.of(Label.create("//java:all_files"), sources(filenames).build()), BLAZE_INFO);
changedFilesService.newBuild(Label.create("//java:all_files"), Futures.immediateFuture(buildOutput));
Arrays.stream(filenames).map(WorkspacePath::createIfValid).forEach(workspace::createFile);
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 addFilesFromFailedCompilation.
@Test
public void addFilesFromFailedCompilation() {
changedFilesService.newBuild(Label.create("//java:all_files"), SettableFuture.create());
changedFilesService.addFilesFromFailedCompilation(Label.create("//java:all_files"), ImmutableSet.of(new File("/foo/bar.txt"), new File("/what/fun.txt")));
ChangedSources changedSources = changedFilesService.getAndResetChangedSources(Label.create("//java:all_files"));
assertThat(changedSources.needsFullCompile()).isFalse();
assertThat(changedSources.changedSources()).containsExactly(new File("/foo/bar.txt"), new File("/what/fun.txt"));
}
use of com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources in project intellij by bazelbuild.
the class FastBuildChangedFilesServiceTest method successfulBuildWithSingleModification.
@Test
public void successfulBuildWithSingleModification() {
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));
workspace.createFile(WorkspacePath.createIfValid("java/com/google/Hello.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")));
}
use of com.google.idea.blaze.java.fastbuild.FastBuildChangedFilesService.ChangedSources in project intellij by bazelbuild.
the class FastBuildChangedFilesServiceTest method getSourcesClearsModifiedList.
@Test
public void getSourcesClearsModifiedList() {
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));
workspace.createFile(WorkspacePath.createIfValid("java/com/google/Hello.java"));
changedFilesService.getAndResetChangedSources(Label.create("//java:all_files"));
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 successfulBuildWithModificationBeforeCompileFinishes.
@Test
public void successfulBuildWithModificationBeforeCompileFinishes() {
SettableFuture<BuildOutput> buildOutput = SettableFuture.create();
changedFilesService.newBuild(Label.create("//java:all_files"), buildOutput);
workspace.createFile(WorkspacePath.createIfValid("java/com/google/Hello.java"));
buildOutput.set(BuildOutput.create(new File("deploy.jar"), ImmutableMap.of(Label.create("//java:all_files"), sources("java/com/google/Hello.java").build()), BLAZE_INFO));
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")));
}
Aggregations