{"action":"created","issue":{"url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4034","labels_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4034/labels{/name}","comments_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4034/comments","events_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4034/events","html_url":"https://github.com/CocoaPods/CocoaPods/issues/4034","id":101772613,"number":4034,"title":"Target Deduplication removes necessary Pods project targets","user":{"login":"smileyborg","id":1372557,"avatar_url":"https://avatars.githubusercontent.com/u/1372557?v=3","gravatar_id":"","url":"https://api.github.com/users/smileyborg","html_url":"https://github.com/smileyborg","followers_url":"https://api.github.com/users/smileyborg/followers","following_url":"https://api.github.com/users/smileyborg/following{/other_user}","gists_url":"https://api.github.com/users/smileyborg/gists{/gist_id}","starred_url":"https://api.github.com/users/smileyborg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smileyborg/subscriptions","organizations_url":"https://api.github.com/users/smileyborg/orgs","repos_url":"https://api.github.com/users/smileyborg/repos","events_url":"https://api.github.com/users/smileyborg/events{/privacy}","received_events_url":"https://api.github.com/users/smileyborg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-18T23:32:13Z","updated_at":"2015-08-20T03:20:19Z","closed_at":null,"body":"I ran into this issue when upgrading from CocoaPods `0.37.2` to `0.38.0`, and it's not fixed as of `0.38.2`.\r\n\r\nThis issue is a bit long, but only because I wanted to make it very clear what is happening -- the [sample project](https://github.com/smileyborg/CPTargetDeduplication) should make this very easy to understand.\r\n\r\n## Background\r\nI ran into this issue with the QuickBooks app I work on, which has an unusually complex build configuration. Aside from CocoaPods, we have a workspace of multiple separate Xcode projects, and each Xcode project generally has 2 framework targets -- one for iOS and one for Mac. This is because we use these independent Xcode projects (and their frameworks) to share code between multiple iOS and OS X apps. We're also using CocoaPods to manage our third-party dependencies.\r\n\r\nI've created a [small git repo](https://github.com/smileyborg/CPTargetDeduplication) that contains a sample workspace that represents a simple version of the structure of our real QuickBooks workspace. In this git repo:\r\n\r\n* `ProjectABWorkspace`\r\n  * `ProjectA` (has a dependency on `Pods`)\r\n    * `ProjectA-iOS`\r\n    * `ProjectA-Mac`\r\n  * `ProjectB` (has a dependency on `ProjectA`, and on `Pods`)\r\n    * `ProjectB-iOS`\r\n    * `ProjectB-Mac`\r\n  * `Pods`\r\n\r\nAs you can see, there are 2 separate Xcode projects and a Pods project (generated by CocoaPods). Each of the `ProjectA` and `ProjectB` projects has 2 framework targets it produces, one for iOS and one for OS X. Both `ProjectA` and `ProjectB` depend on a CocoaPod (INTUGroupedArray). And finally, `ProjectB` depends on `ProjectA`, by embedding & linking the `ProjectA.framework`.\r\n\r\nThe [Podfile in this repo](https://github.com/smileyborg/CPTargetDeduplication/blob/master/Podfile) has a separate Pod target for each framework target, making 4 total Pod targets.\r\n\r\n## The Issue\r\nWith `0.37.2` all of the framework targets build fine. (You can checkout [this commit](https://github.com/smileyborg/CPTargetDeduplication/commit/dda3a6cdf5b6fe732c5fa390728e8dffac1694a5) to see that.)\r\n\r\nHowever, with `0.38.0` or higher, both of the ProjectB framework targets fail to build (use the `ProjectB-iOS` and `ProjectB-Mac` schemes). The build failure itself is within the `ProjectBFile.m` import to the INTUGroupedArray CocoaPod.\r\n\r\nThe actual issue here is more clear when you look at the git log for the repo. If you look at the diff for [the commit that runs `pod install` using `0.38.2`](https://github.com/smileyborg/CPTargetDeduplication/commit/bbd8d1f16905aa653e7e2ee31326c5a561767d0f) (after already having run `pod install` using `0.37.2`), you can see two significant sets of deletions:\r\n* All the files in `Pods/Target Support Files/Pods-ProjectB-Mac-INTUGroupedArray/` have been removed\r\n* All the files in `Pods/Target Support Files/Pods-ProjectB-iOS-INTUGroupedArray/` have been removed\r\n\r\nIf you look at the Pods project itself at this point, it is also missing the `Pods-ProjectB-iOS-INTUGroupedArray` and `Pods-ProjectB-iOS-INTUGroupedArray` targets. So the root cause of the compilation error is that the INTUGroupedArray pod is no longer being linked with the ProjectB targets.\r\n\r\nCocoaPods `0.38.0` introduced [target deduplication](http://blog.cocoapods.org/CocoaPods-0.38/#target-deduplication), which appears to be causing this issue. It looks to me like the *Target Deduplicator* decided these were not necessary (even though they were) and removed them.\r\n\r\nThis issue is blocking us from upgrading beyond CocoaPods `0.37.2`.\r\n\r\nLet me know if you have any questions or want more information!"},"comment":{"url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/comments/132872384","html_url":"https://github.com/CocoaPods/CocoaPods/issues/4034#issuecomment-132872384","issue_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/4034","id":132872384,"user":{"login":"smileyborg","id":1372557,"avatar_url":"https://avatars.githubusercontent.com/u/1372557?v=3","gravatar_id":"","url":"https://api.github.com/users/smileyborg","html_url":"https://github.com/smileyborg","followers_url":"https://api.github.com/users/smileyborg/followers","following_url":"https://api.github.com/users/smileyborg/following{/other_user}","gists_url":"https://api.github.com/users/smileyborg/gists{/gist_id}","starred_url":"https://api.github.com/users/smileyborg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smileyborg/subscriptions","organizations_url":"https://api.github.com/users/smileyborg/orgs","repos_url":"https://api.github.com/users/smileyborg/repos","events_url":"https://api.github.com/users/smileyborg/events{/privacy}","received_events_url":"https://api.github.com/users/smileyborg/received_events","type":"User","site_admin":false},"created_at":"2015-08-20T03:20:18Z","updated_at":"2015-08-20T03:20:18Z","body":"Oh cool, I didn't realize that `deduplicate_targets: false` was an option.\r\n\r\nI just tried adding it to my CocoaPods config file. Then I reset the sample project repo to `dda3a6cdf5b6fe732c5fa390728e8dffac1694a5` (which is just after running `pod install` with `0.37.2`), and I ran `pod install` using `0.38.2`.\r\n\r\nAll 4 framework targets build successfully, with no errors.\r\n\r\nHere is what the Pods project looks like after the above -- note that the Pods project does indeed have INTUGroupedArray targets for each of the framework targets:\r\n\r\n<img width=\"1310\" alt=\"screen shot 2015-08-19 at 8 18 09 pm\" src=\"https://cloud.githubusercontent.com/assets/1372557/9374896/6ea8c028-46af-11e5-9ab9-140963bb2afe.png\">\r\n\r\nLet me give this a try with the real QuickBooks workspace just to confirm the same thing happens. But it definitely looks like this issue is being caused by the target deduplication feature as suspected."}}