cd examples/crossbuild/3_select
bazel build //3_select:bin2
This produces:
INFO: Invocation ID: 6bdd906c-b4f3-4c6e-9bf6-f9ace6cba6e8
INFO: Analyzed target //3_select:bin2 (1 packages loaded, 4 targets configured).
ERROR: /home/user/opt/rules_scala/examples/crossbuild/3_select/BUILD:21:13: scala @@//3_select:bin2 failed: (Exit 1): scalac failed: error executing Scalac command (from target //3_select:bin2) bazel-out/k8-opt-exec-ST-1e9cf9510058/bin/external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/scalac/scalac @bazel-out/k8-fastbuild-ST-9386492f403d/bin/3_select/bin2.jar-0.params
scalac error: bad option: '-Ywarn-unused-import'
scalac -help gives more information
null
java.lang.NullPointerException
at io.bazel.rulesscala.scalac.ScalacInvoker.invokeCompiler(ScalacInvoker.java:53)
at io.bazel.rulesscala.scalac.ScalacWorker.compileScalaSources(ScalacWorker.java:257)
at io.bazel.rulesscala.scalac.ScalacWorker.work(ScalacWorker.java:73)
at io.bazel.rulesscala.worker.Worker.persistentWorkerMain(Worker.java:86)
at io.bazel.rulesscala.worker.Worker.workerMain(Worker.java:39)
at io.bazel.rulesscala.scalac.ScalacWorker.main(ScalacWorker.java:33)
Target //3_select:bin2 failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.435s, Critical Path: 0.04s
INFO: 2 processes: 2 internal.
In my own project I have seen:
ERROR: /home/user/myprojest/mypackage/BUILD:42:20: scala @//myprojest/mypackage:library failed: (Exit 1): scalac failed: error executing Scalac command (from target //myprojest/mypackage:library) bazel-out/k8-opt-exec-ST-bb79e0899c0a/bin/external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/scalac/scalac '--jvm_flag=-Djava.security.manager=allow' ... (remaining 1 argument skipped)
scalac error: bad option: '-Ywarn-unused-import'
scalac -help gives more information
Cannot invoke "scala.tools.nsc.reporters.ConsoleReporter.hasErrors()" because "reporter" is null
java.lang.NullPointerException: Cannot invoke "scala.tools.nsc.reporters.ConsoleReporter.hasErrors()" because "reporter" is null
at io.bazel.rulesscala.scalac.ScalacInvoker.invokeCompiler(ScalacInvoker.java:53)
at io.bazel.rulesscala.scalac.ScalacWorker.compileScalaSources(ScalacWorker.java:257)
at io.bazel.rulesscala.scalac.ScalacWorker.work(ScalacWorker.java:73)
at io.bazel.rulesscala.worker.Worker.persistentWorkerMain(Worker.java:86)
at io.bazel.rulesscala.worker.Worker.workerMain(Worker.java:39)
at io.bazel.rulesscala.scalac.ScalacWorker.main(ScalacWorker.java:33)
I suppose there may be a bug in the error handling for compiler errors.
Detecting errors for cross compilation is somehow broken, and produces an additional Null Pointer Exception.
How to reproduce:
Apply this patch in latest rules_scala code:
Then run:
This produces:
In my own project I have seen:
I suppose there may be a bug in the error handling for compiler errors.