-
Notifications
You must be signed in to change notification settings - Fork 361
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
[Idea] Support Starlark overlays without patches #1566
Comments
+1 it's really painful to have to encode new files as patches |
We could add a Then registries could start populating this attribute in their @meteorcloudy @Wyverald @SalmaSamy What do you think? |
SGTM, PR welcome. And we could backport the change to 6.x and 7.x. |
I am interested in working on this. @fmeum if could point me to some source files or maybe a PR that did something similar in changes to sources.json to mimic I can try that. |
I want to add not only is it annoying to submit patch files but the BUILD files aren't searchable on GitHub search using the starlark language filter. That would help expose more samples. |
Okay here is my research:
Looks like (1) can be starlark only. |
@fzakaria That's highly appreciated! Your research looks solid, most of this can indeed be done in Starlark and I can also help with the Java parts. For starters, I would suggest to focus on the Starlark part and augment
I think that attribute structure is going to be simpler than a full-blown overlay JSON, with a very similar experience: In the BCR, we could just have a When implementing the download logic for the remote files, I would suggest to keep the following in mind:
|
This issue adds support necessary to tackle bazelbuild/bazel-central-registry#1566 Add two new attributes to http_archive: remote_file_urls and remote_file_integrity. The purpose of these two attributes is to allow files to effectively be overlaid ontop of an http_archive. The goal of such functionality would be useful for BCR since the BUILD & WORKSPACE files need no longer be stored as patch files. This means we could probably deprecate `build_file` since that could be referenced as a file:// url in the remote_file_urls attribute. Co-authored-by: Mark Williams <[email protected]>
@fmeum thank you for the advice -- I was able to start bazelbuild/bazel#22155 |
This issue adds support necessary to tackle bazelbuild/bazel-central-registry#1566 Add two new attributes to http_archive: remote_file_urls and remote_file_integrity. The purpose of these two attributes is to allow files to effectively be overlaid ontop of an http_archive. The goal of such functionality would be useful for BCR since the BUILD & WORKSPACE files need no longer be stored as patch files. This means we could probably deprecate `build_file` since that could be referenced as a file:// url in the remote_file_urls attribute. Co-authored-by: Mark Williams <[email protected]>
This issue adds support necessary to tackle bazelbuild/bazel-central-registry#1566 Add two new attributes to http_archive: remote_file_urls and remote_file_integrity. The purpose of these two attributes is to allow files to effectively be overlaid ontop of an http_archive. The goal of such functionality would be useful for BCR since the BUILD & WORKSPACE files need no longer be stored as patch files. This means we could probably deprecate `build_file` since that could be referenced as a file:// url in the remote_file_urls attribute. Co-authored-by: Mark Williams <[email protected]>
This issue adds support necessary to tackle bazelbuild/bazel-central-registry#1566 Add two new attributes to http_archive: remote_file_urls and remote_file_integrity. The purpose of these two attributes is to allow files to effectively be overlaid ontop of an http_archive. The goal of such functionality would be useful for BCR since the BUILD & WORKSPACE files need no longer be stored as patch files. This means we could probably deprecate `build_file` since that could be referenced as a file:// url in the remote_file_urls attribute. Co-authored-by: Mark Williams <[email protected]> CC @fmeum Closes #22155. PiperOrigin-RevId: 632594203 Change-Id: I6310093482c5c58537ed6dbe4ff90bafdbd696ff
This issue adds support necessary to tackle bazelbuild/bazel-central-registry#1566 Add two new attributes to http_archive: remote_file_urls and remote_file_integrity. The purpose of these two attributes is to allow files to effectively be overlaid ontop of an http_archive. The goal of such functionality would be useful for BCR since the BUILD & WORKSPACE files need no longer be stored as patch files. This means we could probably deprecate `build_file` since that could be referenced as a file:// url in the remote_file_urls attribute. Co-authored-by: Mark Williams <[email protected]> CC @fmeum Closes bazelbuild#22155. PiperOrigin-RevId: 632594203 Change-Id: I6310093482c5c58537ed6dbe4ff90bafdbd696ff
This issue adds support necessary to tackle bazelbuild/bazel-central-registry#1566 Add two new attributes to http_archive: remote_file_urls and remote_file_integrity. The purpose of these two attributes is to allow files to effectively be overlaid ontop of an http_archive. The goal of such functionality would be useful for BCR since the BUILD & WORKSPACE files need no longer be stored as patch files. This means we could probably deprecate `build_file` since that could be referenced as a file:// url in the remote_file_urls attribute. Co-authored-by: Mark Williams <[email protected]> CC @fmeum Closes #22155. PiperOrigin-RevId: 632594203 Change-Id: I6310093482c5c58537ed6dbe4ff90bafdbd696ff Commit e01509f Co-authored-by: Farid Zakaria <[email protected]>
@fmeum sent me next steps I am capturing here:
|
This issue adds support necessary to tackle bazelbuild/bazel-central-registry#1566 Add two new attributes to http_archive: remote_file_urls and remote_file_integrity. The purpose of these two attributes is to allow files to effectively be overlaid ontop of an http_archive. The goal of such functionality would be useful for BCR since the BUILD & WORKSPACE files need no longer be stored as patch files. This means we could probably deprecate `build_file` since that could be referenced as a file:// url in the remote_file_urls attribute. Co-authored-by: Mark Williams <[email protected]> CC @fmeum Closes bazelbuild#22155. PiperOrigin-RevId: 632594203 Change-Id: I6310093482c5c58537ed6dbe4ff90bafdbd696ff
This is a continuation of bazelbuild#22155 that adds the newly added 'remote_files' attribute for http_archive to the bzlmod functionality. The end goal is to then update BCR to this new functionality to overlay files rather than use patch files when providing MODULE/WORKSPACE/BUILD files. bazelbuild/bazel-central-registry#1566 has a good discussion of the rationale.
While @fzakaria is close to getting overlay support into Bazel, I noticed something that could make our lives easier today: It's possible to reuse patches from other module versions, which could be used to simplify reviews of C++ modules. See https://github.com/bazelbuild/bazel-central-registry/pull/2024/files#diff-90fa618704d4146385f96570f2033f70b09f59ae5c630825ea0dde357520ebd5R5 for an example. |
Final piece is up for PR #2046 2046 |
This is a continuation of #22155 that adds the newly added 'remote_files' attribute for http_archive to the bzlmod functionality. The end goal is to then update BCR to this new functionality to overlay files rather than use patch files when providing MODULE/WORKSPACE/BUILD files. bazelbuild/bazel-central-registry#1566 has a good discussion of the rationale. Co-authored-by: Fabian Meumertzheim <[email protected]> Closes #22349. PiperOrigin-RevId: 636682112 Change-Id: Ief070985598a7c0f427a98cd3daeb69a0984f7be
This is a continuation of bazelbuild#22155 that adds the newly added 'remote_files' attribute for http_archive to the bzlmod functionality. The end goal is to then update BCR to this new functionality to overlay files rather than use patch files when providing MODULE/WORKSPACE/BUILD files. bazelbuild/bazel-central-registry#1566 has a good discussion of the rationale. Co-authored-by: Fabian Meumertzheim <[email protected]> Closes bazelbuild#22349. PiperOrigin-RevId: 636682112 Change-Id: Ief070985598a7c0f427a98cd3daeb69a0984f7be
This is a continuation of #22155 that adds the newly added 'remote_files' attribute for http_archive to the bzlmod functionality. The end goal is to then update BCR to this new functionality to overlay files rather than use patch files when providing MODULE/WORKSPACE/BUILD files. bazelbuild/bazel-central-registry#1566 has a good discussion of the rationale. Co-authored-by: Fabian Meumertzheim <[email protected]> Closes #22349. PiperOrigin-RevId: 636682112 Change-Id: Ief070985598a7c0f427a98cd3daeb69a0984f7be Commit c4167e3 Co-authored-by: Farid Zakaria <[email protected]>
With the addition of overlays (bazelbuild#1566) it now can make sense to have BUILD and .bzl files inside the module version directories. However they don't necessarily make sense on their own. They are only supposed to work in the context of the source archive they overlay. To prevent issues like not being able to load() from a //:def.bzl that does not exit in the registry repo, let's just .bazelignore the modules/ dir.
With the addition of overlays (#1566) it now can make sense to have BUILD and .bzl files inside the module version directories. However they don't necessarily make sense on their own. They are only supposed to work in the context of the source archive they overlay. To prevent issues like not being able to load() from a //:def.bzl that does not exist in the registry repo, let's just .bazelignore the modules/ dir.
To enable using the new overlay format (#1566) with the Bazel 7.2.1 fix that requires the overlay files to be in an `overlay` dir (bazelbuild/bazel#22811) Tested locally on #2240
Add psmisc, using the new overlay format (#1566)
Thanks to all who helped make this possible! <3 |
At the moment all modules are overlaid with patches and those patches are hashed and tracked in
source.json
.Many modules probably just need a
MODULE.bazel
file and some buildfiles. I think it would be nice UX improvement if those files could be put into the BCR directly and have some mechanism to "automatically" overlay these Bazel-specific files.Since we already have
MODULE.bazel
in the BCR without patches, it might be viable to have some sort of overlay mechanism, maybe even anoverlays
directory that adds Starlark files directly on top of the external repository.Such an approach would be somewhat similar to how it feels like to work in
nixpkgs
: Have the build overlays as regular source code and only use patches for things that are "true" functionality-changing patches.I believe this could make it nicer to browse the BCR and get inspiration. It would also make it easier to spot functional changes and would potentially reduce the friction of having to generate patch files all the time.
The text was updated successfully, but these errors were encountered: