X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=src%2Forg%2Fargeo%2Fbuild%2FMake.java;h=b83404da7f63928b2069aefe26bfe400bb49a88e;hb=04817ca3935c1b29871137dd6b84352c0ad27bae;hp=5a5fd64d424639ae4036b5205a9d895c6e53df1d;hpb=dd7d34930a31c4b72a4f397a9bcb6a3468af6c52;p=cc0%2Fargeo-build.git diff --git a/src/org/argeo/build/Make.java b/src/org/argeo/build/Make.java index 5a5fd64..b83404d 100644 --- a/src/org/argeo/build/Make.java +++ b/src/org/argeo/build/Make.java @@ -184,8 +184,8 @@ public class Make { if (!Files.exists(a2Dir)) continue categories; // modulePath.add(a2Dir.toString()); - for (Path jarP : Files.newDirectoryStream(a2Dir, - (p) -> p.getFileName().toString().endsWith(".jar"))) { + for (Path jarP : Files.newDirectoryStream(a2Dir, (p) -> p.getFileName().toString().endsWith(".jar") + && !p.getFileName().toString().endsWith(".src.jar"))) { A2Jar a2Jar = new A2Jar(jarP); if (a2Jars.containsKey(a2Jar.name)) { A2Jar current = a2Jars.get(a2Jar.name); @@ -476,21 +476,15 @@ public class Make { for (Path p : sdkSrcLegal) toInclude.put(p.getFileName().toString(), p); } - DirectoryStream 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); + for (Iterator> entries = toInclude.entrySet().iterator(); entries.hasNext();) { + Map.Entry entry = entries.next(); + Path inBundle = bundleBase.resolve(entry.getValue().getFileName()); + // remove file if it is also defined at bundle level + // since it has already been copied + // and has priority + if (Files.exists(inBundle)) + entries.remove(); + } return toInclude; } @@ -590,6 +584,7 @@ public class Make { } } + /** A jar file in A2 format */ static class A2Jar { final Path path; final String name; @@ -597,13 +592,17 @@ public class Make { final int minor; A2Jar(Path path) { - this.path = path; - String fileName = path.getFileName().toString(); - fileName = fileName.substring(0, fileName.lastIndexOf('.')); - minor = Integer.parseInt(fileName.substring(fileName.lastIndexOf('.') + 1)); - fileName = fileName.substring(0, fileName.lastIndexOf('.')); - major = Integer.parseInt(fileName.substring(fileName.lastIndexOf('.') + 1)); - name = fileName.substring(0, fileName.lastIndexOf('.')); + try { + this.path = path; + String fileName = path.getFileName().toString(); + fileName = fileName.substring(0, fileName.lastIndexOf('.')); + minor = Integer.parseInt(fileName.substring(fileName.lastIndexOf('.') + 1)); + fileName = fileName.substring(0, fileName.lastIndexOf('.')); + major = Integer.parseInt(fileName.substring(fileName.lastIndexOf('.') + 1)); + name = fileName.substring(0, fileName.lastIndexOf('.')); + } catch (Exception e) { + throw new IllegalArgumentException("Badly formatted A2 jar " + path, e); + } } }