Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

[apple] project: Add apple.skip_appex_copy_frameworks_in_xcode. #2601

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/com/facebook/buck/apple/AppleConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,14 @@ public boolean shouldGenerateMissingUmbrellaHeaders() {
return delegate.getBooleanValue(APPLE_SECTION, "generate_missing_umbrella_headers", false);
}

/**
* If true, project generation will skip embedding transitive frameworks within the extension
* binary. This can be a significant disk-usage savings for many projects.
*/
public boolean shouldSkipAppexCopyFrameworksInXcodeProject() {
return delegate.getBooleanValue(APPLE_SECTION, "skip_appex_copy_frameworks_in_xcode", false);
}

public boolean shouldUseSwiftDelegate() {
// TODO(mgd): Remove Swift delegation from Apple rules
return delegate.getBooleanValue(APPLE_SECTION, "use_swift_delegate", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ private PBXNativeTarget generateAppleBundleTarget(
: AppleBuildRules.RecursiveDependenciesMode.COPYING,
targetNode,
Optional.of(xcodeDescriptions.getXCodeDescriptions()));
if (bundleRequiresRemovalOfAllTransitiveFrameworks(targetNode)) {
if (bundleRequiresRemovalOfAllTransitiveFrameworks(targetNode, appleConfig)) {
copiedRules = rulesWithoutFrameworkBundles(copiedRules);
} else if (bundleRequiresAllTransitiveFrameworks(binaryNode, bundleLoaderNode)) {
copiedRules =
Expand Down Expand Up @@ -4750,6 +4750,10 @@ private static boolean isApp(HasAppleBundleFields arg) {
return hasExtension(arg, AppleBundleExtension.APP);
}

private static boolean isAppExtension(HasAppleBundleFields arg) {
return hasExtension(arg, AppleBundleExtension.APPEX);
}

private static boolean hasExtension(HasAppleBundleFields arg, AppleBundleExtension extension) {
return arg.getExtension().isLeft() && arg.getExtension().getLeft().equals(extension);
}
Expand All @@ -4766,8 +4770,10 @@ private static boolean isModularAppleLibrary(TargetNode<?> libraryNode) {
}

private static boolean bundleRequiresRemovalOfAllTransitiveFrameworks(
TargetNode<? extends HasAppleBundleFields> targetNode) {
return isFrameworkBundle(targetNode.getConstructorArg());
TargetNode<? extends HasAppleBundleFields> targetNode, AppleConfig config) {
return isFrameworkBundle(targetNode.getConstructorArg()) ||
(config.shouldSkipAppexCopyFrameworksInXcodeProject() &&
isAppExtension(targetNode.getConstructorArg()));
}

private static boolean bundleRequiresAllTransitiveFrameworks(
Expand Down