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

It should be possible to attach a rules_license license to arbitrary targets #22403

Closed
shs96c opened this issue May 16, 2024 · 9 comments
Closed
Labels
team-Core Skyframe, bazel query, BEP, options parsing, bazelrc team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: feature request untriaged

Comments

@shs96c
Copy link
Contributor

shs96c commented May 16, 2024

Description of the feature request:

Using package(default_package_metadata = []) it's possible to attach license information to every target in a build file, but in some cases it would be useful to add a specific license (or metadata) to a specific rule. The licenses attribute was previously used for this, but is now deprecated and only took a string

Which category does this issue belong to?

Core, External Dependency

What underlying problem are you trying to solve with this feature?

rules_jvm_external generates a single build file containing every third party dependency that a user can depend on. In order to integrate nicely with rules_license, it would be useful to be able to assign a specific license to each target, since each dependency may have its own license.

Which operating system are you running Bazel on?

n/a

What is the output of bazel info release?

n/a

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@github-actions github-actions bot added team-Core Skyframe, bazel query, BEP, options parsing, bazelrc team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. labels May 16, 2024
@shs96c
Copy link
Contributor Author

shs96c commented May 16, 2024

The presence of default_package_metadata in the package rule implies that there's a package_metadata attribute on rules. This doesn't appear to be the case with Bazel 7.1.0

@Wyverald
Copy link
Member

The presence of default_package_metadata in the package rule implies that there's a package_metadata attribute on rules. This doesn't appear to be the case with Bazel 7.1.0

just chatted to @aiuto -- he said that package_metadata is an implicit attribute on all rules. Probably undocumented though. Have you tried it?

@aiuto
Copy link
Contributor

aiuto commented May 16, 2024 via email

@shs96c
Copy link
Contributor Author

shs96c commented May 16, 2024

This attribute doesn't seem to be present in Bazel 7.1.1

@fmeum
Copy link
Collaborator

fmeum commented May 16, 2024

@aiuto It's not too late to cherry-pick this into 7.2.0.

@aiuto
Copy link
Contributor

aiuto commented May 16, 2024 via email

@shs96c
Copy link
Contributor Author

shs96c commented May 17, 2024

applicable_licenses does appear to be present in 7.1.1. package_metadata appears to be absent.

@fmeum
Copy link
Collaborator

fmeum commented May 22, 2024

I sent #22497 to encode the intended behavior in a test. Bazel 7 sets the applicable_licenses attribute, Bazel 8 will provide both to users while requiring rule authors to use package_metadata.

copybara-service bot pushed a commit that referenced this issue May 22, 2024
Work towards #22403

Closes #22497.

PiperOrigin-RevId: 636193924
Change-Id: Ia91d249397cd26aed90c6cb5be709a9f29803279
@meteorcloudy
Copy link
Member

Feel free to cherry pick this to 7.x, I'm going to close this one since it seems to be fixed at HEAD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Core Skyframe, bazel query, BEP, options parsing, bazelrc team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: feature request untriaged
Projects
None yet
Development

No branches or pull requests

8 participants