From fbc5cb6baaf829d035053960f6608483508153e5 Mon Sep 17 00:00:00 2001 From: Chenchu K Date: Mon, 27 Jun 2022 17:33:07 -0500 Subject: [PATCH] Preserve --experimental_allow_unresolved_symlinks in exec cfg (#15737) See https://github.com/bazelbuild/bazel/issues/10298#issuecomment-1097097541 Work towards https://github.com/bazelbuild/bazel/issues/10298 Closes #15702. PiperOrigin-RevId: 456480627 Change-Id: Ib1237ce9e2c0bab0d7eabd8743f08ec60b8b7ab7 Co-authored-by: Fabian Meumertzheim --- .../build/lib/analysis/config/CoreOptions.java | 1 + src/test/shell/bazel/bazel_symlink_test.sh | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java b/src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java index c2d17a49d8ff6b..3a8f0865beafc1 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java @@ -877,6 +877,7 @@ public FragmentOptions getHost() { host.archivedArtifactsMnemonicsFilter = archivedArtifactsMnemonicsFilter; host.enableAspectHints = enableAspectHints; + host.allowUnresolvedSymlinks = allowUnresolvedSymlinks; return host; } diff --git a/src/test/shell/bazel/bazel_symlink_test.sh b/src/test/shell/bazel/bazel_symlink_test.sh index c8e2ba7fcb71fa..0a426cc29f2887 100755 --- a/src/test/shell/bazel/bazel_symlink_test.sh +++ b/src/test/shell/bazel/bazel_symlink_test.sh @@ -584,4 +584,21 @@ EOF expect_log "cycle in dependency graph" } +function test_unresolved_symlink_in_exec_cfg() { + mkdir -p a + cat > a/BUILD <<'EOF' +load("//symlink:symlink.bzl", "dangling_symlink") +dangling_symlink(name="a", link_target="non/existent") +genrule( + name = "exec", + srcs = [], + outs = ["out"], + cmd = "touch $@", + exec_tools = [":a"], +) +EOF + + bazel --windows_enable_symlinks build --experimental_allow_unresolved_symlinks //a:exec || fail "build failed" +} + run_suite "Tests for symlink artifacts"