Skip to content

Commit 11b5037

Browse files
allevatoswiple-rules-gardener
authored andcommitted
Add @loader_path/Frameworks rpath when building frameworks, as Xcode does (at least in 26.0 and later; I haven't tested earlier versions).
PiperOrigin-RevId: 852737838
1 parent a22b5d0 commit 11b5037

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

apple/internal/rule_support.bzl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ _RULE_TYPE_DESCRIPTORS = {
212212
# Application.app/Frameworks/Framework.framework/Framework
213213
# Frameworks are packaged in Application.app/Frameworks
214214
"@executable_path/Frameworks",
215+
# Xcode also adds this path when building frameworks.
216+
"@loader_path/Frameworks",
215217
],
216218
),
217219
# ios_imessage_application
@@ -454,6 +456,8 @@ _RULE_TYPE_DESCRIPTORS = {
454456
# Application.app/Frameworks/Framework.framework/Framework
455457
# Frameworks are packaged in Application.app/Frameworks
456458
"@executable_path/Frameworks",
459+
# Xcode also adds this path when building frameworks.
460+
"@loader_path/Frameworks",
457461
],
458462
),
459463
# tvos_static_framework
@@ -522,6 +526,8 @@ _RULE_TYPE_DESCRIPTORS = {
522526
# Application.app/Frameworks/Framework.framework/Framework
523527
# Frameworks are packaged in Application.app/Frameworks
524528
"@executable_path/Frameworks",
529+
# Xcode also adds this path when building frameworks.
530+
"@loader_path/Frameworks",
525531
],
526532
),
527533
# visionos_unit_test
@@ -614,6 +620,8 @@ _RULE_TYPE_DESCRIPTORS = {
614620
# Application.app/Frameworks/Framework.framework/Framework
615621
# Frameworks are packaged in Application.app/Frameworks
616622
"@executable_path/Frameworks",
623+
# Xcode also adds this path when building frameworks.
624+
"@loader_path/Frameworks",
617625
],
618626
),
619627
# watchos_ui_test

test/starlark_tests/ios_framework_tests.bzl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ def ios_framework_test_suite(name):
8383
build_type = "simulator",
8484
target_under_test = "//test/starlark_tests/targets_under_test/ios:fmwk",
8585
binary_test_file = "$BUNDLE_ROOT/fmwk",
86-
macho_load_commands_contain = ["name @rpath/fmwk.framework/fmwk (offset 24)"],
86+
macho_load_commands_contain = [
87+
"name @rpath/fmwk.framework/fmwk (offset 24)",
88+
"path @executable_path/Frameworks (offset 12)",
89+
"path @loader_path/Frameworks (offset 12)",
90+
],
8791
contains = [
8892
"$BUNDLE_ROOT/fmwk",
8993
"$BUNDLE_ROOT/Headers/common.h",

test/starlark_tests/tvos_framework_tests.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ def tvos_framework_test_suite(name):
101101
binary_test_file = "$BUNDLE_ROOT/fmwk",
102102
macho_load_commands_contain = [
103103
"name @rpath/fmwk.framework/fmwk (offset 24)",
104+
"path @executable_path/Frameworks (offset 12)",
105+
"path @loader_path/Frameworks (offset 12)",
104106
],
105107
tags = [name],
106108
)

test/starlark_tests/watchos_framework_tests.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ def watchos_framework_test_suite(name):
9090
binary_test_file = "$BUNDLE_ROOT/fmwk",
9191
macho_load_commands_contain = [
9292
"name @rpath/fmwk.framework/fmwk (offset 24)",
93+
"path @executable_path/Frameworks (offset 12)",
94+
"path @loader_path/Frameworks (offset 12)",
9395
],
9496
tags = [name],
9597
)

0 commit comments

Comments
 (0)