X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=src%2Forg%2Fargeo%2Fbuild%2FRepackage.java;h=e9f8a3370f26890521d01c5ad4ec84d0833390ae;hb=ab9cf16f6754c2081eabc55abfbbc1b49740647e;hp=780fddfea6806f025a2042cd91a9e1efa59d6158;hpb=2f4f807eebea43cf2bae6d0d82ec46d79effd7fe;p=cc0%2Fargeo-build.git diff --git a/src/org/argeo/build/Repackage.java b/src/org/argeo/build/Repackage.java index 780fddf..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()); } }