Vertispan / j2clmavenplugin

Maven plugin to launch new J2CL compilation
https://vertispan.github.io/j2clmavenplugin/
Apache License 2.0
53 stars 26 forks source link

0.19-SNAPSHOT (kogito-cleanup) crashed with RuntimeException while running J2CL on BUNDLE Mode #110

Closed treblereel closed 2 years ago

treblereel commented 2 years ago

It's not possible to run or build j2cl app (reactor or simple app) using BUNDLE mode.

in ADVANCED mode it works as expected.

INFO] Starting org.treblereel:j2cl-tests:1.0-SNAPSHOT/optimized_js
java.io.FileNotFoundException: /Users/treblereel/workspace/j2cl/j2cl-tests/target/gwt3BuildCache/0.19-SNAPSHOT/org.treblereel-j2cl-tests-1.0-SNAPSHOT/4580de8955ee77b23b773cb5abafdaef-optimized_js/results/j2cl-tests/j2cl-tests.js (No such file or directory)
        at java.base/java.io.FileOutputStream.open0(Native Method)
        at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:126)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.filenameToOutputStream(AbstractCommandLineRunner.java:1935)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.fileNameToOutputWriter2(AbstractCommandLineRunner.java:1926)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.outputManifestOrBundle(AbstractCommandLineRunner.java:2195)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.outputBundle(AbstractCommandLineRunner.java:2153)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.processResults(AbstractCommandLineRunner.java:1565)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.doRun(AbstractCommandLineRunner.java:1324)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.run(AbstractCommandLineRunner.java:535)
        at com.vertispan.j2cl.tools.Closure.compile(Closure.java:183)
        at com.vertispan.j2cl.build.provided.ClosureTask$2.execute(ClosureTask.java:134)
        at com.vertispan.j2cl.build.TaskScheduler$2.executeTask(TaskScheduler.java:172)
        at com.vertispan.j2cl.build.TaskScheduler$2.lambda$onReady$0(TaskScheduler.java:211)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
[ERROR] Exception executing task org.treblereel:j2cl-tests:1.0-SNAPSHOT/optimized_js
java.lang.IllegalStateException: Closure Compiler failed, check log for details
    at com.vertispan.j2cl.build.provided.ClosureTask$2.execute (ClosureTask.java:154)
    at com.vertispan.j2cl.build.TaskScheduler$2.executeTask (TaskScheduler.java:172)
    at com.vertispan.j2cl.build.TaskScheduler$2.lambda$onReady$0 (TaskScheduler.java:211)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:304)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:829)
java.lang.RuntimeException
        at com.vertispan.j2cl.build.DiskCache.markFailed(DiskCache.java:452)
        at com.vertispan.j2cl.build.DiskCache$CacheResult.markFailure(DiskCache.java:54)
        at com.vertispan.j2cl.build.TaskScheduler$2.executeTask(TaskScheduler.java:181)
        at com.vertispan.j2cl.build.TaskScheduler$2.lambda$onReady$0(TaskScheduler.java:211)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at java.base/java.ut

it can be reproduced by kogito-editors-java or https://github.com/treblereel/j2cl-tests

niloc132 commented 2 years ago

Specifically the bug is that BUNDLE in the closure compiler takes enough of a different path that other compilation levels get their output directory created automatically within closure-compiler, but bundle doesn't.

This is exacerbated by the fact that while our closure-compiler fork is capable of producing builds that can handle source maps, those sourcemaps have to be relative to the html host page's location, not the js file, so is makes more sense to override initialScriptFilename to specify that the file should be generated in the root of the build dir, not in its own directory, so most tests of BUNDLE don't expose this bug.