Skip to content

Commit

Permalink
Ensure native rules find maven_project_jar in runfiles
Browse files Browse the repository at this point in the history
Due to bazelbuild/bazel#15043, Bazel's native
rule such as `sh_test` do not pick up `files` in `DefaultInfo` for a
target in `data`. This can lead to the unexplicable absence of the jar
generated by `maven_project_jar` and hence `java_export` from runfiles.

Until the upstream bug has been fixed, this is worked around by adding
the files to `data_runfiles`.
  • Loading branch information
fmeum committed Oct 19, 2022
1 parent 762f94d commit 1fb2f42
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion private/rules/maven_project_jar.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ def _maven_project_jar_impl(ctx):
)

return [
DefaultInfo(files = depset([bin_jar])),
DefaultInfo(
files = depset([bin_jar]),
# Workaround for https://github.com/bazelbuild/bazel/issues/15043
# Bazel's native rule such as sh_test do not pick up 'files' in
# DefaultInfo for a target in 'data'.
data_runfiles = ctx.runfiles([bin_jar]),
),
OutputGroupInfo(
maven_artifact = [bin_jar],
maven_source = [src_jar],
Expand Down

0 comments on commit 1fb2f42

Please sign in to comment.