diff options
-rw-r--r-- | BUILD | 3 | ||||
-rw-r--r-- | examples/src/BUILD | 2 | ||||
-rw-r--r-- | examples/vendor/constant_gen/BUILD | 2 | ||||
-rw-r--r-- | licenses/spdx/BUILD | 1 | ||||
-rw-r--r-- | rules/BUILD | 2 | ||||
-rw-r--r-- | rules/compliance.bzl | 12 | ||||
-rw-r--r-- | rules/default_license.bzl | 7 | ||||
-rw-r--r-- | rules/license.bzl | 6 | ||||
-rw-r--r-- | rules/license_kind.bzl | 8 | ||||
-rw-r--r-- | rules/license_policy_check.bzl | 18 | ||||
-rw-r--r-- | rules/license_policy_provider.bzl | 4 | ||||
-rw-r--r-- | rules/providers.bzl | 4 |
12 files changed, 33 insertions, 36 deletions
@@ -22,7 +22,7 @@ package( license( name = "license", license_kinds = [ - "@rules_license//licenses/spdx:Apache-2.0" + "@rules_license//licenses/spdx:Apache-2.0", ], license_text = "LICENSE", ) @@ -38,4 +38,3 @@ exports_files( ]), visibility = ["//visibility:public"], ) - diff --git a/examples/src/BUILD b/examples/src/BUILD index be415fc..29b6803 100644 --- a/examples/src/BUILD +++ b/examples/src/BUILD @@ -1,7 +1,7 @@ # Examples of applications and interactions with licenses load("@rules_license//examples/vendor/constant_gen:defs.bzl", "constant_gen") -load("@rules_license//rules:compliance.bzl", "check_license", "licenses_used") +load("@rules_license//rules:compliance.bzl", "licenses_used") load("@rules_license//rules:license_policy_check.bzl", "license_policy_check") load("@rules_license//tools:test_helpers.bzl", "golden_test") diff --git a/examples/vendor/constant_gen/BUILD b/examples/vendor/constant_gen/BUILD index e837fd1..c6d61a2 100644 --- a/examples/vendor/constant_gen/BUILD +++ b/examples/vendor/constant_gen/BUILD @@ -1,9 +1,9 @@ # An example of a code generator with a distinct license for the generated code. -load(":defs.bzl", "constant_gen") load("@rules_license//rules:compliance.bzl", "licenses_used") load("@rules_license//rules:license.bzl", "license") load("@rules_license//tools:test_helpers.bzl", "golden_test") +load(":defs.bzl", "constant_gen") package( default_applicable_licenses = [":license"], diff --git a/licenses/spdx/BUILD b/licenses/spdx/BUILD index 3dd684a..1f83892 100644 --- a/licenses/spdx/BUILD +++ b/licenses/spdx/BUILD @@ -59,7 +59,6 @@ package( default_visibility = ["//visibility:public"], ) - license_kind( name = "0BSD", conditions = [], diff --git a/rules/BUILD b/rules/BUILD index 58bf4a1..36609b7 100644 --- a/rules/BUILD +++ b/rules/BUILD @@ -13,7 +13,7 @@ # 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. -"""Rules for declaring licenses used.""" +"""Rules for making license declarations.""" package( default_applicable_licenses = ["//:license"], diff --git a/rules/compliance.bzl b/rules/compliance.bzl index 8144003..5d84fbb 100644 --- a/rules/compliance.bzl +++ b/rules/compliance.bzl @@ -15,14 +15,14 @@ """Proof of concept. License compliance checking.""" load( - "@rules_license//rules:providers.bzl", - "LicensesInfo", -) -load( "@rules_license//rules:gather_licenses_info.bzl", "gather_licenses_info", "write_licenses_info", ) +load( + "@rules_license//rules:providers.bzl", + "LicensesInfo", +) # Debugging verbosity _VERBOSITY = 0 @@ -75,11 +75,11 @@ def _check_license_impl(ctx): _check_license = rule( implementation = _check_license_impl, attrs = { + "check_conditions": attr.bool(default = True, mandatory = False), + "copyright_notices": attr.output(mandatory = False), "deps": attr.label_list( aspects = [gather_licenses_info], ), - "check_conditions": attr.bool(default = True, mandatory = False), - "copyright_notices": attr.output(mandatory = False), "license_texts": attr.output(mandatory = False), "report": attr.output(mandatory = True), "_checker": attr.label( diff --git a/rules/default_license.bzl b/rules/default_license.bzl index 50290be..9fbd3d5 100644 --- a/rules/default_license.bzl +++ b/rules/default_license.bzl @@ -17,7 +17,6 @@ load( "@rules_license//rules:providers.bzl", "LicenseInfo", - "LicenseKindInfo", "LicensesInfo", ) @@ -35,15 +34,15 @@ def _default_licenses_impl(ctx): _default_licenses = rule( implementation = _default_licenses_impl, attrs = { + "conditions": attr.string_list( + doc = "TBD", + ), "deps": attr.label_list( mandatory = True, doc = "Licenses", providers = [LicenseInfo], cfg = "host", ), - "conditions": attr.string_list( - doc = "", - ), }, ) diff --git a/rules/license.bzl b/rules/license.bzl index 2195619..1a90b09 100644 --- a/rules/license.bzl +++ b/rules/license.bzl @@ -45,6 +45,9 @@ def _license_impl(ctx): _license = rule( implementation = _license_impl, attrs = { + "copyright_notice": attr.string( + doc = "Copyright notice.", + ), "license_kinds": attr.label_list( mandatory = True, doc = "License kind(s) of this license. If multiple license kinds are" + @@ -54,9 +57,6 @@ _license = rule( providers = [LicenseKindInfo], cfg = "host", ), - "copyright_notice": attr.string( - doc = "Copyright notice.", - ), "license_text": attr.label( allow_single_file = True, default = "LICENSE", diff --git a/rules/license_kind.bzl b/rules/license_kind.bzl index 78b0594..47b7639 100644 --- a/rules/license_kind.bzl +++ b/rules/license_kind.bzl @@ -37,15 +37,15 @@ def _license_kind_impl(ctx): _license_kind = rule( implementation = _license_kind_impl, attrs = { + "canonical_text": attr.label( + doc = "File containing the canonical text for this license. Must be UTF-8 encoded.", + allow_single_file = True, + ), "conditions": attr.string_list( doc = "Conditions to be met when using software under this license." + " Conditions are defined by the organization using this license.", mandatory = True, ), - "canonical_text": attr.label( - doc = "File containing the canonical text for this license. Must be UTF-8 encoded.", - allow_single_file = True, - ), "url": attr.string(doc = "URL pointing to canonical license definition"), }, ) diff --git a/rules/license_policy_check.bzl b/rules/license_policy_check.bzl index bdd8c05..be46913 100644 --- a/rules/license_policy_check.bzl +++ b/rules/license_policy_check.bzl @@ -15,10 +15,6 @@ """License compliance checking at analysis time.""" load( - "@rules_license//rules:providers.bzl", - "LicensesInfo", -) -load( "@rules_license//rules:gather_licenses_info.bzl", "gather_licenses_info", ) @@ -26,6 +22,10 @@ load( "@rules_license//rules:license_policy_provider.bzl", "LicensePolicyInfo", ) +load( + "@rules_license//rules:providers.bzl", + "LicensesInfo", +) def _license_policy_check_impl(ctx): policy = ctx.attr.policy[LicensePolicyInfo] @@ -46,17 +46,17 @@ _license_policy_check = rule( implementation = _license_policy_check_impl, doc = """Internal tmplementation method for license_policy_check().""", attrs = { + "policy": attr.label( + doc = """Policy definition.""", + mandatory = True, + providers = [LicensePolicyInfo], + ), "target": attr.label( doc = """Target to collect LicenseInfo for.""", aspects = [gather_licenses_info], mandatory = True, allow_single_file = True, ), - "policy": attr.label( - doc = """Policy definition.""", - mandatory = True, - providers = [LicensePolicyInfo], - ), }, ) diff --git a/rules/license_policy_provider.bzl b/rules/license_policy_provider.bzl index c604e69..caecce8 100644 --- a/rules/license_policy_provider.bzl +++ b/rules/license_policy_provider.bzl @@ -17,8 +17,8 @@ LicensePolicyInfo = provider( doc = """Declares a policy name and the license conditions allowable under it.""", fields = { - "name": "License Policy Name", - "label": "The full path to the license policy definition.", "conditions": "List of conditions to be met when using this software.", + "label": "The full path to the license policy definition.", + "name": "License policy name", }, ) diff --git a/rules/providers.bzl b/rules/providers.bzl index 676fc79..dd331e2 100644 --- a/rules/providers.bzl +++ b/rules/providers.bzl @@ -17,9 +17,9 @@ LicenseKindInfo = provider( doc = """Provides information about a license kind.""", fields = { - "name": "License Name", - "label": "The full path to the license kind definition.", "conditions": "List of conditions to be met when using this software.", + "label": "The full path to the license kind definition.", + "name": "License Name", }, ) |