-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deduplicate pod targets #3550
Deduplicate pod targets #3550
Conversation
❤️ |
✨ 💖 ✨ |
Tested with the example of https://github.com/contentful-labs/Stargate:
[!] The pod `MMWormhole` is linked to different targets (["Pods-StargateExample", "Pods-StargateExample WatchKit Extension"]), which contain different settings to inhibit warnings. CocoaPods does not currently support different settings and will fall back to your preference set in the root target definition.
2015-05-11 08:43:05.125 xcodebuild[15650:1427685] stream error: stream error at offset 29: created by an unsupported XCDependencyGraph build
2015-05-11 08:43:05.148 xcodebuild[15650:1427686] stream error: stream error at offset 29: created by an unsupported XCDependencyGraph build in the
|
installer.aggregate_targets.map(&:pod_targets).flatten.uniq.each do |lib| | ||
lib.target_definitions.each do |target_definition| | ||
pod_names = [lib.root_spec.name] | ||
pod_reps = pods.select { |rep| pod_names.include?(rep.name) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check with ==
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This is great! Been wondering about this |
Is it fixed now? |
@ItsTipTop: Are you using the latest released CocoaPods? That doesn't include those changes yet. Or are you using a development installation? Then you could help if you would describe what exactly fails when you try to archive your app. |
@mrackwitz I'm using 0.37.1 version.
Warnings appear only for frameworks that included in several targets. Here my podfile:
Now i can't archive my app and send update to App Store :( Waiting for your reply. Thank you. |
58ff33e
to
f936590
Compare
@neonichu: I could address the following issues:
Left open is:
|
@ItsTipTop: Thanks for your detailed issue report, really sorry that this tooling issue prevents you from shipping your app to the app store. But unless you have feedback to a development installation with this branch, this really shouldn't go in this PR, which tries to address the issues which are linked, which also apply for your specific issue. This makes it easier for us to work focused on an actual solution. Meanwhile, did you tried the workaround here? Hope that this will work for you. |
@mrackwitz No. This workaround does not work for me. |
I'm having the same issue, I cannot archive my app & tried everything available on the Internet, but never suspected this is the issue until I found this on the Xcode Console:
Then I tried everything regarding the issue available here but with no success, here's my Podfile:
This way I get the duplicate thing & the app doesn't archive, although every target gets the dependancies it needs. On the other hand with an approach for having a shared pod for every target & a dedicated pod for the iOS app in order to avoid the duplication, I changed the
This way I get this error when installing the pods & I don't get the
We should wait for this patch to fix the duplication issue in a Cocoapods update? I'm waiting for your reply, |
46b5652
to
1a98fb2
Compare
For disambugiation with stdlib's debugging helper #inspect.
Remove the "Pods-" prefix from the labels in the expected error messages, because the fixture targets are deduplicated.
0204a29
to
a52d6b3
Compare
Great job! Already any plans for releasing it? |
Great! I installed 0.38.0.beta.1 and Xcode successfully archived my application. But when i'm trying to submit my app to App Store xcode fail: |
What if you're using the same Pod like AFNetworking both in the application and the widget? You need to be able to set AF_APP_EXTENSIONS=1 in GCC_PREPROCESSOR_DEFINITIONS for the widget but you cannot do it as long as the targets get deduplicated. And since we're a team working on the same project it's not reasonable to force everyone to remember to add something to the config.yml |
See discussion in #3794 |
[Some APIs Are Unavailable to App Extensions](https://developer.apple.com/library/ios/documentation/Genera l/Conceptual/ExtensibilityPG/ExtensionOverview.html#//apple_ref/doc/uid/ TP40014214-CH2-SW6) According To Apple Doc: > Because of its focused role in the system, an app extension is ineligible to participate in certain activities. An app extension cannot: > Access a sharedApplication object, and so cannot use any of the methods on that object Test in my own app.We need the `NS_EXTENSION_UNAVAILABLE_IOS` make it available in App extension
This de-duplicates pod targets in the analyzer, if they share the same subspec set and target the same platform. If there is any dependency from at least one target definition, which doesn't fulfill this condition, then all dependencies with this root spec will be scoped.
This should fix diverse issues related to archiving with Xcode, especially when extensions are integrated. Beside that it will reduce build times, drastically.
A new configuration key was added (38ec3cd), which allows to opt-out of the feature, because these changes cause massive changes to the existing integration and are likely to break edge-case setups.
Open Todos:
The following things are still open to do:
PodTarget
can't be deduplicated if any of its transitive dependencies can't be deduplicated.PodTarget
s are only initialized legitimate: They can't be scoped when they have more then one target definition.Dependencies:
This depends on the following PRs:
Changes to the Integration
Deduplication / Descoping of PodTargets
This de-duplicates pod targets in the analyzer, if they share the same subspec set and target the same platform. If there is any dependency from at least one target definition, which doesn't fulfill this condition, then all dependencies with this root spec will be scoped.
A deduplicated pod target will be fully descoped, which means the prefix of all names is skipped and with frameworks, it builds in the
CONTENTS_FOLDER_PATH
as usual given by Xcode, without the introduced level of further scoping to avoid conflicts, which can't happen that way.Concrete this means the following: If you used to integrate with the following Podfile:
You would end up with an integration, which looks like:
Pods-Alamofire
Pods-Stargate
Pods-MRProgress
Pods-ExampleCLI-Alamofire
Pods-ExampleWatchExtension-Stargate
Pods-ExampleWidget-Alamofire
Pods-ExampleWidget-MRProgress
Now you should end up with:
Pods-Alamofire
Stargate
🎉Pods-MRProgress
Pods-ExampleCLI-Alamofire
🎉Pods-ExampleWatchExtension-Stargate
Pods-ExampleWidget-Alamofire
Pods-ExampleWidget-MRProgress
As you can see subspecs and different platforms prevent the deduplication, even when there is a subset of target definitions where the deduplication could been applied as seen for
Alamofire
in the example above.Environment Header
All
PodTarget
s from the sameAggregateTarget
used to share an environment header. This won't be possible anymore for deduplicated pod targets. As the environment header defines precompiler macros to indicate the version for each integrated dependency in the same target definition, altering anything around this can cause unexpected failures when pods have implicit dependencies or offer additional behavior when used along other pods. This PR for now replaces the shared environment header with a dedicated environment header, which in the best case should only have information about all explicit dependencies of the given podspec. Another variant would be that it has additional access to the intersection of all dependencies of all target definitions it belongs to.Highlighted Architecture Changes
target_definition
fromTarget
intoAggregateTarget
and all getters, which depend on this and are only needed for the subclass.PodTarget
toTargetDefinition
, now known asPodTarget#target_definitions
scoped
toPodTarget
to indicate them explicitly as scoped, which is only possible if there is only one relatedTargetDefinition
TargetInspector
andTargetInspectionResult
out ofAnalyzer