aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Aiuto <aiuto@google.com>2023-02-08 16:01:29 -0500
committerTony Aiuto <aiuto@google.com>2023-02-08 16:01:29 -0500
commit4c4d2e9c71c5e05faa128943e35f511688217451 (patch)
tree8e2e10f371630db72f2c411df280f53caddcc0ab
parent9a58c10b64b632ed1567d61b91f8167195164922 (diff)
downloadbazelbuild-rules_license-4c4d2e9c71c5e05faa128943e35f511688217451.tar.gz
Grab back of little style nits which will make it easier to
sync this code back and forth with the Google branches. - restore copyright notices (This keeps compliance teams happy) - change public visibilty to restricted ones, so end users can not depend on pieces of the vendored in library - remove printf debugging.
-rw-r--r--examples/my_org/licenses/BUILD2
-rw-r--r--examples/policy_checker/BUILD6
-rw-r--r--examples/policy_checker/license_policy_check.bzl1
-rw-r--r--examples/src/BUILD2
-rw-r--r--examples/vendor/acme/BUILD2
-rw-r--r--examples/vendor/constant_gen/BUILD2
-rw-r--r--examples/vendor/constant_gen/defs.bzl13
-rw-r--r--examples/vendor/libhhgttg/BUILD2
-rw-r--r--tests/BUILD8
-rw-r--r--tests/apps/an_app.cc13
-rw-r--r--tests/apps/an_app_licenses_test.py14
-rw-r--r--tests/legacy/BUILD17
-rw-r--r--tests/legacy/file_under_notice.cc14
-rw-r--r--tests/thrdparty/new_style_lib.cc13
-rw-r--r--tools/checker_demo.py2
15 files changed, 95 insertions, 16 deletions
diff --git a/examples/my_org/licenses/BUILD b/examples/my_org/licenses/BUILD
index f17bfa3..c200d37 100644
--- a/examples/my_org/licenses/BUILD
+++ b/examples/my_org/licenses/BUILD
@@ -66,6 +66,6 @@ license_kind(
license_kind(
name = "acme_corp_paid",
conditions = [
- "whitelist:acme_corp_paid",
+ "allowlist:acme_corp_paid",
],
)
diff --git a/examples/policy_checker/BUILD b/examples/policy_checker/BUILD
index a18bcd2..49f77aa 100644
--- a/examples/policy_checker/BUILD
+++ b/examples/policy_checker/BUILD
@@ -27,11 +27,11 @@ license_policy(
)
license_policy(
- name = "special_whitelisted_app",
- # There could be a whitelist of targets here.
+ name = "special_allowlisted_app",
+ # There could be a allowlist of targets here.
conditions = [
"notice",
- "whitelist:acme_corp_paid",
+ "allowlist:acme_corp_paid",
],
)
diff --git a/examples/policy_checker/license_policy_check.bzl b/examples/policy_checker/license_policy_check.bzl
index 2692a01..32db845 100644
--- a/examples/policy_checker/license_policy_check.bzl
+++ b/examples/policy_checker/license_policy_check.bzl
@@ -45,7 +45,6 @@ def _license_policy_check_impl(ctx):
if LicenseInfo in ctx.attr.target:
for license in ctx.attr.target[LicenseInfo].licenses.to_list():
- print(license)
for kind in license.license_kinds:
# print(kind.conditions)
for condition in kind.conditions:
diff --git a/examples/src/BUILD b/examples/src/BUILD
index 0bcb938..8567e81 100644
--- a/examples/src/BUILD
+++ b/examples/src/BUILD
@@ -18,7 +18,7 @@ load("@rules_license//examples/vendor/constant_gen:defs.bzl", "constant_gen")
package(
default_package_metadata = ["//:license", "//:package_info"],
- default_visibility = ["//visibility:public"],
+ default_visibility = ["//examples:__subpackages__"],
)
cc_binary(
diff --git a/examples/vendor/acme/BUILD b/examples/vendor/acme/BUILD
index 2e98d98..09da19d 100644
--- a/examples/vendor/acme/BUILD
+++ b/examples/vendor/acme/BUILD
@@ -17,7 +17,7 @@ load("@rules_license//rules:license.bzl", "license")
package(
default_applicable_licenses = [":license"],
- default_visibility = ["//visibility:public"],
+ default_visibility = ["//examples:__subpackages__"],
)
# The default license for an entire package is typically named "license".
diff --git a/examples/vendor/constant_gen/BUILD b/examples/vendor/constant_gen/BUILD
index 26e86b6..5f2ff43 100644
--- a/examples/vendor/constant_gen/BUILD
+++ b/examples/vendor/constant_gen/BUILD
@@ -19,7 +19,7 @@ load(":defs.bzl", "constant_gen")
package(
default_applicable_licenses = [":license"],
- default_visibility = ["//visibility:public"],
+ default_visibility = ["//examples:__subpackages__"],
)
# The default license for an entire package is typically named "license".
diff --git a/examples/vendor/constant_gen/defs.bzl b/examples/vendor/constant_gen/defs.bzl
index f3eb715..33aa419 100644
--- a/examples/vendor/constant_gen/defs.bzl
+++ b/examples/vendor/constant_gen/defs.bzl
@@ -1,3 +1,16 @@
+# Copyright 2020 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.
"""A trivial rule to turn a string into a C++ constant."""
def _constant_gen_impl(ctx):
diff --git a/examples/vendor/libhhgttg/BUILD b/examples/vendor/libhhgttg/BUILD
index 15c7655..b9e3991 100644
--- a/examples/vendor/libhhgttg/BUILD
+++ b/examples/vendor/libhhgttg/BUILD
@@ -20,7 +20,7 @@ load("@rules_license//rules:license.bzl", "license")
# license.
package(
default_applicable_licenses = [":license"],
- default_visibility = ["//visibility:public"],
+ default_visibility = ["//examples:__subpackages__"],
)
# The default license for an entire package is typically named "license".
diff --git a/tests/BUILD b/tests/BUILD
index 1d7961f..a031df3 100644
--- a/tests/BUILD
+++ b/tests/BUILD
@@ -74,10 +74,10 @@ cc_library(
":license_for_extra_feature",
":internal_non_compliance_license",
],
- #deps = [
- # "@rules_license//rules/tests/legacy:another_library_with_legacy_license_clause",
- # "@rules_license//rules/tests/legacy:library_with_legacy_license_clause",
- #],
+ deps = [
+ "@rules_license//tests/legacy:another_library_with_legacy_license_clause",
+ "@rules_license//tests/legacy:library_with_legacy_license_clause",
+ ],
)
java_binary(
diff --git a/tests/apps/an_app.cc b/tests/apps/an_app.cc
index 410f986..60f6fc5 100644
--- a/tests/apps/an_app.cc
+++ b/tests/apps/an_app.cc
@@ -1,3 +1,16 @@
+// 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.
#include <iostream>
#include <ostream>
diff --git a/tests/apps/an_app_licenses_test.py b/tests/apps/an_app_licenses_test.py
index 9899e6c..0dbf8fb 100644
--- a/tests/apps/an_app_licenses_test.py
+++ b/tests/apps/an_app_licenses_test.py
@@ -1,4 +1,16 @@
-"""Tests for google3.tools.build_defs.license.tests.apps.an_app_licenses."""
+# 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.
import os
diff --git a/tests/legacy/BUILD b/tests/legacy/BUILD
new file mode 100644
index 0000000..e065e22
--- /dev/null
+++ b/tests/legacy/BUILD
@@ -0,0 +1,17 @@
+# Example of an unmigrated package.
+
+package(default_visibility = [
+ "//tests:__subpackages__",
+])
+
+licenses(["unencumbered"])
+
+cc_library(
+ name = "library_with_legacy_license_clause",
+ srcs = ["file_under_notice.cc"],
+)
+
+cc_library(
+ name = "another_library_with_legacy_license_clause",
+ srcs = ["file_under_notice.cc"],
+)
diff --git a/tests/legacy/file_under_notice.cc b/tests/legacy/file_under_notice.cc
new file mode 100644
index 0000000..2fa8bfc
--- /dev/null
+++ b/tests/legacy/file_under_notice.cc
@@ -0,0 +1,14 @@
+// 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.
+int file_under_notice = 1;
diff --git a/tests/thrdparty/new_style_lib.cc b/tests/thrdparty/new_style_lib.cc
index 545e5b4..0c739b9 100644
--- a/tests/thrdparty/new_style_lib.cc
+++ b/tests/thrdparty/new_style_lib.cc
@@ -1,3 +1,16 @@
+// 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.
#include <iostream>
#include <ostream>
diff --git a/tools/checker_demo.py b/tools/checker_demo.py
index 1075621..6cdf07f 100644
--- a/tools/checker_demo.py
+++ b/tools/checker_demo.py
@@ -90,7 +90,6 @@ def _do_copyright_notices(out, licenses):
if l.get('package_version'):
name = name + "/" + l['package_version']
# IGNORE_COPYRIGHT: Not a copyright notice. It is a variable holding one.
- print(l)
out.write('package(%s), copyright(%s)\n' % (name, l['copyright_notice']))
@@ -122,7 +121,6 @@ def main():
top_level_target = target['top_level_target']
dependencies = target['dependencies']
licenses = target['licenses']
- print(licenses)
err = 0
with codecs.open(args.report, mode='w', encoding='utf-8') as rpt: