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

Modularize core Bazel dependencies #7

Closed
19 of 20 tasks
meteorcloudy opened this issue Sep 20, 2021 · 14 comments
Closed
19 of 20 tasks

Modularize core Bazel dependencies #7

meteorcloudy opened this issue Sep 20, 2021 · 14 comments
Assignees
Labels
enhancement New feature or request P1

Comments

@meteorcloudy
Copy link
Member

meteorcloudy commented Sep 20, 2021

Dependencies of the Bazel project itself should be added into the Bazel Central Registry:

  • bazel_skylib
  • bazel_skydoc
  • com_google_protobuf
  • platforms
  • rules_cc
  • rules_java
  • rules_proto
  • rules_pkg
  • rules_python
  • rules_nodejs
  • rules_sass
  • grpc
  • upb
  • c-ares
  • zlib
  • abseil-cpp
  • re2
  • boringssl

Blockers:

Notes:

  • Currently we are writing MODULE.bazel files for those project and checking them in the BCR, that is fine because Bzlmod don't read MODULE.bazel from the source archive. But ideally they should be upstreamed.
@meteorcloudy meteorcloudy added P1 enhancement New feature or request labels Sep 20, 2021
This was referenced Sep 20, 2021
@meteorcloudy
Copy link
Member Author

Blocker for this issue: rules_cc don't have official releases, therefore we cannot check in a specific version.

bazelbuild/rules_cc#91

@meteorcloudy
Copy link
Member Author

stardoc also hasn't have new releases for a while and Bazel is using a commit that is newer than its latest release.

@Wyverald
Copy link
Member

Can't we just download any commit from github as a zip? Like https://github.com/bazelbuild/rules_cc/archive/6c5c8e9b41e6427033dd011f8ce52a1f2532abdc.zip, and then just make it version "0.0.0-20210924-6c5c8e9b" or something

@meteorcloudy
Copy link
Member Author

We can certainly do that as a workaround, but ideally projects rules_cc should have official releases.

@Wyverald
Copy link
Member

Wyverald commented Sep 24, 2021

another way to go about this is to have source.json support git commits too; so instead of specifying an archive from a URL, you could alternatively specify a git repo and a commit/tag.

We can certainly do that as a workaround, but ideally projects rules_cc should have official releases.

Agreed.

@meteorcloudy
Copy link
Member Author

another way to go about this is to have source.json support git commits too; so instead of specifying an archive from a URL, you could alternatively specify a git repo and a commit/tag.

But you still need a fake comparable version for that right?

@meteorcloudy
Copy link
Member Author

In generally, I would like people to check in well-tested release versions of their project in to BCR, instead of a random commit.

@Wyverald
Copy link
Member

But you still need a fake comparable version for that right?

Yeah, the only difference is that a URL like GitHub's to download an arbitrary commit as a zip isn't always available (for example, for your company's own git repos).

In generally, I would like people to check in well-tested release versions of their project in to BCR, instead of a random commit.

That's fair -- I think we should make more effort to push projects such as rules_cc to make a release then (potentially doing it ourselves). I just don't want us to be stuck in a limbo where rules_cc is reluctant to make a release, so we're just blocked on them and not making progress.

@meteorcloudy
Copy link
Member Author

I just don't want us to be stuck in a limbo where rules_cc is reluctant to make a release, so we're just blocked on them and not making progress.

Oh, of course, making a new release shouldn't be too hard (hopefully) and we have many other dependencies to check in.

@alexeagle
Copy link
Contributor

Dependencies of the Bazel project itself should be added into the Bazel Central Registry

Wait, is this registry for Bazel's use or the community? If zlib goes here, does that mean other C++ libraries can be contributed by users? You'll have hundreds of "modules" here very quickly.

@Wyverald
Copy link
Member

This is for use by the community. Other C++ libraries can indeed be contributed by users.

You'll have hundreds of "modules" here very quickly.

Scalability has always been a concern of mine, but similar projects (notably Homebrew, and to some extent Debian) have functioned well with this pattern, so I think we should be able to manage.

@alexeagle
Copy link
Contributor

only difference is that a URL like GitHub's to download an arbitrary commit as a zip isn't always available

there is another difference which is that integrity hashes of github's archive downloads are not stable. They sometimes rollout upgrades to their frontend nodes where the tar or zip command run and those have small variation. The registry should probably strongly advise and/or enforce only release/ URLs are used, where the integrity matches what the rule maintainer uploaded

@meteorcloudy
Copy link
Member Author

there is another difference which is that integrity hashes of github's archive downloads are not stable. They sometimes rollout upgrades to their frontend nodes where the tar or zip command run and those have small variation.

That's a good point. To mitigate this, we also mirror all archive URLs to a GCS bucket.
See https://buildkite.com/bazel/bcr-postsubmit/builds/7#eb1a86ce-5b1a-461c-9f87-cf2f1b20a78c

@alexeagle
Copy link
Contributor

oh this is a place to automate the mirroring of new releases, that's a great improvement. of course if GitHub changes, you'll have one correct mirror and one incorrect one.

bazel-io pushed a commit to bazelbuild/bazel that referenced this issue Oct 28, 2021
Bazel can now be built with Bzlmod with dependencies fetched from [the Bazel Central Registry](https://github.com/bazelbuild/bazel-central-registry) (bazelbuild/bazel-central-registry#7).

Changes in this PR:
- Added MODULE.bazel file for Bazel
- Added MODULE.bazel file for third_party/remoteapis and third_party/googleapis to make them work as Bazel modules
- Updated gson to 2.8.6, because we build with protobuf 3.19.0 with Bzlmod which needs a newer version of gson.
- Added WORKSPACE.bzlmod, this eventually should be empty, but for now we still need some bind rules to make some jar dependencies available for protobuf.
- package-bazel.sh: use wildcard to locate the directory of the platforms repo, whose canonical repo name is `platform.<version>` when building with Bzlmod.

To build Bazel with Bzlmod:
- Copy WORKSPACE.bzlmod to WORKSPACE
- Run `USE_BAZEL_VERSION=last_green bazelisk build --experimental_enable_bzlmod //src:bazel_nojdk`

Closes #14171.

PiperOrigin-RevId: 406097216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P1
Projects
None yet
Development

No branches or pull requests

3 participants