@@ -771,28 +771,39 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
771
771
this . $logger . trace ( `Images to remove from xcode project: ${ imagesToRemove . join ( ", " ) } ` ) ;
772
772
_ . each ( imagesToRemove , image => project . removeResourceFile ( path . join ( this . getAppResourcesDestinationDirectoryPath ( projectData ) , image ) ) ) ;
773
773
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
+
774
776
this . savePbxProj ( project , projectData ) ;
775
777
}
778
+
776
779
}
777
780
778
781
public prepareAppResources ( appResourcesDirectoryPath : string , projectData : IProjectData ) : void {
779
782
const platformFolder = path . join ( appResourcesDirectoryPath , this . getPlatformData ( projectData ) . normalizedPlatformName ) ;
780
783
const filterFile = ( filename : string ) => this . $fs . deleteFile ( path . join ( platformFolder , filename ) ) ;
781
784
782
785
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 ) ) ;
783
790
784
791
this . $fs . deleteDirectory ( this . getAppResourcesDestinationDirectoryPath ( projectData ) ) ;
785
792
}
786
793
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 ) ;
789
796
await this . $iOSEntitlementsService . merge ( projectData ) ;
790
- await this . mergeProjectXcconfigFiles ( release , projectData ) ;
797
+ await this . mergeProjectXcconfigFiles ( opts . release , projectData ) ;
791
798
for ( const pluginData of await this . getAllInstalledPlugins ( projectData ) ) {
792
799
await this . $pluginVariablesService . interpolatePluginVariables ( pluginData , this . getPlatformData ( projectData ) . configurationFilePath , projectData . projectDir ) ;
793
800
}
794
801
795
802
this . $pluginVariablesService . interpolateAppIdentifier ( this . getPlatformData ( projectData ) . configurationFilePath , projectData . projectIdentifiers . ios ) ;
803
+
804
+ if ( opts . installPods ) {
805
+ await this . installPodsIfAny ( projectData ) ;
806
+ }
796
807
}
797
808
798
809
private getInfoPlistPath ( projectData : IProjectData ) : string {
@@ -955,7 +966,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
955
966
await this . prepareStaticLibs ( pluginPlatformsFolderPath , pluginData , projectData ) ;
956
967
957
968
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 ) ;
959
970
}
960
971
961
972
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
966
977
this . removeStaticLibs ( pluginPlatformsFolderPath , pluginData , projectData ) ;
967
978
const projectRoot = this . getPlatformData ( projectData ) . projectRoot ;
968
979
969
- this . $cocoapodsService . removePluginPodfileFromProject ( pluginData , projectData , projectRoot ) ;
980
+ this . $cocoapodsService . removePodfileFromProject ( pluginData . name , this . $cocoapodsService . getPluginPodfilePath ( pluginData ) , projectData , projectRoot ) ;
970
981
}
971
982
972
983
public async afterPrepareAllPlugins ( projectData : IProjectData ) : Promise < void > {
984
+ await this . installPodsIfAny ( projectData ) ;
985
+ }
986
+
987
+ public async installPodsIfAny ( projectData : IProjectData ) : Promise < void > {
973
988
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 ) ) {
975
991
const xcodeProjPath = this . getXcodeprojPath ( projectData ) ;
976
992
const xcuserDataPath = path . join ( xcodeProjPath , "xcuserdata" ) ;
977
993
const sharedDataPath = path . join ( xcodeProjPath , "xcshareddata" ) ;
@@ -984,6 +1000,8 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
984
1000
await this . $childProcess . exec ( createSchemeRubyScript , { cwd : this . getPlatformData ( projectData ) . projectRoot } ) ;
985
1001
}
986
1002
1003
+ await this . $cocoapodsService . applyPodfileToProject ( constants . NS_BASE_PODFILE , mainPodfilePath , projectData , this . getPlatformData ( projectData ) . projectRoot ) ;
1004
+
987
1005
await this . $cocoapodsService . executePodInstall ( projectRoot , xcodeProjPath ) ;
988
1006
}
989
1007
}
@@ -1094,9 +1112,9 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
1094
1112
this . $fs . rename ( path . join ( fileRootLocation , oldFileName ) , path . join ( fileRootLocation , newFileName ) ) ;
1095
1113
}
1096
1114
1097
- private async prepareNativeSourceCode ( pluginName : string , pluginPlatformsFolderPath : string , projectData : IProjectData ) : Promise < void > {
1115
+ private async prepareNativeSourceCode ( groupName : string , sourceFolderPath : string , projectData : IProjectData ) : Promise < void > {
1098
1116
const project = this . createPbxProj ( projectData ) ;
1099
- const group = this . getRootGroup ( pluginName , pluginPlatformsFolderPath ) ;
1117
+ const group = this . getRootGroup ( groupName , sourceFolderPath ) ;
1100
1118
project . addPbxGroup ( group . files , group . name , group . path , null , { isMain : true } ) ;
1101
1119
project . addToHeaderSearchPaths ( group . path ) ;
1102
1120
this . savePbxProj ( project , projectData ) ;
0 commit comments