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

Compatibility issue with bazel 6 #1302

Closed
parthea opened this issue Feb 8, 2023 · 1 comment · Fixed by #1303
Closed

Compatibility issue with bazel 6 #1302

parthea opened this issue Feb 8, 2023 · 1 comment · Fixed by #1303
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@parthea
Copy link
Contributor

parthea commented Feb 8, 2023

Steps to reproduce

  1. Install Bazel 6 and confirm the version using bazel --version
partheniou@partheniou-vm-2:~/git$ bazel --version
bazel 6.0.0
  1. Bazel build fails to build java targets
Repository rule http_archive defined at:
 /usr/local/google/home/partheniou/.cache/bazel/_bazel_partheniou/9063cec94a6a99d93035235cd3e5a885/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in <toplevel>
ERROR: /usr/local/google/home/partheniou/.cache/bazel/_bazel_partheniou/9063cec94a6a99d93035235cd3e5a885/external/gapic_generator_java/rules_java_gapic/BUILD.bazel:7:8: @gapic_generator_java//rules_java_gapic:gradlew: no such attribute 'extension' in '_real_pkg_tar' rule
ERROR: /usr/local/google/home/partheniou/.cache/bazel/_bazel_partheniou/9063cec94a6a99d93035235cd3e5a885/external/gapic_generator_java/rules_java_gapic/BUILD.bazel:7:8: @gapic_generator_java//rules_java_gapic:gradlew: no such attribute 'files' in '_real_pkg_tar' rule
ERROR: /usr/local/google/home/partheniou/.cache/bazel/_bazel_partheniou/9063cec94a6a99d93035235cd3e5a885/external/gapic_generator_java/rules_java_gapic/BUILD.bazel:7:8: @gapic_generator_java//rules_java_gapic:gradlew: no such attribute 'mode' in '_real_pkg_tar' rule
ERROR: /usr/local/google/home/partheniou/.cache/bazel/_bazel_partheniou/9063cec94a6a99d93035235cd3e5a885/external/gapic_generator_java/rules_java_gapic/BUILD.bazel:7:8: @gapic_generator_java//rules_java_gapic:gradlew: no such attribute 'modes' in '_real_pkg_tar' rule
ERROR: /usr/local/google/home/partheniou/git/googleapis/google/cloud/dataqna/v1alpha/BUILD.bazel:99:31: Target '@gapic_generator_java//rules_java_gapic:gradlew' contains an error and its package is in error and referenced by '//google/cloud/dataqna/v1alpha:google-cloud-dataqna-v1alpha-java'
ERROR: Analysis of target '//google/cloud/dataqna/v1alpha:google-cloud-dataqna-v1alpha-java' failed; build aborted: Analysis failed

If I downgrade to bazel 5.2.0 the targets build successfully. The issue is that rules_gapic_java depends on pkg_tar which was removed in bazel 6.0.0. See packaging section in release notes here. There is a note that says users should migrate to @rules_pkg.

We should change this line from
https://github.com/googleapis/gapic-generator-java/blob/d1a16195937df041f65a52717ddf9dc6ceb09b4f/rules_java_gapic/BUILD.bazel#L1
to

load("@rules_pkg//pkg:pkg.bzl", "pkg_tar")

I tested the above change locally and the build succeeded with bazel 6.0.0.

@parthea parthea added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Feb 8, 2023
@Vinccool96
Copy link

That's what I said in #1296 but didn't dig into why

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants