@@ -800,6 +800,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
800800 }
801801
802802 this . $pluginVariablesService . interpolateAppIdentifier ( this . getPlatformData ( projectData ) . configurationFilePath , projectData . projectIdentifiers . ios ) ;
803+ await this . mergeProjectPodFile ( projectData ) ;
803804 }
804805
805806 private getInfoPlistPath ( projectData : IProjectData ) : string {
@@ -976,34 +977,10 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
976977 this . $cocoapodsService . removePodfileFromProject ( pluginData . name , this . $cocoapodsService . getPluginPodfilePath ( pluginData ) , projectData , projectRoot ) ;
977978 }
978979
979- public async afterPrepareAllPlugins ( projectData : IProjectData ) : Promise < void > {
980- await this . installPodsIfAny ( projectData ) ;
981- }
982-
983- public async installPodsIfAny ( projectData : IProjectData ) : Promise < void > {
980+ public async handleNativeDependenciesChange ( projectData : IProjectData ) : Promise < void > {
984981 const projectRoot = this . getPlatformData ( projectData ) . projectRoot ;
985- const mainPodfilePath = path . join ( projectData . appResourcesDirectoryPath , this . getPlatformData ( projectData ) . normalizedPlatformName , constants . PODFILE_NAME ) ;
986- if ( this . $fs . exists ( this . $cocoapodsService . getProjectPodfilePath ( projectRoot ) ) || this . $fs . exists ( mainPodfilePath ) ) {
987- const xcodeProjPath = this . getXcodeprojPath ( projectData ) ;
988- const xcuserDataPath = path . join ( xcodeProjPath , "xcuserdata" ) ;
989- const sharedDataPath = path . join ( xcodeProjPath , "xcshareddata" ) ;
990-
991- if ( ! this . $fs . exists ( xcuserDataPath ) && ! this . $fs . exists ( sharedDataPath ) ) {
992- this . $logger . info ( "Creating project scheme..." ) ;
993- await this . checkIfXcodeprojIsRequired ( ) ;
994-
995- const createSchemeRubyScript = `ruby -e "require 'xcodeproj'; xcproj = Xcodeproj::Project.open('${ projectData . projectName } .xcodeproj'); xcproj.recreate_user_schemes; xcproj.save"` ;
996- await this . $childProcess . exec ( createSchemeRubyScript , { cwd : this . getPlatformData ( projectData ) . projectRoot } ) ;
997- }
998-
999- await this . $cocoapodsService . applyPodfileToProject ( constants . NS_BASE_PODFILE , mainPodfilePath , projectData , this . getPlatformData ( projectData ) . projectRoot ) ;
1000-
1001- await this . $cocoapodsService . executePodInstall ( projectRoot , xcodeProjPath ) ;
1002- }
1003- }
1004-
1005- public beforePrepareAllPlugins ( ) : Promise < void > {
1006- return Promise . resolve ( ) ;
982+ const xcodeProjPath = this . getXcodeprojPath ( projectData ) ;
983+ await this . $cocoapodsService . executePodInstall ( projectRoot , xcodeProjPath ) ;
1007984 }
1008985
1009986 public async checkForChanges ( changesInfo : IProjectChangesInfo , { provision, teamId } : IProjectChangesOptions , projectData : IProjectData ) : Promise < void > {
@@ -1068,6 +1045,28 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
10681045 return semver . coerce ( target ) ;
10691046 }
10701047
1048+ private async mergeProjectPodFile ( projectData : IProjectData ) : Promise < void > {
1049+ const platformData = this . getPlatformData ( projectData ) ;
1050+ const { projectRoot, normalizedPlatformName } = platformData ;
1051+ const mainPodfilePath = path . join ( projectData . appResourcesDirectoryPath , normalizedPlatformName , constants . PODFILE_NAME ) ;
1052+ const projectPodfilePath = this . $cocoapodsService . getProjectPodfilePath ( projectRoot ) ;
1053+ if ( this . $fs . exists ( projectPodfilePath ) || this . $fs . exists ( mainPodfilePath ) ) {
1054+ const xcodeProjPath = this . getXcodeprojPath ( projectData ) ;
1055+ const xcuserDataPath = path . join ( xcodeProjPath , "xcuserdata" ) ;
1056+ const sharedDataPath = path . join ( xcodeProjPath , "xcshareddata" ) ;
1057+
1058+ if ( ! this . $fs . exists ( xcuserDataPath ) && ! this . $fs . exists ( sharedDataPath ) ) {
1059+ this . $logger . info ( "Creating project scheme..." ) ;
1060+ await this . checkIfXcodeprojIsRequired ( ) ;
1061+
1062+ const createSchemeRubyScript = `ruby -e "require 'xcodeproj'; xcproj = Xcodeproj::Project.open('${ projectData . projectName } .xcodeproj'); xcproj.recreate_user_schemes; xcproj.save"` ;
1063+ await this . $childProcess . exec ( createSchemeRubyScript , { cwd : projectRoot } ) ;
1064+ }
1065+
1066+ await this . $cocoapodsService . applyPodfileToProject ( constants . NS_BASE_PODFILE , mainPodfilePath , projectData , projectRoot ) ;
1067+ }
1068+ }
1069+
10711070 private getAllLibsForPluginWithFileExtension ( pluginData : IPluginData , fileExtension : string ) : string [ ] {
10721071 const filterCallback = ( fileName : string , pluginPlatformsFolderPath : string ) => path . extname ( fileName ) === fileExtension ;
10731072 return this . getAllNativeLibrariesForPlugin ( pluginData , IOSProjectService . IOS_PLATFORM_NAME , filterCallback ) ;
0 commit comments