Skip to content

Commit 60dbe3f

Browse files
committed
Add missing frameworks to macOS SDK
1 parent 7fd74ab commit 60dbe3f

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

bazel/detail/xcode/find.bzl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
def _find_xcode_sdk(rctx):
2+
# Find the Xcode SDK
23
result = rctx.execute([rctx.path(Label("find.sh")), rctx.attr.sdk])
34
if result.return_code != 0:
45
fail("could not find sdk `{}`, do you have xcode installed?\n{}".format(rctx.attr.sdk, result.stderr))
5-
sdk_path = rctx.path(result.stdout.strip())
6-
for child in sdk_path.readdir():
7-
rctx.symlink(child, child.basename)
6+
sdk_path = str(rctx.path(result.stdout.strip()).realpath)
7+
8+
# Copy the SDK to this repository, but exclude the Ruby framework, which has recursive symlinks that break Bazel glob
9+
ruby_framework = "System/Library/Frameworks/Ruby.framework"
10+
result = rctx.execute(["rsync", "-a", "--exclude", ruby_framework, sdk_path + "/", "."])
11+
if result.return_code != 0:
12+
fail("could not copy sdk:\n{}".format(result.stderr))
813
rctx.file("BUILD", rctx.read(Label("sdk.BUILD")))
914

1015
find_xcode_sdk = repository_rule(

bazel/detail/xcode/sdk.BUILD

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ load("@rules_cc//cc/toolchains/args:sysroot.bzl", "cc_sysroot")
33

44
directory(
55
name = "sdk_link",
6-
srcs = glob([
7-
"usr/include/**/*",
8-
"usr/lib/**/*",
9-
"System/Library/Frameworks/CoreFoundation.framework/**/*",
10-
"System/Library/Frameworks/IOKit.framework/**/*",
11-
"System/Library/Frameworks/Security.framework/**/*",
12-
]),
6+
srcs = glob(
7+
[
8+
"usr/include/**/*",
9+
"usr/lib/**/*",
10+
"System/Library/Frameworks/**/*",
11+
],
12+
),
1313
)
1414

1515
cc_sysroot(

0 commit comments

Comments
 (0)