aboutsummaryrefslogtreecommitdiff
path: root/examples/src/BUILD
diff options
context:
space:
mode:
Diffstat (limited to 'examples/src/BUILD')
-rw-r--r--examples/src/BUILD79
1 files changed, 46 insertions, 33 deletions
diff --git a/examples/src/BUILD b/examples/src/BUILD
index 29b6803..cd5e985 100644
--- a/examples/src/BUILD
+++ b/examples/src/BUILD
@@ -1,17 +1,30 @@
+# 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.
# Examples of applications and interactions with licenses
-load("@rules_license//examples/vendor/constant_gen:defs.bzl", "constant_gen")
-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")
+load("@rules_license//rules:compliance.bzl", "check_license", "licenses_used")
+load("@rules_license//examples/vndor/constant_gen:defs.bzl", "constant_gen")
+
+package(
+ default_package_metadata = ["//:license", "//:package_info"],
+ default_visibility = ["//examples:__subpackages__"],
+)
cc_binary(
name = "my_server",
srcs = ["server.cc"],
- deps = [
- ":message",
- "@rules_license//examples/vendor/libhhgttg",
- ],
+ deps = [":message"],
)
# Sample
@@ -21,32 +34,17 @@ constant_gen(
var = "server_message",
)
-license_policy_check(
+# TODO(aiuto): Turn this strictly into a compliance test.
+check_license(
name = "check_server",
- policy = "@rules_license//examples/my_org/compliance:production_service",
- target = ":my_server",
-)
-
-cc_binary(
- name = "my_violating_server",
- srcs = ["server.cc"],
+ check_conditions = False,
+ license_texts = "server_licenses.txt",
+ report = "server_report.txt",
deps = [
- ":message",
- "@rules_license//examples/vendor/acme",
- "@rules_license//examples/vendor/libhhgttg",
+ ":my_server",
],
)
-license_policy_check(
- name = "check_violating_server",
- policy = "@rules_license//examples/my_org/compliance:production_service",
- tags = [
- "manual",
- "notap",
- ],
- target = ":my_violating_server",
-)
-
#
# Verify the licenses are what we expect. The golden output shows that
# :my_server only uses the unencumbered license type.
@@ -57,8 +55,23 @@ licenses_used(
deps = [":my_server"],
)
-golden_test(
- name = "verify_server_licenses_test",
- golden = "server_licenses.golden",
- subject = ":server_licenses.json",
+py_test(
+ name = "server_licenses_test",
+ srcs = ["server_licenses_test.py"],
+ data = [":server_licenses.json"],
+ python_version = "PY3",
+ deps = [
+ "@rules_license//tests:license_test_utils",
+ ],
+)
+
+# This server uses something under a restricted license
+cc_binary(
+ name = "my_violating_server",
+ srcs = ["server.cc"],
+ deps = [
+ ":message",
+ "@rules_license//examples/vndor/acme",
+ "@rules_license//examples/vndor/libhhgttg",
+ ],
)