# HG changeset patch # User Jaroslav Tulach # Date 1402310440 -7200 # Node ID f62b42f0b7517d6c016b9309143d37cfd684f0bc # Parent 7271b051b13cbfe8c950bf3acaa831a44fda099a Skip JS aot compilation, if the JS file already exists diff -r 7271b051b13c -r f62b42f0b751 rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AheadOfTime.java --- a/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AheadOfTime.java Mon Jun 09 09:40:32 2014 +0200 +++ b/rt/mojo/src/main/java/org/apidesign/bck2brwsr/mojo/AheadOfTime.java Mon Jun 09 12:40:40 2014 +0200 @@ -104,7 +104,12 @@ File aot = new File(prj.getBuild().getDirectory(), classPathPrefix); aot.mkdirs(); File js = new File(aot, n.substring(0, n.length() - 4) + ".js"); + if (js.exists()) { + getLog().info("Skipping " + js + " as it already exists."); + continue; + } try { + getLog().info("Generating " + js); aotLibrary(a, js , loader); } catch (IOException ex) { throw new MojoFailureException("Can't compile" + a.getFile(), ex); @@ -112,18 +117,23 @@ } try { - Bck2Brwsr c = Bck2BrwsrJars.configureFrom(null, mainJar); - if (exports != null) { - for (String e : exports) { - c = c.addExported(e.replace('.', '/')); + if (mainJavaScript.exists()) { + getLog().info("Skipping " + mainJavaScript + " as it already exists."); + } else { + getLog().info("Generating " + mainJavaScript); + Bck2Brwsr c = Bck2BrwsrJars.configureFrom(null, mainJar); + if (exports != null) { + for (String e : exports) { + c = c.addExported(e.replace('.', '/')); + } } + FileWriter w = new FileWriter(mainJavaScript); + c. + obfuscation(obfuscation). + resources(loader). + generate(w); + w.close(); } - FileWriter w = new FileWriter(mainJavaScript); - c. - obfuscation(obfuscation). - resources(loader). - generate(w); - w.close(); } catch (IOException ex) { throw new MojoFailureException("Cannot generate script for " + mainJar, ex); }