@@ -771,28 +771,39 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
771771 this . $logger . trace ( `Images to remove from xcode project: ${ imagesToRemove . join ( ", " ) } ` ) ;
772772 _ . each ( imagesToRemove , image => project . removeResourceFile ( path . join ( this . getAppResourcesDestinationDirectoryPath ( projectData ) , image ) ) ) ;
773773
774+ await this . prepareNativeSourceCode ( constants . TNS_NATIVE_SOURCE_GROUP_NAME , path . join ( projectData . getAppResourcesDirectoryPath ( ) , constants . APP_RESOURCES_FOLDER_NAME , this . getPlatformData ( projectData ) . normalizedPlatformName , constants . NATIVE_SOURCE_FOLDER ) , projectData ) ;
775+
774776 this . savePbxProj ( project , projectData ) ;
775777 }
778+
776779 }
777780
778781 public prepareAppResources ( appResourcesDirectoryPath : string , projectData : IProjectData ) : void {
779782 const platformFolder = path . join ( appResourcesDirectoryPath , this . getPlatformData ( projectData ) . normalizedPlatformName ) ;
780783 const filterFile = ( filename : string ) => this . $fs . deleteFile ( path . join ( platformFolder , filename ) ) ;
781784
782785 filterFile ( this . getPlatformData ( projectData ) . configurationFileName ) ;
786+ filterFile ( constants . PODFILE_NAME ) ;
787+
788+ // src folder should not be copied as the pbxproject will have references to its files
789+ this . $fs . deleteDirectory ( path . join ( appResourcesDirectoryPath , this . getPlatformData ( projectData ) . normalizedPlatformName , constants . NATIVE_SOURCE_FOLDER ) ) ;
783790
784791 this . $fs . deleteDirectory ( this . getAppResourcesDestinationDirectoryPath ( projectData ) ) ;
785792 }
786793
787- public async processConfigurationFilesFromAppResources ( release : boolean , projectData : IProjectData ) : Promise < void > {
788- await this . mergeInfoPlists ( { release } , projectData ) ;
794+ public async processConfigurationFilesFromAppResources ( projectData : IProjectData , opts : { release : boolean , installPods : boolean } ) : Promise < void > {
795+ await this . mergeInfoPlists ( { release : opts . release } , projectData ) ;
789796 await this . $iOSEntitlementsService . merge ( projectData ) ;
790- await this . mergeProjectXcconfigFiles ( release , projectData ) ;
797+ await this . mergeProjectXcconfigFiles ( opts . release , projectData ) ;
791798 for ( const pluginData of await this . getAllInstalledPlugins ( projectData ) ) {
792799 await this . $pluginVariablesService . interpolatePluginVariables ( pluginData , this . getPlatformData ( projectData ) . configurationFilePath , projectData . projectDir ) ;
793800 }
794801
795802 this . $pluginVariablesService . interpolateAppIdentifier ( this . getPlatformData ( projectData ) . configurationFilePath , projectData . projectIdentifiers . ios ) ;
803+
804+ if ( opts . installPods ) {
805+ await this . installPodsIfAny ( projectData ) ;
806+ }
796807 }
797808
798809 private getInfoPlistPath ( projectData : IProjectData ) : string {
@@ -955,7 +966,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
955966 await this . prepareStaticLibs ( pluginPlatformsFolderPath , pluginData , projectData ) ;
956967
957968 const projectRoot = this . getPlatformData ( projectData ) . projectRoot ;
958- await this . $cocoapodsService . applyPluginPodfileToProject ( pluginData , projectData , projectRoot ) ;
969+ await this . $cocoapodsService . applyPodfileToProject ( pluginData . name , this . $cocoapodsService . getPluginPodfilePath ( pluginData ) , projectData , projectRoot ) ;
959970 }
960971
961972 public async removePluginNativeCode ( pluginData : IPluginData , projectData : IProjectData ) : Promise < void > {
@@ -966,12 +977,17 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
966977 this . removeStaticLibs ( pluginPlatformsFolderPath , pluginData , projectData ) ;
967978 const projectRoot = this . getPlatformData ( projectData ) . projectRoot ;
968979
969- this . $cocoapodsService . removePluginPodfileFromProject ( pluginData , projectData , projectRoot ) ;
980+ this . $cocoapodsService . removePodfileFromProject ( pluginData . name , this . $cocoapodsService . getPluginPodfilePath ( pluginData ) , projectData , projectRoot ) ;
970981 }
971982
972983 public async afterPrepareAllPlugins ( projectData : IProjectData ) : Promise < void > {
984+ await this . installPodsIfAny ( projectData ) ;
985+ }
986+
987+ public async installPodsIfAny ( projectData : IProjectData ) : Promise < void > {
973988 const projectRoot = this . getPlatformData ( projectData ) . projectRoot ;
974- if ( this . $fs . exists ( this . $cocoapodsService . getProjectPodfilePath ( projectRoot ) ) ) {
989+ const mainPodfilePath = path . join ( projectData . appResourcesDirectoryPath , this . getPlatformData ( projectData ) . normalizedPlatformName , constants . PODFILE_NAME ) ;
990+ if ( this . $fs . exists ( this . $cocoapodsService . getProjectPodfilePath ( projectRoot ) ) || this . $fs . exists ( mainPodfilePath ) ) {
975991 const xcodeProjPath = this . getXcodeprojPath ( projectData ) ;
976992 const xcuserDataPath = path . join ( xcodeProjPath , "xcuserdata" ) ;
977993 const sharedDataPath = path . join ( xcodeProjPath , "xcshareddata" ) ;
@@ -984,6 +1000,8 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
9841000 await this . $childProcess . exec ( createSchemeRubyScript , { cwd : this . getPlatformData ( projectData ) . projectRoot } ) ;
9851001 }
9861002
1003+ await this . $cocoapodsService . applyPodfileToProject ( constants . NS_BASE_PODFILE , mainPodfilePath , projectData , this . getPlatformData ( projectData ) . projectRoot ) ;
1004+
9871005 await this . $cocoapodsService . executePodInstall ( projectRoot , xcodeProjPath ) ;
9881006 }
9891007 }
@@ -1094,9 +1112,9 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
10941112 this . $fs . rename ( path . join ( fileRootLocation , oldFileName ) , path . join ( fileRootLocation , newFileName ) ) ;
10951113 }
10961114
1097- private async prepareNativeSourceCode ( pluginName : string , pluginPlatformsFolderPath : string , projectData : IProjectData ) : Promise < void > {
1115+ private async prepareNativeSourceCode ( groupName : string , sourceFolderPath : string , projectData : IProjectData ) : Promise < void > {
10981116 const project = this . createPbxProj ( projectData ) ;
1099- const group = this . getRootGroup ( pluginName , pluginPlatformsFolderPath ) ;
1117+ const group = this . getRootGroup ( groupName , sourceFolderPath ) ;
11001118 project . addPbxGroup ( group . files , group . name , group . path , null , { isMain : true } ) ;
11011119 project . addToHeaderSearchPaths ( group . path ) ;
11021120 this . savePbxProj ( project , projectData ) ;
0 commit comments