conan icon indicating copy to clipboard operation
conan copied to clipboard

Feature: Enable bazel >= 7.1

Open Neeeflix opened this issue 1 year ago • 6 comments

Feature: Add support for Bazel >= 7.1. This is also requested in #15754.

This will not break older bazel versions, as just some additional files are generated.

I added some of those file based test-cases, and did some "real" integration tests locally. If you know any better better way to put this into the conan test-environment, please let me know.

It's "only" supporting versions from 7.1 on, as there is a feature being used which is not available in 7.0. This is also documented in the code.

Docs: https://github.com/conan-io/docs/pull/3707 Example: https://github.com/conan-io/examples2/pull/147

  • [x] Refer to the issue that supports this Pull Request.
  • [x] If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • [x] I've read the Contributing guide.
  • [x] I've followed the PEP8 style guides for Python code.
  • [x] I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Neeeflix avatar May 03 '24 05:05 Neeeflix

@memsharded thanks for adding the milestone and looking into this. Would it also be possible to add a milestone for 1.X, as for us it will not be easy to go with 2.X in the near future.

Any work that needs to be done here, could be taken over by me. I think there are some smaller differences between the 1.X generator and the 2.X one

Neeeflix avatar May 03 '24 09:05 Neeeflix

Would it also be possible to add a milestone for 1.X, as for us it will not be easy to go with 2.X in the near future.

This is not something that we can keep doing much longer, for new features like this one we'd strongly favor Conan 2 only. It was released more than 14 months ago, ConanCenter will soon stop updating packages for Conan 1.X too. We strongly recommend to prioritize as much as possible the update to Conan 2.

In this case, if you'd like to get this in Conan 1, and you are willing to do the effort, then we might want to wait until we get @franramirez688 feedback about this. One of the aspects is that we should be 100% sure that it is not breaking Conan 1.X users, if there is any minimal risk (and I am a bit concerned about the proposed changes could no work for users using older versions of Bazel). @franramirez688 is more aware of the possible issues and efforts related to this.

memsharded avatar May 03 '24 09:05 memsharded

This is not something that we can keep doing much longer, for new features like this one we'd strongly favor Conan 2 only. It was released more than 14 months ago, ConanCenter will soon stop updating packages for Conan 1.X too. We strongly recommend to prioritize as much as possible the update to Conan 2.

I understand the urgency and importance of updating to Conan 2, especially with the upcoming discontinuation of updates for Conan 1.X. However, the process presents significant challenges, especially when depending on teams in different organizations, etc.

One of the aspects is that we should be 100% sure that it is not breaking Conan 1.X users,

As mentioned in the PR description, the files which are generated for the older bazel version are not touched. There are only two additional files being generated, there is no interference between those files at all.

Neeeflix avatar May 03 '24 10:05 Neeeflix

Hi @Neeeflix

Thanks a lot for this PR! 👏 I was trying to test it locally but I got stuck with this error:

INFO: Starting clean (this may take a while). Consider using --async if the clean takes more than several minutes.

hello/0.1: RUN: bazel --bazelrc=/Users/franchuti/.conan2/p/b/hellodfdcbdac82faa/b/conan/conan_bzl.rc build --config=conan-config //main:hello
WARNING: --enable_bzlmod is set, but no MODULE.bazel file was found at the workspace root. Bazel will create an empty MODULE.bazel file. Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel. For more details, please refer to https://github.com/bazelbuild/bazel/issues/18958.
ERROR: Error computing the main repository mapping: in module dependency chain <root> -> bazel_tools@_ -> [email protected]: Error accessing registry https://bcr.bazel.build/: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Computing main repo mapping:

hello/0.1: ERROR:
Package '015c501fa3ba2da21e4c2e71becb7b76fa605a36' build failed
hello/0.1: WARN: Build folder /Users/franchuti/.conan2/p/b/hellodfdcbdac82faa/b

I do not know how to solve this. I just tried a couple of things that I found here:

  • https://github.com/bazelbuild/bazel/issues/3915
  • https://stackoverflow.com/questions/66638072/how-to-import-certificate-to-keystore-on-mac-os
  • https://stackoverflow.com/questions/21076179/pkix-path-building-failed-and-unable-to-find-valid-certification-path-to-requ
  • https://stackoverflow.com/questions/6908948/java-sun-security-provider-certpath-suncertpathbuilderexception-unable-to-find

Nothing worked 😭 Do you know how I can get it running OK locally?

franramirez688 avatar May 07 '24 15:05 franramirez688

Hey @franramirez688, Thanks for looking into this

Regarding the your issue:

INFO: Starting clean (this may take a while). Consider using --async if the clean takes more than several minutes.

hello/0.1: RUN: bazel --bazelrc=/Users/franchuti/.conan2/p/b/hellodfdcbdac82faa/b/conan/conan_bzl.rc build --config=conan-config //main:hello
WARNING: --enable_bzlmod is set, but no MODULE.bazel file was found at the workspace root. Bazel will create an empty MODULE.bazel file. Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel. For more details, please refer to https://github.com/bazelbuild/bazel/issues/18958.
ERROR: Error computing the main repository mapping: in module dependency chain <root> -> bazel_tools@_ -> [email protected]: Error accessing registry https://bcr.bazel.build/: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Computing main repo mapping:

hello/0.1: ERROR:
Package '015c501fa3ba2da21e4c2e71becb7b76fa605a36' build failed
hello/0.1: WARN: Build folder /Users/franchuti/.conan2/p/b/hellodfdcbdac82faa/b

Can you may give some more details about your setup. Which example did you use? I also updated the example in: https://github.com/conan-io/examples2/pull/147, can you try that? Also noticed that I only tested there for conan 1.X. Updated it, now also conan 2.X works for me.

Reproduction steps:

  1. Install conan from this branch
  2. CD to the example repo and checkout my branch.
  3. In examples/tools/google/bazel_7.1/testsuite I run conan build . -of conan
  4. image

Neeeflix avatar May 08 '24 09:05 Neeeflix

Hi @Neeeflix

Thanks a lot for asking and for your help. Finally, after several hours of trying crazy things, I found the solution to my problem. I'm using Zscaler, so the solution came up with importing through keytool the Zscaler root certificate 👏 Now, I can start reviewing everything 🥳 Sorry for the long delay in keeping my environment up-to-date.

franramirez688 avatar May 08 '24 17:05 franramirez688

UPDATE: CI is complaining about Linux and Bazel 7.x (not installed yet). Working on it 😁

franramirez688 avatar May 30 '24 07:05 franramirez688

Again, thanks @Neeeflix for the huge effort coming up with this, and @peakschris @fmeum for your help and reviews 👏

franramirez688 avatar Jun 04 '24 14:06 franramirez688

Amazing, thanks everyone and @franramirez688 thank you too! Any idea when this might be out in a release?

peakschris avatar Jun 04 '24 14:06 peakschris

Conan 2.4 will be very soon, today or tomorrow.

memsharded avatar Jun 04 '24 14:06 memsharded

@franramirez688 thanks for looking into this and finishing it up 👍

Neeeflix avatar Jun 05 '24 20:06 Neeeflix