aboutsummaryrefslogtreecommitdiff
path: root/examples/my_org
diff options
context:
space:
mode:
authorSasha Smundak <asmundak@google.com>2022-09-17 03:07:33 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-09-17 03:07:33 +0000
commit8a99d2b6dff36f04be445f3c5e8f69874da57a04 (patch)
treec87a7c540efe9da13cb94870d8e09efeba88f63f /examples/my_org
parent56590b14f8ec08644614fa10ac9cdc17abd8eee9 (diff)
parentdf3b8d7aa1d57f6ee108a023e90860f1e372cb4b (diff)
downloadbazelbuild-rules_license-8a99d2b6dff36f04be445f3c5e8f69874da57a04.tar.gz
Merge remote-tracking branch 'aosp/upstream-main' into notice am: d5f1fc8147 am: 64bd397324 am: 50783bf43b am: e66c3e756d am: df3b8d7aa1
Original change: https://android-review.googlesource.com/c/platform/external/bazelbuild-rules_license/+/2189019 Change-Id: Ia6eec35387b885fdb37d7dda99722511a43e093b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'examples/my_org')
-rw-r--r--examples/my_org/compliance/BUILD31
-rw-r--r--examples/my_org/licenses/BUILD58
2 files changed, 89 insertions, 0 deletions
diff --git a/examples/my_org/compliance/BUILD b/examples/my_org/compliance/BUILD
new file mode 100644
index 0000000..074b21e
--- /dev/null
+++ b/examples/my_org/compliance/BUILD
@@ -0,0 +1,31 @@
+# Example license policy definitions.
+
+load("@rules_license//rules:license_policy.bzl", "license_policy")
+
+package(default_visibility = ["//examples:__subpackages__"])
+
+# license_policy rules generally appear in a central location per workspace. They
+# are intermingled with normal target build rules
+license_policy(
+ name = "production_service",
+ conditions = [
+ "notice",
+ "restricted_if_statically_linked",
+ ],
+)
+
+license_policy(
+ name = "mobile_application",
+ conditions = [
+ "notice",
+ ],
+)
+
+license_policy(
+ name = "special_whitelisted_app",
+ # There could be a whitelist of targets here.
+ conditions = [
+ "notice",
+ "whitelist:acme_corp_paid",
+ ],
+)
diff --git a/examples/my_org/licenses/BUILD b/examples/my_org/licenses/BUILD
new file mode 100644
index 0000000..d9d5c25
--- /dev/null
+++ b/examples/my_org/licenses/BUILD
@@ -0,0 +1,58 @@
+# Example license kind definitions.
+
+# We expect that all license_kind rules used by an organization exist in a
+# central place in their source repository.
+#
+# - This allows centralized audit and, with suport from the SCM, an assurance
+# that individual developers are not adding new license kinds to the code
+# base without authorization.
+# - When third party packages are used, they might come with license rules
+# pointing to well known license_kinds from @rules_license/licenses.
+# At import time, users can mechanically transform those target paths from
+# @rules_license to their own license_kind repository.
+# - The conditions for each license_kind may be customized for the organzation's
+# needs, and not match the conditions used by the canonical versions from
+# @rules_license.
+# - In rare cases, a third_party project will define their own license_kinds.
+# There is no reasonable automatic handling of that. Organizations will have
+# to hand inspect the license text to see if it matches the conditions, and
+# then will have to hand import it to their private license_kind repository.
+
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+
+package(default_visibility = ["//examples:__subpackages__"])
+
+# license_kind rules generally appear in a central location per workspace. They
+# are intermingled with normal target build rules
+license_kind(
+ name = "generic_notice",
+ conditions = [
+ "notice",
+ ],
+)
+
+license_kind(
+ name = "generic_restricted",
+ conditions = [
+ "restricted",
+ ],
+)
+
+license_kind(
+ name = "unencumbered",
+ conditions = [], # none
+)
+
+license_kind(
+ name = "lgpl_like",
+ conditions = [
+ "restricted_if_statically_linked",
+ ],
+)
+
+license_kind(
+ name = "acme_corp_paid",
+ conditions = [
+ "whitelist:acme_corp_paid",
+ ],
+)