If the target apple_binary is a loadable_bundle, always pass the rpath flag to the linker.
@@ -235,6 +235,7 @@ public class AppleBinary implements RuleConfiguredTargetFactory {
switch (binaryType) {
case LOADABLE_BUNDLE:
extraLinkArgs.add("-bundle");
+ extraLinkArgs.add("-Xlinker", "-rpath", "-Xlinker", "@loader_path/Frameworks");
if (didProvideBundleLoader) {
AppleExecutableBinaryProvider executableProvider =
(AppleExecutableBinaryProvider) ruleContext.getPrerequisite(
@@ -242,7 +243,6 @@ public class AppleBinary implements RuleConfiguredTargetFactory {
AppleExecutableBinaryProvider.SKYLARK_CONSTRUCTOR.getKey());
extraLinkArgs.add(
"-bundle_loader", executableProvider.getAppleExecutableBinary().getExecPathString());
- extraLinkArgs.add("-Xlinker", "-rpath", "-Xlinker", "@loader_path/Frameworks");
}
break;
case DYLIB:
