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
I couldn't get the following to work on my Ubuntu box even though it worked flawlessly on OS X. The generated jar files would turn up empty. Looking at the commands executed (using -s) I noticed the unzip command. On a hunch I checked unzip, and it turns out it wasn't installed. Installing it fixed the issue.
unzip fails silently (since it has it's stderr redirected, and it's not the last command executed to in the end the exit code looks OK from Bazel's perspective), so the directory ultimately used to build the jar in the end is empty. Thus the jar turns out empty.
In fact, bash based scripts are kind of discouraged for this reason. I don't know how to change the way bazel executes the script, but the && patch could be a quick fix.
A better approach might be to just write some java code that does this part of the rule, and then bazel can build the tooling as part of the whole build. That may be the ideal for portability.
Also note that bazel comes with jar since it depends on jdk, and you can access that one with @bazel_tools//jdk:jar or something, so we can also just switch to using that.
Without too much context https://bazel.build/versions/master/docs/be/pkg.html may come in handy here. Ive actually hit this problem with some custom rules that used zip in a docker container that didnt have zip installed
Hello!
I couldn't get the following to work on my Ubuntu box even though it worked flawlessly on OS X. The generated jar files would turn up empty. Looking at the commands executed (using
-s
) I noticed theunzip
command. On a hunch I checkedunzip
, and it turns out it wasn't installed. Installing it fixed the issue.unzip
fails silently (since it has it's stderr redirected, and it's not the last command executed to in the end the exit code looks OK from Bazel's perspective), so the directory ultimately used to build the jar in the end is empty. Thus the jar turns out empty.https://github.com/bazelbuild/rules_scala/blob/master/thrift/thrift.bzl#L55
I don't have a PR since I'm not really sure where the fix should be applied:
bash -ce
instead ofbash -e
?thrift.bzl
adding&&
at the end of each command?The text was updated successfully, but these errors were encountered: