@@ -1051,21 +1051,23 @@ pbxProject.prototype.addTarget = function(name, type) {
10511051 ] ;
10521052
10531053 // Build Configuration: Add
1054- var buildConfigurations = this . addXCConfigurationList ( buildConfigurationsList , 'Release' , 'Build configuration list for PBXNativeTarget "' + targetName + '"' ) ,
1055- buildConfigurationsUuid = buildConfigurations . uuid ;
1054+ var buildConfigurations = this . addXCConfigurationList ( buildConfigurationsList , 'Release' , 'Build configuration list for PBXNativeTarget "' + targetName + '"' ) ;
10561055
10571056 // Product: Create
10581057 var productName = targetName ,
10591058 productType = producttypeForTargettype ( targetType ) ,
1060- productFile = this . addProductFile ( productName , { 'explicitFileType' : productType } ) ,
1059+ productFileType = filetypeForProducttype ( productType ) ,
1060+ productFile = this . addProductFile ( productName , { 'target' : targetUuid , 'group' : 'CopyFiles' } ) ,
10611061 productFileName = productFile . basename ;
10621062
1063- // Product: Embed in first target (only for "extension"-type targets)
1063+ // Product: Embed (only for "extension"-type targets)
10641064 if ( targetType === 'app_extension' ) {
1065- var embedPhase ;
1066- var embedFile ;
10671065
1068- // TODO: Add embedding via "PBXCopyFilesBuildPhase" build phase
1066+ // Create "Copy Files" build phase for target which contains the extension
1067+ this . addBuildPhase ( [ ] , 'PBXCopyFilesBuildPhase' , 'CopyFiles' , this . getFirstTarget ( ) . uuid )
1068+
1069+ // Add product reference to "Copy Files" build phase
1070+ this . addCopyfile ( productFileName , { 'explicitFileType' : productFileType , 'target' : this . getFirstTarget ( ) . uuid } )
10691071 } ;
10701072
10711073 // Target: Create
@@ -1077,7 +1079,7 @@ pbxProject.prototype.addTarget = function(name, type) {
10771079 productName : targetName ,
10781080 productReference : productFile . fileRef ,
10791081 productType : '"' + producttypeForTargettype ( targetType ) + '"' ,
1080- buildConfigurationList : buildConfigurationsUuid ,
1082+ buildConfigurationList : buildConfigurations . uuid ,
10811083 buildPhases : [ ] ,
10821084 buildRules : [ ] ,
10831085 dependencies : [ ]
0 commit comments