Skip to content

Commit 8350405

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
Add warning if Podfile contains more than one post_install section
1 parent 8bce4f5 commit 8350405

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/services/ios-project-service.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
1616
private static XCODEBUILD_MIN_VERSION = "6.0";
1717
private static IOS_PROJECT_NAME_PLACEHOLDER = "__PROJECT_NAME__";
1818
private static IOS_PLATFORM_NAME = "ios";
19+
private static PODFILE_POST_INSTALL_SECTION_NAME = "post_install";
1920

2021
private get $npmInstallationManager(): INpmInstallationManager {
2122
return this.$injector.resolve("npmInstallationManager");
@@ -330,6 +331,15 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
330331
this.$errors.failWithoutHelp("CocoaPods are not installed. Run `sudo gem install cocoapods` and try again.");
331332
}
332333

334+
let projectPodfileContent = this.$fs.readText(this.projectPodFilePath).wait();
335+
this.$logger.trace("Project Podfile content");
336+
this.$logger.trace(projectPodfileContent);
337+
338+
let firstPostInstallIndex = projectPodfileContent.indexOf(IOSProjectService.PODFILE_POST_INSTALL_SECTION_NAME);
339+
if(firstPostInstallIndex !== -1 && firstPostInstallIndex !== projectPodfileContent.lastIndexOf(IOSProjectService.PODFILE_POST_INSTALL_SECTION_NAME)) {
340+
this.$logger.warn(`Podfile contains more than one post_install sections. You need to open ${this.projectPodFilePath} file and manually resolve this issue.`);
341+
}
342+
333343
this.$logger.info("Installing pods...");
334344
this.$childProcess.exec("pod install", { cwd: this.platformData.projectRoot }).wait();
335345
}

0 commit comments

Comments
 (0)