@@ -263,13 +263,24 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
263
263
this . savePbxProj ( project ) . wait ( ) ;
264
264
}
265
265
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
+ }
266
273
} ) . future < void > ( ) ( ) ;
267
274
}
268
275
269
276
public prepareAppResources ( appResourcesDirectoryPath : string ) : IFuture < void > {
270
277
return this . $fs . deleteDirectory ( this . platformData . appResourcesDestinationDirectoryPath ) ;
271
278
}
272
279
280
+ private get projectPodFilePath ( ) : string {
281
+ return path . join ( this . platformData . projectRoot , "Podfile" ) ;
282
+ }
283
+
273
284
private replace ( name : string ) : string {
274
285
if ( _ . startsWith ( name , '"' ) ) {
275
286
name = name . substr ( 1 , name . length - 2 ) ;
@@ -304,6 +315,12 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
304
315
return ( ( ) => {
305
316
let pluginPlatformsFolderPath = pluginData . pluginPlatformsFolderPath ( IOSProjectService . IOS_PLATFORM_NAME ) ;
306
317
_ . 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
+ }
307
324
} ) . future < void > ( ) ( ) ;
308
325
}
309
326
@@ -319,6 +336,14 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
319
336
} ) ;
320
337
321
338
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
+ }
322
347
} ) . future < void > ( ) ( ) ;
323
348
}
324
349
0 commit comments