X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=src%2Forg%2Fargeo%2Fbuild%2FRepackage.java;h=e9f8a3370f26890521d01c5ad4ec84d0833390ae;hb=ab9cf16f6754c2081eabc55abfbbc1b49740647e;hp=97d8fdc20f68653de5690fa0525f0052f654d07f;hpb=270e52295bb7548b4fecb8963b4ee52c38d2ba9e;p=cc0%2Fargeo-build.git diff --git a/src/org/argeo/build/Repackage.java b/src/org/argeo/build/Repackage.java index 97d8fdc..e9f8a33 100644 --- a/src/org/argeo/build/Repackage.java +++ b/src/org/argeo/build/Repackage.java @@ -76,12 +76,16 @@ public class Repackage { * integrated in the bundles. */ final static String ENV_SOURCE_BUNDLES = "SOURCE_BUNDLES"; + /** Environment variable on whether operations should be parallelised. */ + final static String ENV_ARGEO_BUILD_SEQUENTIAL = "ARGEO_BUILD_SEQUENTIAL"; - /** Whether repackaging should run in parallel or sequentially. */ - final static boolean parallel = true; + /** Whether repackaging should run in parallel (default) or sequentially. */ + final static boolean sequential = Boolean.parseBoolean(System.getenv(ENV_ARGEO_BUILD_SEQUENTIAL)); /** Main entry point. */ public static void main(String[] args) { + if (sequential) + logger.log(INFO, "Build will be sequential"); if (args.length < 2) { System.err.println("Usage: ..."); System.exit(1); @@ -93,12 +97,13 @@ public class Repackage { List> toDos = new ArrayList<>(); for (int i = 1; i < args.length; i++) { Path p = Paths.get(args[i]); - if (parallel) - toDos.add(CompletableFuture.runAsync(() -> factory.processCategory(p))); - else + if (sequential) factory.processCategory(p); + else + toDos.add(CompletableFuture.runAsync(() -> factory.processCategory(p))); } - CompletableFuture.allOf(toDos.toArray(new CompletableFuture[toDos.size()])).join(); + if (!sequential) + CompletableFuture.allOf(toDos.toArray(new CompletableFuture[toDos.size()])).join(); // Summary StringBuilder sb = new StringBuilder(); @@ -1126,7 +1131,7 @@ public class Repackage { origin.deleted.add("MANIFEST header " + manifestEntry.getKey()); break; default: - if (!sourceManifest.getMainAttributes().containsKey(manifestEntry.getKey())) + if (sourceManifest != null && !sourceManifest.getMainAttributes().containsKey(manifestEntry.getKey())) origin.added.add("MANIFEST header " + manifestEntry.getKey()); } } @@ -1159,7 +1164,7 @@ public class Repackage { if (bundleDir.getFileName().startsWith("org.apache.")) spdxLicenceId = "Apache-2.0"; - manifest.getMainAttributes().put(SPDX_LICENSE_IDENTIFIER.toString(), spdxLicenceId); + manifest.getMainAttributes().putValue(SPDX_LICENSE_IDENTIFIER.toString(), spdxLicenceId); if (!licensesUsed.containsKey(spdxLicenceId)) licensesUsed.put(spdxLicenceId, new TreeSet<>()); licensesUsed.get(spdxLicenceId).add(bundleDir.getParent().getFileName() + "/" + bundleDir.getFileName());