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
We can build Haskell binaries that use inline-java. However, initializing the JVM in these programs requires specifying the paths to all the jar files that are needed by the Java part of the program.
Currently, inline-java achieves this by making a fat jar of the java dependencies as in
let jarPath =Runfiles.rlocation r "io_tweag_inline_java/benchmarks/wizzardo-http/jar_deploy.jar"
cpArg ="-Djava.class.path="<> fromString jarPath
Fat jars, however, aren't always ideal, and there is some boilerplate to using these in BUILD files.
It would be nice defining a rule in inline-java to create script wrappers around binaries, which sets the classpath before calling the executable. Something like
haskell_binary(
name = "hello-hs"
deps = haskell_deps + some_java_deps,
...
)
classpath_wrapper(
name = "hello-hs-wrapper"
dep = ":hello-hs"
)
we can then run in the command line bazel-bin/hello-hs-wrapper.sh to execute the program with an environment variable like INLINE_JAVA_CLASSPATH=paths/to/jars/in/runfiles.
This should be implemented in bazel as part of the Java rule set. Any binary (written in any language) interacting with the jvm will have the same problem.
We can build Haskell binaries that use inline-java. However, initializing the JVM in these programs requires specifying the paths to all the jar files that are needed by the Java part of the program.
Currently, inline-java achieves this by making a fat jar of the java dependencies as in
inline-java/benchmarks/wizzardo-http/BUILD.bazel
Line 48 in 2d94d44
then we pass the path to the fat jar to the jvm as in
inline-java/benchmarks/wizzardo-http/src/main/haskell/Main.hs
Lines 35 to 36 in 2d94d44
Fat jars, however, aren't always ideal, and there is some boilerplate to using these in BUILD files.
It would be nice defining a rule in inline-java to create script wrappers around binaries, which sets the classpath before calling the executable. Something like
we can then run in the command line
bazel-bin/hello-hs-wrapper.sh
to execute the program with an environment variable likeINLINE_JAVA_CLASSPATH=paths/to/jars/in/runfiles
.tweag/rules_haskell#1483 would be blocking this feature, which otherwise could be implemented with transitive_runtime_jars.
The text was updated successfully, but these errors were encountered: