You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might be a bug with rules_closure, or with how j2cl's //jre/java:jre uses it, I'm not quite clear.
Describe the bug
Using closure_js_library emits several build rules to facilitate js libraries building and type checking in parallel. One of those rules emits a .i.js file, and another collects the .i.js files produced by dependencies and runs rules_closure's JsCompiler on them with --checks_only.
To Reproduce
Check out latest j2cl, currently 3ecf6f737b6eddab233644072b18025dbcfe8d16
Expected behavior
Type checks for trivial programs pass.
Actual behavior
INFO: Analyzed target //src/main/java/com/google/j2cl/samples/helloworld:app_typecheck (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/colin/workspace/j2cl/samples/helloworld/src/main/java/com/google/j2cl/samples/helloworld/BUILD:9:19: Doing library-level typechecking of //src/main/java/com/google/j2cl/samples/helloworld:app failed: (Exit 1): ClosureWorker failed: error executing command bazel-out/k8-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_closure/java/io/bazel/rules/closure/ClosureWorker JsCompiler --checks_only --warning_level VERBOSE --jscomp_off reportUnknownTypes ... (remaining 21 arguments skipped)
bazel-out/k8-fastbuild/bin/external/com_google_j2cl/jre/java/jre.i.js:10776: ERROR - A file cannot be both a goog.module and a script file that contains at least one goog.provide.
goog.provide("jre");
^
Codes: JSC_MIXED_MODULE_TYPE
bazel-out/k8-fastbuild/bin/external/com_google_j2cl/jre/java/jre.i.js:10781: ERROR - A file cannot be both a goog.module and a script file that contains at least one goog.provide.
goog.provide("jre.checks");
^
Codes: JSC_MIXED_MODULE_TYPE
bazel-out/k8-fastbuild/bin/external/com_google_j2cl/jre/java/jre.i.js:10794: ERROR - A file cannot be both a goog.module and a script file that contains at least one goog.provide.
goog.provide("jre.logging");
^
Codes: JSC_MIXED_MODULE_TYPE
3 error(s), 0 warning(s)
Target //src/main/java/com/google/j2cl/samples/helloworld:app_typecheck failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.942s, Critical Path: 1.77s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully
The issue appears to be that the ijs task emits code that fails checks for j2cl's //jre/java:jre target, as the jre output contains both goog.module and goog.provide declarations. It could be appropriate to split these into separate j2cl_library declarations (that might also make it possible for downstream projects to selectively replace certain java.* packages with their own implementations).
It also might be possible to add js_suppress args, but at first try JSC_MIXED_MODULE_TYPE isnt a valid suppression that can be provided.
Consider adding this task to the samples CI to validate output?
The text was updated successfully, but these errors were encountered:
This is a problem with rules_closure. I actually had a patch to fix it but ended up not sending it. Will resurrect the CL though I'm not sure if it fixes all the problems.
This might be a bug with
rules_closure
, or with how j2cl's//jre/java:jre
uses it, I'm not quite clear.Describe the bug
Using
closure_js_library
emits several build rules to facilitate js libraries building and type checking in parallel. One of those rules emits a.i.js
file, and another collects the.i.js
files produced by dependencies and runs rules_closure's JsCompiler on them with--checks_only
.To Reproduce
3ecf6f737b6eddab233644072b18025dbcfe8d16
cd samples/helloworld
Bazel version
Please include version of Bazel that you are running J2CL with:
Expected behavior
Type checks for trivial programs pass.
Actual behavior
The issue appears to be that the
ijs
task emits code that fails checks for j2cl's//jre/java:jre
target, as the jre output contains bothgoog.module
andgoog.provide
declarations. It could be appropriate to split these into separatej2cl_library
declarations (that might also make it possible for downstream projects to selectively replace certainjava.*
packages with their own implementations).It also might be possible to add
js_suppress
args, but at first tryJSC_MIXED_MODULE_TYPE
isnt a valid suppression that can be provided.Consider adding this task to the samples CI to validate output?
The text was updated successfully, but these errors were encountered: