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

Create ADD_PKG_MGR.md #142

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

alexeagle
Copy link

Allows package manager implementations like rules_jvm_external to begin declaring the licenses or other metadata about third-party packages they fetch and add to the dependency graph.

Needs some discussion with @mzeren-vmw about whether this is the shape we want to commit to, vs. having a package_info rule as well.

Needs some discussion with @mzeren-vmw about whether this is the shape we want to commit to, vs. having a `package_info` rule as well.
@shs96c
Copy link
Collaborator

shs96c commented May 16, 2024

See also: bazelbuild/bazel#22403, which asks for a way of attaching license info to a specific target (which we will need for rules_jvm_external)

load("@rules_license//rules:license.bzl", "license")

package(
default_package_metadata = [":license"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If people are doing the integration, we should take the same opportunity to add package_info rules to pull package names and versions into the BUILD file in a uniform way.

Copy link
Collaborator

@aiuto aiuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks mostly reasonable to me.

My only question is the name of the .md file. ADD_PKG_MGR could be interpreted as "how to add a package manager" rather than the intent, which is the (too) long winded "How to integrate rules_license into package managers.

@aiuto
Copy link
Collaborator

aiuto commented May 17, 2024

See also: bazelbuild/bazel#22403, which asks for a way of attaching license info to a specific target (which we will need for rules_jvm_external)

Does rules_jvm_external combine multiple distinct modules into a single BULD file?

@shs96c
Copy link
Collaborator

shs96c commented Jul 21, 2024

We can declare multiple java_export targets, each with potentially different licenses and PackageInfo, in a single build file.

@shs96c
Copy link
Collaborator

shs96c commented Sep 9, 2024

Having now implemented this for rules_jvm_external in bazel-contrib/rules_jvm_external#1232, I think that this PR needs to highlight some changes.

  1. Rules controlled by a ruleset can (and likely should) return a PackageInfo directly. Other mechanisms are unnecessary indirection, and this also allows user configured rules (java_export in the case of rules_jvm_external) to also participate in providing information.
  2. Attaching a custom PackageInfo via the package_info rule also works, but can create a proliferation of additional targets, just to create the PackageInfo provider.
  3. In many cases, a global license info or PackageInfo is not going to be very useful, since third party deps likely have many different licenses.

@alexeagle
Copy link
Author

Ping @tonyaiuto this is the thing preventing me from volunteering to update many of the language rulesets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants