Merge pull request #101 from aiuto/bfr Move rules/private/gathering_providers.bzl to rules_gathering
diff --git a/doc_build/BUILD b/doc_build/BUILD index 6181ca7..e3f61a1 100644 --- a/doc_build/BUILD +++ b/doc_build/BUILD
@@ -90,7 +90,6 @@ srcs = [ "//:version.bzl", "//rules:standard_package", - "//rules/private:standard_package", "//rules_gathering:standard_package", ], visibility = ["//visibility:public"],
diff --git a/examples/manifest/manifest.bzl b/examples/manifest/manifest.bzl index 7e4adb4..13309ae 100644 --- a/examples/manifest/manifest.bzl +++ b/examples/manifest/manifest.bzl
@@ -18,7 +18,7 @@ "gather_licenses_info", ) load( - "@rules_license//rules/private:gathering_providers.bzl", + "@rules_license//rules_gathering:gathering_providers.bzl", "TransitiveLicensesInfo", )
diff --git a/examples/policy_checker/license_policy_check.bzl b/examples/policy_checker/license_policy_check.bzl index bb35eee..7dccb35 100644 --- a/examples/policy_checker/license_policy_check.bzl +++ b/examples/policy_checker/license_policy_check.bzl
@@ -23,7 +23,7 @@ "gather_licenses_info", ) load("@rules_license//rules:providers.bzl", "LicenseInfo") -load("@rules_license//rules/private:gathering_providers.bzl", "TransitiveLicensesInfo") +load("@rules_license//rules_gathering:gathering_providers.bzl", "TransitiveLicensesInfo") # This is a crude example of the kind of thing which can be done. def _license_policy_check_impl(ctx):
diff --git a/rules/compliance.bzl b/rules/compliance.bzl index a9c45c3..ad46c74 100644 --- a/rules/compliance.bzl +++ b/rules/compliance.bzl
@@ -20,7 +20,7 @@ "write_licenses_info", ) load( - "@rules_license//rules/private:gathering_providers.bzl", + "@rules_license//rules_gathering:gathering_providers.bzl", "TransitiveLicensesInfo", )
diff --git a/rules/gather_licenses_info.bzl b/rules/gather_licenses_info.bzl index 19e3e48..518d5ff 100644 --- a/rules/gather_licenses_info.bzl +++ b/rules/gather_licenses_info.bzl
@@ -19,7 +19,7 @@ "should_traverse", ) load( - "@rules_license//rules/private:gathering_providers.bzl", + "@rules_license//rules_gathering:gathering_providers.bzl", "TransitiveLicensesInfo", ) load("@rules_license//rules_gathering:trace.bzl", "TraceInfo")
diff --git a/rules/licenses_core.bzl b/rules/licenses_core.bzl index 55c2bc1..a9dea8b 100644 --- a/rules/licenses_core.bzl +++ b/rules/licenses_core.bzl
@@ -17,7 +17,7 @@ load("@rules_license//rules:providers.bzl", "LicenseInfo") load("@rules_license//rules:user_filtered_rule_kinds.bzl", "user_aspect_filters") load( - "@rules_license//rules/private:gathering_providers.bzl", + "@rules_license//rules_gathering:gathering_providers.bzl", "LicensedTargetInfo", "TransitiveLicensesInfo", )
diff --git a/rules/private/gathering_providers.bzl b/rules/private/gathering_providers.bzl index 1c3740f..be31dce 100644 --- a/rules/private/gathering_providers.bzl +++ b/rules/private/gathering_providers.bzl
@@ -1,4 +1,4 @@ -# Copyright 2022 Google LLC +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,44 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Providers for transitively gathering all license and package_info targets. +"""Temporary forwarder. -Warning: This is private to the aspect that walks the tree. The API is subject -to change at any release. +TODO(2023-07-01): Delete this file. """ -LicensedTargetInfo = provider( - doc = """Lists the licenses directly used by a single target.""", - fields = { - "target_under_license": "Label: The target label", - "licenses": "list(label of a license rule)", - }, +load( + "@rules_license//rules_gathering:gathering_providers.bzl", + _private_TransitiveLicensesInfo = "TransitiveLicensesInfo", ) -def licenses_info(): - return provider( - doc = """The transitive set of licenses used by a target.""", - fields = { - "target_under_license": "Label: The top level target label.", - "deps": "depset(LicensedTargetInfo): The transitive list of dependencies that have licenses.", - "licenses": "depset(LicenseInfo)", - "traces": "list(string) - diagnostic for tracing a dependency relationship to a target.", - }, - ) - -# This provider is used by the aspect that is used by manifest() rules. -TransitiveLicensesInfo = licenses_info() - -TransitiveMetadataInfo = provider( - doc = """The transitive set of licenses used by a target.""", - fields = { - "top_level_target": "Label: The top level target label we are examining.", - "other_metadata": "depset(ExperimentalMetatdataInfo)", - "licenses": "depset(LicenseInfo)", - "package_info": "depset(PackageInfo)", - - "target_under_license": "Label: A target which will be associated with some licenses.", - "deps": "depset(LicensedTargetInfo): The transitive list of dependencies that have licenses.", - "traces": "list(string) - diagnostic for tracing a dependency relationship to a target.", - }, -) +TransitiveLicensesInfo = _private_TransitiveLicensesInfo
diff --git a/rules/providers.bzl b/rules/providers.bzl index c9b4872..c9f89e0 100644 --- a/rules/providers.bzl +++ b/rules/providers.bzl
@@ -19,7 +19,7 @@ """ load( - "@rules_license//rules/private:gathering_providers.bzl", + "@rules_license//rules_gathering:gathering_providers.bzl", _private_TransitiveLicensesInfo = "TransitiveLicensesInfo", )
diff --git a/rules_gathering/gather_metadata.bzl b/rules_gathering/gather_metadata.bzl index 8269241..922082f 100644 --- a/rules_gathering/gather_metadata.bzl +++ b/rules_gathering/gather_metadata.bzl
@@ -24,7 +24,7 @@ "PackageInfo", ) load( - "@rules_license//rules/private:gathering_providers.bzl", + "@rules_license//rules_gathering:gathering_providers.bzl", "TransitiveMetadataInfo", ) load("@rules_license//rules_gathering:trace.bzl", "TraceInfo")
diff --git a/rules_gathering/gathering_providers.bzl b/rules_gathering/gathering_providers.bzl new file mode 100644 index 0000000..1c3740f --- /dev/null +++ b/rules_gathering/gathering_providers.bzl
@@ -0,0 +1,54 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Providers for transitively gathering all license and package_info targets. + +Warning: This is private to the aspect that walks the tree. The API is subject +to change at any release. +""" + +LicensedTargetInfo = provider( + doc = """Lists the licenses directly used by a single target.""", + fields = { + "target_under_license": "Label: The target label", + "licenses": "list(label of a license rule)", + }, +) + +def licenses_info(): + return provider( + doc = """The transitive set of licenses used by a target.""", + fields = { + "target_under_license": "Label: The top level target label.", + "deps": "depset(LicensedTargetInfo): The transitive list of dependencies that have licenses.", + "licenses": "depset(LicenseInfo)", + "traces": "list(string) - diagnostic for tracing a dependency relationship to a target.", + }, + ) + +# This provider is used by the aspect that is used by manifest() rules. +TransitiveLicensesInfo = licenses_info() + +TransitiveMetadataInfo = provider( + doc = """The transitive set of licenses used by a target.""", + fields = { + "top_level_target": "Label: The top level target label we are examining.", + "other_metadata": "depset(ExperimentalMetatdataInfo)", + "licenses": "depset(LicenseInfo)", + "package_info": "depset(PackageInfo)", + + "target_under_license": "Label: A target which will be associated with some licenses.", + "deps": "depset(LicensedTargetInfo): The transitive list of dependencies that have licenses.", + "traces": "list(string) - diagnostic for tracing a dependency relationship to a target.", + }, +)
diff --git a/rules_gathering/generate_sbom.bzl b/rules_gathering/generate_sbom.bzl index 00131ec..e6432f1 100644 --- a/rules_gathering/generate_sbom.bzl +++ b/rules_gathering/generate_sbom.bzl
@@ -20,7 +20,7 @@ "write_metadata_info", ) load( - "@rules_license//rules/private:gathering_providers.bzl", + "@rules_license//rules_gathering:gathering_providers.bzl", "TransitiveLicensesInfo", )