+ /** List the relevant legal files to include, from the SDK source base. */
+ Map<String, Path> listLegalFilesToInclude(Path bundleBase) throws IOException {
+ Map<String, Path> toInclude = new HashMap<>();
+ DirectoryStream<Path> sdkSrcLegal = Files.newDirectoryStream(sdkSrcBase, (p) -> {
+ String fileName = p.getFileName().toString();
+ return switch (fileName) {
+ case "NOTICE":
+ case "LICENSE":
+ case "COPYING":
+ case "COPYING.LESSER":
+ yield true;
+ default:
+ yield false;
+ };
+ });
+ for (Path p : sdkSrcLegal)
+ toInclude.put(p.getFileName().toString(), p);
+ DirectoryStream<Path> bundleLegal = Files.newDirectoryStream(bundleBase, (p) -> {
+ String fileName = p.getFileName().toString();
+ return switch (fileName) {
+ case "NOTICE":
+ case "LICENSE":
+ case "COPYING":
+ case "COPYING.LESSER":
+ yield true;
+ default:
+ yield false;
+ };
+ });
+ // bundle can override
+ for (Path p : bundleLegal)
+ toInclude.put(p.getFileName().toString(), p);
+ return toInclude;
+ }
+
+ /*
+ * UTILITIES
+ */
+ /** Add sources to a jar file */