Skip to content

Commit 899bac9

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
Cocoapods support
1 parent 3de21f9 commit 899bac9

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

lib/services/ios-project-service.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,24 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
262262
this.savePbxProj(project).wait();
263263
}
264264

265+
if(this.$fs.exists(this.projectPodFilePath).wait() && this.$fs.getFsStats(this.projectPodFilePath).wait().mtime < this.$fs.getFsStats(this.$projectData.projectFilePath).wait().mtime) {
266+
try {
267+
this.$childProcess.exec("pod install", { cwd: this.platformData.projectRoot }).wait();
268+
} catch(e) {
269+
this.$errors.failWithoutHelp("CocoaPods are not installed. Run `sudo gem install cocoapods` and try again.");
270+
}
271+
}
265272
}).future<void>()();
266273
}
267274

268275
public prepareAppResources(appResourcesDirectoryPath: string): IFuture<void> {
269276
return this.$fs.deleteDirectory(this.platformData.appResourcesDestinationDirectoryPath);
270277
}
271278

279+
private get projectPodFilePath(): string {
280+
return path.join(this.platformData.projectRoot, "Podfile");
281+
}
282+
272283
private replace(name: string): string {
273284
if(_.startsWith(name, '"')) {
274285
name = name.substr(1, name.length-2);
@@ -303,6 +314,12 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
303314
return (() => {
304315
let pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
305316
_.each(this.getAllDynamicFrameworksForPlugin(pluginData).wait(), fileName => this.addLibrary(path.join(pluginPlatformsFolderPath, fileName)).wait());
317+
318+
let pluginPodFilePath = path.join(pluginPlatformsFolderPath, "Podfile");
319+
if(this.$fs.exists(pluginPodFilePath).wait()) {
320+
let pluginPodFileContent = this.$fs.readText(pluginPodFilePath).wait();
321+
this.$fs.appendFile(this.projectPodFilePath, pluginPodFileContent).wait();
322+
}
306323
}).future<void>()();
307324
}
308325

@@ -318,6 +335,14 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
318335
});
319336

320337
this.savePbxProj(project).wait();
338+
339+
let pluginPodFilePath = path.join(pluginPlatformsFolderPath, "Podfile");
340+
if(this.$fs.exists(pluginPodFilePath).wait()) {
341+
let pluginPodFileContent = this.$fs.readText(pluginPodFilePath).wait();
342+
let projectPodFileContent = this.$fs.readText(this.projectPodFilePath).wait();
343+
projectPodFileContent = helpers.stringReplaceAll(projectPodFileContent, pluginPodFileContent, "");
344+
this.$fs.writeFile(this.projectPodFilePath, projectPodFileContent).wait();
345+
}
321346
}).future<void>()();
322347
}
323348

lib/services/plugins-service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ export class PluginsService implements IPluginsService {
111111
this.validateXml(resultXml);
112112
this.$fs.writeFile(configurationFilePath, resultXml).wait();
113113
}
114-
115114

116115
this.$projectFilesManager.processPlatformSpecificFiles(pluginDestinationPath, platform).wait();
117116

0 commit comments

Comments
 (0)