aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornickreid <nickreid@google.com>2023-03-08 16:22:01 -0800
committerCopybara-Service <copybara-worker@google.com>2023-03-08 16:24:10 -0800
commit9e05ad19369bcc1f442a2f219c948a86834dc264 (patch)
treec562c4b8abb303385cf015c610de974eed0d6be6
parent8b2fab88a2d8f64780ac4baab4324fd49d00628b (diff)
downloadbazelbuild-kotlin-rules-9e05ad19369bcc1f442a2f219c948a86834dc264.tar.gz
n/a
PiperOrigin-RevId: 515172115 Change-Id: I40c67c36260ca866edcd84771642d956fe4edf25
-rw-r--r--bazel/stubs.bzl3
-rw-r--r--kotlin/compiler_opt.bzl7
2 files changed, 5 insertions, 5 deletions
diff --git a/bazel/stubs.bzl b/bazel/stubs.bzl
index 19f0e54..5d041f4 100644
--- a/bazel/stubs.bzl
+++ b/bazel/stubs.bzl
@@ -51,3 +51,6 @@ lint_actions = struct(
run_lint_on_library = _run_lint_on_library,
get_android_lint_baseline_file = _empty_fn,
)
+
+def check_compiler_opt_allowlist(_label):
+ pass
diff --git a/kotlin/compiler_opt.bzl b/kotlin/compiler_opt.bzl
index 07f3c86..a44fdfc 100644
--- a/kotlin/compiler_opt.bzl
+++ b/kotlin/compiler_opt.bzl
@@ -24,6 +24,7 @@ be passed to the `custom_kotlincopts` attribute. The set of directories that all
`kt_compiler_opt` targets is also limited, to prevent misuse.
"""
+load("//bazel:stubs.bzl", "check_compiler_opt_allowlist")
load("//:visibility.bzl", "RULES_DEFS_THAT_COMPILE_KOTLIN")
# Intentionally private to prevent misuse.
@@ -32,17 +33,13 @@ _KtCompilerOptInfo = provider(
fields = {"opts": "list[string]"},
)
-_ALLOWED_ROOTS = [
-]
-
_ALLOWED_VISIBILITY_NAMES = [
"__pkg__",
"__subpackages__",
]
def _kt_compiler_opt_impl(ctx):
- if not any([ctx.label.package.startswith(p) for p in _ALLOWED_ROOTS]):
- fail("kt_compiler_opt is only allowed under " + str(_ALLOWED_ROOTS))
+ check_compiler_opt_allowlist(ctx.label)
visibility_groups = [v for v in ctx.attr.visibility if not v.name in _ALLOWED_VISIBILITY_NAMES]
if len(visibility_groups) > 0: