@@ -263,13 +263,24 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
263263 this . savePbxProj ( project ) . wait ( ) ;
264264 }
265265
266+ if ( this . $fs . exists ( this . projectPodFilePath ) . wait ( ) && this . $fs . getFsStats ( this . projectPodFilePath ) . wait ( ) . mtime < this . $fs . getFsStats ( this . $projectData . projectFilePath ) . wait ( ) . mtime ) {
267+ try {
268+ this . $childProcess . exec ( "pod install" , { cwd : this . platformData . projectRoot } ) . wait ( ) ;
269+ } catch ( e ) {
270+ this . $errors . failWithoutHelp ( "CocoaPods are not installed. Run `sudo gem install cocoapods` and try again." ) ;
271+ }
272+ }
266273 } ) . future < void > ( ) ( ) ;
267274 }
268275
269276 public prepareAppResources ( appResourcesDirectoryPath : string ) : IFuture < void > {
270277 return this . $fs . deleteDirectory ( this . platformData . appResourcesDestinationDirectoryPath ) ;
271278 }
272279
280+ private get projectPodFilePath ( ) : string {
281+ return path . join ( this . platformData . projectRoot , "Podfile" ) ;
282+ }
283+
273284 private replace ( name : string ) : string {
274285 if ( _ . startsWith ( name , '"' ) ) {
275286 name = name . substr ( 1 , name . length - 2 ) ;
@@ -304,6 +315,12 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
304315 return ( ( ) => {
305316 let pluginPlatformsFolderPath = pluginData . pluginPlatformsFolderPath ( IOSProjectService . IOS_PLATFORM_NAME ) ;
306317 _ . each ( this . getAllDynamicFrameworksForPlugin ( pluginData ) . wait ( ) , fileName => this . addLibrary ( path . join ( pluginPlatformsFolderPath , fileName ) ) . wait ( ) ) ;
318+
319+ let pluginPodFilePath = path . join ( pluginPlatformsFolderPath , "Podfile" ) ;
320+ if ( this . $fs . exists ( pluginPodFilePath ) . wait ( ) ) {
321+ let pluginPodFileContent = this . $fs . readText ( pluginPodFilePath ) . wait ( ) ;
322+ this . $fs . appendFile ( this . projectPodFilePath , pluginPodFileContent ) . wait ( ) ;
323+ }
307324 } ) . future < void > ( ) ( ) ;
308325 }
309326
@@ -319,6 +336,14 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
319336 } ) ;
320337
321338 this . savePbxProj ( project ) . wait ( ) ;
339+
340+ let pluginPodFilePath = path . join ( pluginPlatformsFolderPath , "Podfile" ) ;
341+ if ( this . $fs . exists ( pluginPodFilePath ) . wait ( ) ) {
342+ let pluginPodFileContent = this . $fs . readText ( pluginPodFilePath ) . wait ( ) ;
343+ let projectPodFileContent = this . $fs . readText ( this . projectPodFilePath ) . wait ( ) ;
344+ projectPodFileContent = helpers . stringReplaceAll ( projectPodFileContent , pluginPodFileContent , "" ) ;
345+ this . $fs . writeFile ( this . projectPodFilePath , projectPodFileContent ) . wait ( ) ;
346+ }
322347 } ) . future < void > ( ) ( ) ;
323348 }
324349
0 commit comments