Skip to content

Commit

Permalink
fix closing
Browse files Browse the repository at this point in the history
  • Loading branch information
ebarboni committed Jun 16, 2022
1 parent 158f58d commit 3bb76f7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import java.util.Comparator;
import java.util.Set;
import java.util.TreeSet;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;

Expand All @@ -50,7 +50,8 @@ public void setNball(File nball) {
private File mavenfolderFile;

/**
* JUnit-format XML result file to generate, rather than halting the build.
* Folder to put the skeleton project in.
* @param report
*/
public void setMavenFolder(File report) {
this.mavenfolderFile = report;
Expand All @@ -66,13 +67,15 @@ void execute() throws BuildException {
modules.add("nbbuild");
} else {
Path nbAllPath = nball.toPath();
modules = new TreeSet<>(
Files.walk(nbAllPath)
.filter(p -> Files.exists(p.resolve("external/binaries-list")))
.map(p -> nbAllPath.relativize(p))
.map(p -> p.toString())
.collect(Collectors.toSet())
);
modules = new TreeSet<>();
try ( Stream<Path> walk = Files.walk(nbAllPath)) {
modules = new TreeSet<>(
walk.filter(p -> Files.exists(p.resolve("external/binaries-list")))
.map(p -> nbAllPath.relativize(p))
.map(p -> p.toString())
.collect(Collectors.toSet())
);
}
}
try {
buildLibPomForMaven();
Expand All @@ -89,7 +92,9 @@ void execute() throws BuildException {
private void buildLibPomForMaven() throws IOException {
Path pseudoMaven = mavenfolderFile.toPath();
if (Files.exists(pseudoMaven)) {
Files.walk(pseudoMaven).sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
try ( Stream<Path> walk = Files.walk(pseudoMaven)) {
walk.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
}
}
Path pseudoMavendirectory = Files.createDirectory(pseudoMaven);
Path parentPom = Files.createFile(pseudoMavendirectory.resolve("pom.xml"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.CRC32;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
Expand Down Expand Up @@ -94,13 +95,15 @@ public void setHaltonfailure(boolean haltonfailure) {
modules.add("nbbuild");
} else {
Path nbAllPath = nball.toPath();
modules = new TreeSet<>(
Files.walk(nbAllPath)
.filter(p -> Files.exists(p.resolve("external/binaries-list")))
.map(p -> nbAllPath.relativize(p))
.map(p -> p.toString())
.collect(Collectors.toSet())
);
modules = new TreeSet<>();
try ( Stream<Path> walk = Files.walk(nbAllPath)) {
modules = new TreeSet<>(
walk.filter(p -> Files.exists(p.resolve("external/binaries-list")))
.map(p -> nbAllPath.relativize(p))
.map(p -> p.toString())
.collect(Collectors.toSet())
);
}
}
try {
testNoStrayThirdPartyBinaries();
Expand Down Expand Up @@ -426,11 +429,13 @@ private void testLicenses() throws IOException {

private void testLicenseinfo() throws IOException {
Path nballPath = nball.toPath();
List<File> licenseinfofiles = Files.walk(nballPath)
.filter(p -> p.endsWith("licenseinfo.xml"))
.map(p -> p.toFile())
.collect(Collectors.toList());

List<File> licenseinfofiles = new ArrayList<>();
try ( Stream<Path> walk = Files.walk(nballPath)) {
licenseinfofiles = walk
.filter(p -> p.endsWith("licenseinfo.xml"))
.map(p -> p.toFile())
.collect(Collectors.toList());
}
File licenses = new File(new File(nball, "nbbuild"), "licenses");
StringBuilder msg = new StringBuilder();

Expand Down

0 comments on commit 3bb76f7

Please sign in to comment.