Replies: 6 comments 5 replies
-
A related concept to this is exposing a dictionary of workspace level features to repository rules. Something like
The dictionary would appear as @Wyverald Any thoughts? I don't think either of these concepts would impact module resolution. |
Beta Was this translation helpful? Give feedback.
-
I made a comment in Gazelle just now related to this bazel-contrib/bazel-gazelle#1314 (comment) Having the ability to check whether rules_license does exist or not in the repository context would help signal other repository rules to generate relevant rules_license targets. |
Beta Was this translation helpful? Give feedback.
-
Why can't rules_jvm_external just depend on rules_license? What are the disadvantages? |
Beta Was this translation helpful? Give feedback.
-
I'm trying to be a good citizen, but I can keep the declarative part of rules_license small. And by small, I mean 0 dependencies. The code which does analysis of the graph can be optional modules. But then I need a way so that if a module just depends on rules_license you get the base subset, but if you (in MODULE.bazel) want the full rules_license you get a different archive. Just spitballing ideas here
That way it only brings in dependencies if you want to run the analysis. Or.... we just separate the code very carefully so that @rules_license//rules:* can load with no dependencies and you just have to make sure you have the right compiler deps to use the rest of it. |
Beta Was this translation helpful? Give feedback.
-
I have been trying to keep this in one respository. I can publish two modules out of that. |
Beta Was this translation helpful? Give feedback.
-
I'm not making sense of that thread. IMO, cookbook examples in
bazelbuild/examples, or it didn't happen.
…On Wed, May 24, 2023 at 2:44 PM Fabian Meumertzheim < ***@***.***> wrote:
This setup should be much simpler now thanks to
https://bazelbuild.slack.com/archives/C014RARENH0/p1684518734446419?thread_ts=1684518734.446419&cid=C014RARENH0
—
Reply to this email directly, view it on GitHub
<#18473 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXHHHBZPEOLYU53QIF75ZTXHZJJXANCNFSM6AAAAAAYLJGKPQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
The small goal is that a repository rule should be able to query for other repositories that are already loaded by the user and then take specific action based on that repository being present.
Motivating use case: license and package attestation for accurate SBOM creation.
license
andpackage_info
rules from@rules_license
to specify this data in the BUILD file for each module. That way we can write tools to gather and analyze the metadata without having to have each tool understand every remote repository type.package_info
in their BUILD files. This can happen either explicitly, or implicitly, during module download and instantiation.Today:
rules_license
. That's an easy case. The upstream repository depends onrules_license
via MODULE.bazel, and thus the user project transitively depends on it too.rules_license
. I will be adding mechanism to createpackage_info
targets in the generated BUILD files. The question is how to do that in the least invasive way.I start with the assumptions that:
@bazel_tools//tools/build_defs/repo
To satisfy those constraints, downloaders like
jvm.bzl
andmaven_rules.bzl
will look for the presence ofrules_license
and alter behavior to includepackage_info
targets if present, otherwise not. This is possible today with some repository rule trickery, and some repository rules already do these tricks. Overall, we could reduce complexity by being able to change behavior on what the user has already loaded.Bonus if we can determine that the user explicitly included a repository in MODULE.bazel or WORKSPACE. That is a strong signal that they want to depend on those capabilities, so any other rule types should be able to make use of those.
cc: @shs96c
Beta Was this translation helpful? Give feedback.
All reactions