aboutsummaryrefslogtreecommitdiff
path: root/kotlin/compiler_opt.bzl
diff options
context:
space:
mode:
Diffstat (limited to 'kotlin/compiler_opt.bzl')
-rw-r--r--kotlin/compiler_opt.bzl9
1 files changed, 4 insertions, 5 deletions
diff --git a/kotlin/compiler_opt.bzl b/kotlin/compiler_opt.bzl
index e7a89d5..a44fdfc 100644
--- a/kotlin/compiler_opt.bzl
+++ b/kotlin/compiler_opt.bzl
@@ -24,23 +24,22 @@ 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.
_KtCompilerOptInfo = provider(
doc = "A restricted set of kotlinc opts",
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: