Skip to content

Commit

Permalink
optimize for incremental building (spotbugs#2785)
Browse files Browse the repository at this point in the history
  • Loading branch information
appsecgaborgradle authored Dec 26, 2023
1 parent efd1174 commit 0987358
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 4 additions & 0 deletions eclipsePlugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -571,3 +571,7 @@ if (eclipseExecutable == null) {
spotbugs {
ignoreFailures = true
}

spotbugsMain {
release = rootProject.version
}
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ include(":test-harness")
include(":test-harness-core")
include(":test-harness-jupiter")

rootProject.name = "spotbugs"

gradleEnterprise {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class UnionResultsTest {
void testMain() throws IOException {
//Prepare
String fileName = createBugFile();
File outputFile = new File("src/test/resources/output.xml");
File outputFile = new File("build/tmp/test/unionresults/output.xml");
outputFile.getParentFile().mkdirs();

//Act
UnionResults.main(new String[] { "-withMessages", "-output", outputFile.getAbsolutePath(), fileName });
Expand All @@ -27,10 +28,6 @@ void testMain() throws IOException {
List<String> output = readOutPut(outputFile.getAbsolutePath());
Assertions.assertTrue(output.stream().anyMatch(line -> line.contains("(Lorg/test/TestClass;Ljava/util/List;)V")));
Assertions.assertTrue(output.stream().anyMatch(line -> line.contains("(Lorg/test/TestClass2;Ljava/util/List;)V")));

//Cleanup
Files.deleteIfExists(new File(fileName).toPath());
Files.deleteIfExists(outputFile.toPath());
}

private List<String> readOutPut(String absolutePath) throws IOException {
Expand All @@ -47,8 +44,8 @@ private List<String> readOutPut(String absolutePath) throws IOException {
private static String createBugFile() throws IOException {
Path tempFile = Files.createTempFile("spotbugs-test", ".txt");
String fileName = tempFile.toString();
File firstFile = new File("src/test/resources/firstFile.xml");
File secondFile = new File("src/test/resources/secondFile.xml");
File firstFile = new File("build/tmp/test/unionresults/firstFile.xml");
File secondFile = new File("build/tmp/test/unionresults/secondFile.xml");
Files.deleteIfExists(firstFile.toPath());
Files.deleteIfExists(secondFile.toPath());
firstFile.getParentFile().mkdirs();
Expand Down

0 comments on commit 0987358

Please sign in to comment.