Skip to content

Commit d50eab9

Browse files
committed
fix: apply pod install after merging all pod files (from node_modules and from App_Resources)
1 parent 8b01617 commit d50eab9

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

lib/services/ios-project-service.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {
@@ -977,29 +978,9 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
977978
}
978979

979980
public async afterPrepareAllPlugins(projectData: IProjectData): Promise<void> {
980-
await this.installPodsIfAny(projectData);
981-
}
982-
983-
public async installPodsIfAny(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-
}
982+
const xcodeProjPath = this.getXcodeprojPath(projectData);
983+
await this.$cocoapodsService.executePodInstall(projectRoot, xcodeProjPath);
1003984
}
1004985

1005986
public beforePrepareAllPlugins(): Promise<void> {
@@ -1068,6 +1049,28 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
10681049
return semver.coerce(target);
10691050
}
10701051

1052+
private async mergeProjectPodFile(projectData: IProjectData): Promise<void> {
1053+
const platformData = this.getPlatformData(projectData);
1054+
const { projectRoot, normalizedPlatformName } = platformData;
1055+
const mainPodfilePath = path.join(projectData.appResourcesDirectoryPath, normalizedPlatformName, constants.PODFILE_NAME);
1056+
const projectPodfilePath = this.$cocoapodsService.getProjectPodfilePath(projectRoot);
1057+
if (this.$fs.exists(projectPodfilePath) || this.$fs.exists(mainPodfilePath)) {
1058+
const xcodeProjPath = this.getXcodeprojPath(projectData);
1059+
const xcuserDataPath = path.join(xcodeProjPath, "xcuserdata");
1060+
const sharedDataPath = path.join(xcodeProjPath, "xcshareddata");
1061+
1062+
if (!this.$fs.exists(xcuserDataPath) && !this.$fs.exists(sharedDataPath)) {
1063+
this.$logger.info("Creating project scheme...");
1064+
await this.checkIfXcodeprojIsRequired();
1065+
1066+
const createSchemeRubyScript = `ruby -e "require 'xcodeproj'; xcproj = Xcodeproj::Project.open('${projectData.projectName}.xcodeproj'); xcproj.recreate_user_schemes; xcproj.save"`;
1067+
await this.$childProcess.exec(createSchemeRubyScript, { cwd: projectRoot });
1068+
}
1069+
1070+
await this.$cocoapodsService.applyPodfileToProject(constants.NS_BASE_PODFILE, mainPodfilePath, projectData, projectRoot);
1071+
}
1072+
}
1073+
10711074
private getAllLibsForPluginWithFileExtension(pluginData: IPluginData, fileExtension: string): string[] {
10721075
const filterCallback = (fileName: string, pluginPlatformsFolderPath: string) => path.extname(fileName) === fileExtension;
10731076
return this.getAllNativeLibrariesForPlugin(pluginData, IOSProjectService.IOS_PLATFORM_NAME, filterCallback);

0 commit comments

Comments
 (0)