Skip to content

Commit d600317

Browse files
Fatme HavaluovaFatme Havaluova
authored andcommitted
Cocoapods support
1 parent df7588d commit d600317

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
@@ -263,13 +263,24 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
263263
this.savePbxProj(project).wait();
264264
}
265265

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+
}
266273
}).future<void>()();
267274
}
268275

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

280+
private get projectPodFilePath(): string {
281+
return path.join(this.platformData.projectRoot, "Podfile");
282+
}
283+
273284
private replace(name: string): string {
274285
if(_.startsWith(name, '"')) {
275286
name = name.substr(1, name.length-2);
@@ -304,6 +315,12 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
304315
return (() => {
305316
let pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
306317
_.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+
}
307324
}).future<void>()();
308325
}
309326

@@ -319,6 +336,14 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
319336
});
320337

321338
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+
}
322347
}).future<void>()();
323348
}
324349

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)