Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output JAR is not hermetic #205

Closed
jpgxs opened this issue Oct 28, 2024 · 1 comment · Fixed by #206
Closed

Output JAR is not hermetic #205

jpgxs opened this issue Oct 28, 2024 · 1 comment · Fixed by #206

Comments

@jpgxs
Copy link
Contributor

jpgxs commented Oct 28, 2024

  • Bazel Version: 6.5.0
  • rules_spring Version: 2.3.2

Spring JARs produced by the springboot rule are not hermetic due to the build.target in build-data.properties, which has an absolute path:

build.target=/private/var/tmp/_bazel_jgriffiths/32484cc4b1bfa781e862ec83fd283f30/sandbox/darwin-sandbox/7418/execroot/my_workspace/bazel-out/darwin_arm64-fastbuild/bin/app.jar

I've compared this to the *_deploy.jar produced by java_binary which uses a relative path:

build.target=bazel-out/darwin_arm64-fastbuild/bin/app_deploy.jar
@jpgxs
Copy link
Contributor Author

jpgxs commented Oct 28, 2024

This is caused by the --output flag to the singlejar command:

--output $ruledir/$outputjar 2>&1 | tee -a $debugfile

This option is used verbatim here: https://github.com/bazelbuild/bazel/blob/2aa603bd77e5c41d546b6cd1a81e4bd5069b1149/src/tools/singlejar/output_jar.cc#L106

This is easily fixed by running the singlejar command from the rule's original working directory and passing in a relative path for --output.

I'll submit a PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants