Skip to content

Commit 28477e1

Browse files
author
Mitko-Kerezov
committed
Add a target to the Podfile
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.
1 parent cc619e3 commit 28477e1

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/services/ios-project-service.ts

+6-9
Original file line numberDiff line numberDiff line change
@@ -689,13 +689,9 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
689689
let pluginPodFilePath = path.join(pluginPlatformsFolderPath, "Podfile");
690690

691691
if(this.$fs.exists(pluginPodFilePath).wait()) {
692-
if(!this.$fs.exists(this.projectPodFilePath).wait()) {
693-
this.$fs.writeFile(this.projectPodFilePath, "use_frameworks!\n").wait();
694-
}
695-
696692
let pluginPodFileContent = this.$fs.readText(pluginPodFilePath).wait();
697-
let contentToWrite = this.buildPodfileContent(pluginPodFilePath, pluginPodFileContent);
698-
this.$fs.appendFile(this.projectPodFilePath, contentToWrite).wait();
693+
let contentToWrite = `use_frameworks!\n\ntarget "${this.$projectData.projectName}" do\n${this.buildPodfileContent(pluginPodFilePath, pluginPodFileContent)}\nend`;
694+
this.$fs.writeFile(this.projectPodFilePath, contentToWrite).wait();
699695

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

814-
let podFolder = path.join(this.platformData.projectRoot, "Pods/Target Support Files/Pods/");
810+
let podFilesRootDirName = path.join("Pods", "Target Support Files", `Pods-${this.$projectData.projectName}/`);
811+
let podFolder = path.join(this.platformData.projectRoot, podFilesRootDirName);
815812
if (this.$fs.exists(podFolder).wait()) {
816-
this.mergeXcconfigFiles(path.join(this.platformData.projectRoot, "Pods/Target Support Files/Pods/Pods.debug.xcconfig"), this.pluginsDebugXcconfigFilePath).wait();
817-
this.mergeXcconfigFiles(path.join(this.platformData.projectRoot, "Pods/Target Support Files/Pods/Pods.release.xcconfig"), this.pluginsReleaseXcconfigFilePath).wait();
813+
this.mergeXcconfigFiles(path.join(this.platformData.projectRoot, podFilesRootDirName, `Pods-${this.$projectData.projectName}.debug.xcconfig`), this.pluginsDebugXcconfigFilePath).wait();
814+
this.mergeXcconfigFiles(path.join(this.platformData.projectRoot, podFilesRootDirName, `Pods-${this.$projectData.projectName}.release.xcconfig`), this.pluginsReleaseXcconfigFilePath).wait();
818815
}
819816
}).future<void>()();
820817
}

0 commit comments

Comments
 (0)