Skip to content

Commit

Permalink
Add a target to the Podfile
Browse files Browse the repository at this point in the history
Trying to run `pod install` with CocoaPods 1.0.0 issues an error in case the Podfile doesn't reference a target. Add the project target to the Podfile.
Upon specifying target to the Podfile, however, the path to the Pods' .xcconfig file changes - reflect that change in code.
In addition, truncate and write the Podfile upon each prepare in order to avoid duplication and errors.
  • Loading branch information
Mitko-Kerezov committed Apr 15, 2016
1 parent cc619e3 commit 921663d
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,13 +689,9 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
let pluginPodFilePath = path.join(pluginPlatformsFolderPath, "Podfile");

if(this.$fs.exists(pluginPodFilePath).wait()) {
if(!this.$fs.exists(this.projectPodFilePath).wait()) {
this.$fs.writeFile(this.projectPodFilePath, "use_frameworks!\n").wait();
}

let pluginPodFileContent = this.$fs.readText(pluginPodFilePath).wait();
let contentToWrite = this.buildPodfileContent(pluginPodFilePath, pluginPodFileContent);
this.$fs.appendFile(this.projectPodFilePath, contentToWrite).wait();
let contentToWrite = `use_frameworks!\n\ntarget "${this.$projectData.projectName}" do\n${this.buildPodfileContent(pluginPodFilePath, pluginPodFileContent)}\nend`;
this.$fs.writeFile(this.projectPodFilePath, contentToWrite).wait();

let project = this.createPbxProj();
project.updateBuildProperty("IPHONEOS_DEPLOYMENT_TARGET", "8.0");
Expand Down Expand Up @@ -811,10 +807,11 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
this.mergeXcconfigFiles(appResourcesXcconfigPath, this.pluginsReleaseXcconfigFilePath).wait();
}

let podFolder = path.join(this.platformData.projectRoot, "Pods/Target Support Files/Pods/");
let podFilesRootDirName = path.join("Pods", "Target Support Files", `Pods-${this.$projectData.projectName}/`);
let podFolder = path.join(this.platformData.projectRoot, podFilesRootDirName);
if (this.$fs.exists(podFolder).wait()) {
this.mergeXcconfigFiles(path.join(this.platformData.projectRoot, "Pods/Target Support Files/Pods/Pods.debug.xcconfig"), this.pluginsDebugXcconfigFilePath).wait();
this.mergeXcconfigFiles(path.join(this.platformData.projectRoot, "Pods/Target Support Files/Pods/Pods.release.xcconfig"), this.pluginsReleaseXcconfigFilePath).wait();
this.mergeXcconfigFiles(path.join(this.platformData.projectRoot, podFilesRootDirName, `Pods-${this.$projectData.projectName}.debug.xcconfig`), this.pluginsDebugXcconfigFilePath).wait();
this.mergeXcconfigFiles(path.join(this.platformData.projectRoot, podFilesRootDirName, `Pods-${this.$projectData.projectName}.release.xcconfig`), this.pluginsReleaseXcconfigFilePath).wait();
}
}).future<void>()();
}
Expand Down

0 comments on commit 921663d

Please sign in to comment.