-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[feature request] Consider moving bzl_library.bzl
into @bazel_tools
#18391
Comments
@brandjon please triage |
IIRC, the discussion just sort of faded away. I would like to see Currently I am at a split opinion here. But writing this helped me clarify a thought. What I want to be able to declare is a workspace wide replacement for the path of any |
Instead of moving Skylib could add this repo to its dependencies and continue to forward the provider for backwards compatibility. |
skylib itself is not large (36 KB); the main issue is that it's a load-time dependency that all downstream users of a ruleset must declare. It's the transitive mandatory book-keeping that's a problem. Maybe the answer is to have more load("@bazel_tools2_starlark//:bzl_library.bzl", "bzl_library") where (The same could maybe be done with |
Default versions of built in small repositories would help with rules_license as well. Eventually, everything depends on @rules_license//rules:license.bzl. It is a pain to include everywhere, so having it built in is a nice convenience. But it must be user replacable for those who want to mod the behavior. |
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale. |
I still think this is a good idea, but it is probably too late. Since
everyone uses bzl library, they have to depend on Skylib and Skylib uses
other rules. So we have a horrible knot of mutual dependency.
…On Fri, Oct 25, 2024, 9:33 PM github-actions[bot] ***@***.***> wrote:
Thank you for contributing to the Bazel repository! This issue has been
marked as stale since it has not had any activity in the last 1+ years. It
will be closed in the next 90 days unless any other activity occurs. If you
think this issue is still relevant and should stay open, please post any
comment here and the issue will no longer be marked as stale.
—
Reply to this email directly, view it on GitHub
<#18391 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXHHHE6RBTAJRXIYK4PQGDZ5LWPHAVCNFSM6AAAAABQUJNYB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZZGE3DENRSGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This is a super-ugly hack, but would it be possible to use # bazel-skylib/internal/starlark_library_info.bzl
StarlarkLibraryInfo = provider(
"Information on contained Starlark rules.",
fields = {
"srcs": "Top level rules files.",
"transitive_srcs": "Transitive closure of rules files required for " +
"interpretation of the srcs",
},
)
# bazel-skylib/bzl_library.bzl
load("@bazel_tools//:something_that_already_exists.bzl", "symbol_that_already_exists")
load("//internal:starlark_library_info.bzl", _StarlarkLibraryInfo = StarlarkLibraryInfo)
# Using a symbol in @bazel_tools that already exists in older Bazel versions (so the load succeeds),
# re-export its StarlarkLibraryInfo from skylib if present.
StarlarkLibraryInfo = getattr(symbol_that_already_exists, "StarlarkLibraryInfo", _StarlarkLibraryInfo)
# Alternative: add StarlarkLibraryInfo as builtin, which avoids the need to find
# an already-existing part of @bazel_tools to add on to.
StarlarkLibraryInfo = getattr(native, "StarlarkLibraryInfo", _StarlarkLibraryInfo) The problem isn't the dependency mesh exactly, it's avoiding a mandatory minimum Bazel version bump for skylib, which means there needs to be some way to discover whether the current Bazel version has |
We have this machinery already in However, for something as foundational as skylib, adding new WORKSPACE deps may be prohibitively breaking. Once we could assume that everyone is on Bzlmod (even with Bazel 6), the migration would be really easy. |
Note that in the latest versions of skylib |
Description of the feature request:
Skylib's
bzl_library.bzl
provides aStarlarkLibraryInfo
provider andbzl_library
rule, which are used for aggregating.bzl
rules files for use by other analysis tools.The definition of that provider and rule are quite stable (basically unchanged since 2018), and it has no dependencies on any other part of skylib.
The natural way to use that file is to
load
it from everyBUILD
file in a ruleset, like this:However, since the
load
needs to fetch skylib before evaluation continues, this means that skylib becomes a hard dependency for every client of the ruleset.Given that the
bzl_library.bzl
file is generic, broadly useful, and very stable, could it be bundled into@bazel_tools
instead?The text was updated successfully, but these errors were encountered: