Skip to content

Commit 1224ab2

Browse files
mavitalemetafacebook-github-bot
authored andcommitted
Pass full set of targets being focused into target_factory to scope dependency generation
Summary: # Context App targets that contain app extension targets need to set up explicit target dependencies on the app extension targets. This is similar to D60223003, where we set up target dependencies for UI tests, so we can reuse much of the infrastructure from there. Here's a diff of our Xcode project before and after manually adding the target dependency in the f2-with-extensions project spec: https://www.internalfb.com/phabricator/paste/view/P1724920080?view=diff --- So we need to add 2 things for each app extension target in the project: ## 1. A PBXContainerItemProxy ``` /* Begin PBXContainerItemProxy section */ 8F4F81192D51C2DF00E9EC84 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 2D699AA517DD0EA4E6F454A2 /* Project object */; proxyType = 1; remoteGlobalIDString = FF2546F571E94DE085D0A99B; remoteInfo = FocusPlaygroundShareExtension; }; /* End PBXContainerItemProxy section */ ``` Needs: 1. PBXProject's reference 2. App extension target's PBXNativeTarget's name and reference ## 2. PBXTargetDependency ``` /* Begin PBXTargetDependency section */ 8F4F811A2D51C2DF00E9EC84 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = FF2546F571E94DE085D0A99B /* FocusPlaygroundShareExtension */; targetProxy = 8F4F81192D51C2DF00E9EC84 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ ``` Needs: 1. PBXContainerItemProxy's reference (Get from #1) 2. App extension target's reference --- ## Add all of the app extension PBXTargetDependency identifiers to the containing app's dependency list: ``` 738F5F018A4B4BF20629BF02 /* FocusPlayground */ = { isa = PBXNativeTarget; buildConfigurationList = 6A55E7FA57E7AAB88FF7C0E1 /* Build configuration list for PBXNativeTarget "FocusPlayground" */; buildPhases = ( D243AE6F52E0F92791974A8D /* Buck Prebuild */, 0579C1CFF2E1E6055656AEAB /* Buck Build */, ); buildRules = ( ); dependencies = ( + 8F4F811A2D51C2DF00E9EC84 /* PBXTargetDependency */, ); name = FocusPlayground; productName = FocusPlayground; productReference = 7A5EBA4A826A7828EEA9F8C3 /* FocusPlayground.app */; productType = "com.apple.product-type.application"; }; ``` Needs: 1. All app extension PBXTargetDependency references (Get from #2) --- Much like in D60223003, we'll need to generate the PBXContainerItemProxy and PBXTargetDependency objects in the aggregate stage, because only then will we know all the different targets being generated and be able to understand the relationships between them. For generating the list of dependencies, we'll need to pass through a list of app extension dependencies from the app bundle and generate the references in the partial target generation. This does mean at some stage we'll need to filter the list of app extension to only those targets *currently being focused*. # This Diff Not all app extension dependencies are necessarily going to be focused, so we don't want to generate an app extension dependency reference to an app extension that isn't going to actually be a target in the Xcode project (and therefore won't generate a PBXTargetDependency/PBXContainerItemProxy in the project file to resolve the reference). Differential Revision: D69339302 fbshipit-source-id: 4b1859f4a524b0fca4b0d489aa48db9532ece22d
1 parent d7c097b commit 1224ab2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

prelude/ide_integrations/xcode/data.bzl

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ XcodeDataInfoKeys = struct(
3333
SRCS = "srcs",
3434
SWIFT_VERSION = "swift_version",
3535
TARGET = "target",
36+
TARGETS_BEING_FOCUSED = "targets_being_focused",
3637
TEST_HOST_APP_BINARY = "test_host_app_binary",
3738
TEST_HOST_APP_TARGET = "test_host_app_target",
3839
TEST_TARGET = "test_target",

0 commit comments

Comments
 (0)