Skip to content

Commit

Permalink
fix: non-experimental allow_unresolved_symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedard committed Jun 6, 2023
1 parent 2f64180 commit 870b539
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ config_setting(
visibility = ["//visibility:public"],
)

config_setting(
alias(
name = "experimental_allow_unresolved_symlinks",
values = {"experimental_allow_unresolved_symlinks": "true"},
actual = "@aspect_config_settings//:allow_unresolved_symlinks",
visibility = ["//visibility:public"],
)

Expand Down
24 changes: 24 additions & 0 deletions js/private/repository_utils.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
Repository rule utilities.
"""

load("@bazel_skylib//lib:versions.bzl", "versions")

def _config_settings_impl(rctx):
prop = "experimental_allow_unresolved_symlinks"
if versions.get() == "" or versions.is_at_least("6.3", versions.get()):
prop = "allow_unresolved_symlinks"

rctx.file("BUILD.bazel", """# @generated by @aspect_rules_js//js/private:repository_utils.bzl
config_setting(
name = "allow_unresolved_symlinks",
values = {values},
visibility = ["//visibility:public"],
)
""".format(values = dict([(prop, "true")])))

config_settings = repository_rule(
implementation = _config_settings_impl,
attrs = {},
)
5 changes: 5 additions & 0 deletions js/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ See https://docs.bazel.build/versions/main/skylark/deploying.html#dependencies
"""

load("//js/private:maybe.bzl", http_archive = "maybe_http_archive")
load("//js/private:repository_utils.bzl", _config_settings = "config_settings")

def rules_js_dependencies():
http_archive(
Expand All @@ -25,3 +26,7 @@ def rules_js_dependencies():
strip_prefix = "bazel-lib-1.32.1",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.32.1/bazel-lib-v1.32.1.tar.gz",
)

_config_settings(
name = "aspect_config_settings",
)

0 comments on commit 870b539

Please sign in to comment.