Skip to content

Commit

Permalink
Improve the check for being a package metadata rule
Browse files Browse the repository at this point in the history
This allows the refactoring which will happen after default_applicable_licenses is renamed to default_package_metadata. The current behavior is intended to prevent
`applicable_licenses` from being set on a `license` rule. The required behavior is that we don't set `applicable_licenses` on any of the metadata rules.

Future changes might have to take into account the ability to set the license for a tool rule within `rules_package`.

For background, see https://docs.google.com/document/d/1uyJjkKbE8kV8EinakaR9q-Un25zCukhoH_dRBkWHSKQ/edit#heading=h.izpa22p82m6c

Closes bazelbuild#16596.

PiperOrigin-RevId: 485457037
Change-Id: Ifb105f646ae0c291a6841b3ddb84ed536e9d71e3
  • Loading branch information
aiuto authored and Lucas Ripoche committed Jun 13, 2023
1 parent 6ce4e5c commit 295b950
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2735,6 +2735,14 @@ public boolean isPackageMetadataRule() {
// not building it today because the exact needs are not clear.
return true;
}
// BEGIN-INTERNAL
// TODO(aiuto): This is a Google-ism, remove from Bazel.
String packageName = ruleDefinitionEnvironmentLabel.getPackageName();
if (packageName.startsWith("tools/build_defs/license")
|| packageName.startsWith("third_party/rules_license")) {
return true;
}
// END-INTERNAL
return false;
}
}

0 comments on commit 295b950

Please sign in to comment.