We would welcome a PR! This functionality is not as well tested as it could
be, as you see (we don't use any mixed targets at Stripe).
Thanks for reporting the issue.
On Thu, Nov 17, 2016 at 04:59 Guardian Sentinel [email protected]
wrote:
Hey Guys,
I've been trying to use scala_library to compile a mixture of both scala
and java files. It seems the java file compilation fails when there are
multiple java files. Up on looking at the error, it seems that the javac
command that we invoke is taking the list of files as a single string block
instead of taking it as a separate files. Below is the error that im
getting while invoking javac
javac: file not found: infra/BetterOutput.java infra/Changeset.java infra/CompilationException.java
Usage: javac
use -help for a list of possible options
Exception in thread "main" java.lang.RuntimeException: nope
at io.bazel.rulesscala.scalac.ScalaCInvoker.main(ScalaCInvoker.java:345)
Caused by: java.lang.RuntimeException: javac process failed!
at io.bazel.rulesscala.scalac.ScalaCInvoker.compileJavaSources(ScalaCInvoker.java:303)
at io.bazel.rulesscala.scalac.ScalaCInvoker.processRequest(ScalaCInvoker.java:238)
at io.bazel.rulesscala.scalac.ScalaCInvoker.main(ScalaCInvoker.java:341)
Target //infrastructure:infra-scala failed to build
Simplest fix was to append the file names directly to the command and that
seems to be working fine
diff --git a/src/java/io/bazel/rulesscala/scalac/ScalaCInvoker.java b/src/java/io/bazel/rulesscala/scalac/ScalaCInvoker.java
index 4c64c2c..4208123 100644
--- a/src/java/io/bazel/rulesscala/scalac/ScalaCInvoker.java
+++ b/src/java/io/bazel/rulesscala/scalac/ScalaCInvoker.java
@@ -281,19 +281,13 @@ public class ScalaCInvoker {
commandParts.add(ops.javacOpts);
}
Thanks, will sent a PR as soon as get my machine 👍, the tests didnt noticed this because our MixJavaScalaLib scala_library rule was had only 1 Java file. Adding multiple java files will throw the similar error :), will fix it in PR
from rules_scala.