-
Notifications
You must be signed in to change notification settings - Fork 24
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
Minimum deployment target #14
base: master
Are you sure you want to change the base?
Conversation
@@ -490,6 +490,7 @@ def create_podspec(merged_framework_name, pods_to_merge, podspec_info, mixed_lan | |||
resource_bundles = podspec_info.resource_bundles | |||
vendored_libraries = podspec_info.vendored_libraries | |||
swift_versions = podspec_info.swift_versions | |||
ios_deployment_target = podfile_info.platforms.find { |platform| platform.include? "ios"}.split(',')[1] |
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.
What happens if the Podfile
does not define a platform? Will this be able to get a default value?
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.
That's a very valid question! By default Cocoapods provide a default in case that one is not specified:
CocoaPods provides a default deployment target if one is not specified. The current default values are 4.3 for iOS, 10.6 for OS X, 9.0 for tvOS and 2.0 for watchOS.
Nevertheless, in this specific case, we should provide a default one in the case that is not specified in the Podfile
. Let's do that of course!
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.
Uhmm ran some experiments and one thing emerged. If I delete the MergedPods
folder and run bundle exec pod install
Cocoapods would raise an exception like the following in case the platform
is not set in the Podfile
:
It is necessary to specify the platform in the Podfile if not integrating.
If the project was integrated it already I think we're good if the platform
is not specified.
The other case is when once it was integrated we comment it out the platform
in the Podfile
and run bundle exec pod install
and Cocoapods would try to set a default platform target version for the Pods.xcodeproj
like this:
[!] Automatically assigning platform `iOS` with version `11.0` on target `PodMergeExample` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Let me know your thoughts about it.
@@ -334,7 +334,7 @@ def merge(merged_framework_name, group_contents, podfile_info) | |||
|
|||
# Create the local podspec | |||
Pod::UI.puts "\tCreating Podspec for the merged framework".magenta | |||
create_podspec(merged_framework_name, pods_to_merge, PodspecInfo.new(frameworks.uniq, prefix_header_contents.uniq, private_header_files.uniq, resources.uniq, script_phases.uniq, compiler_flags.uniq, libraries.uniq, prepare_command.uniq, resource_bundles, vendored_libraries.uniq, swift_version), mixed_language_group) | |||
create_podspec(merged_framework_name, pods_to_merge, PodspecInfo.new(frameworks.uniq, prefix_header_contents.uniq, private_header_files.uniq, resources.uniq, script_phases.uniq, compiler_flags.uniq, libraries.uniq, prepare_command.uniq, resource_bundles, vendored_libraries.uniq, swift_version), mixed_language_group, podfile_info) |
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.
Where is thispodfile_info
being created? 🤔
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.
Oh, this was created in this line
podfile_info = read_podfile |
@@ -13,7 +13,7 @@ DEPENDENCIES: | |||
- UI (from `MergedPods/UI`) | |||
|
|||
SPEC REPOS: | |||
https://cdn.cocoapods.org/: | |||
trunk: |
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.
Do we need this change? I think we can continue to use the new Cocoapods CDN
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.
Uhmm weird, I've used the latest Cocoapods version so it should be using the CDN now. I'll check that.
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.
We're good with trunk
. Take a look at this closed issue CocoaPods/CocoaPods#9190.
Thank you for your PR @Vkt0r! I think reading the I've just left a few comments to better understand this PR :) |
The `ios.deployment_target` was set to a default value causing that pods with a minimum deployment target greater than iOS 8 were throwing errors.
9b7a02e
to
2ced8a4
Compare
@biocross I rebased this PR for the latest changes. Can you please continue? Thanks |
Hey there 👋. Thanks for the creation of this plugin it's really promising!
This is PR is focused on fixing an issue with the minimum deployment target in the
*.podspec
for the generated groups. In the plugin, this was hardcoded tos.ios.deployment_target = '8.0'
causing that the inclusion of libraries with a higher deployment target would generate a compilation error. You can see the example library added in thePodMergeExample
(Kingfisher).To solve this I used the
platform :ios, 'x.y'
declared in thePodfile
. This should reflect the minimum deployment target for the Pods project. It's worth to mention that thePodfile
may have been parsed using theCocoaPods Core
gem already available avoiding the manual parsing and regex, with something like this:I leave as it was to avoid possibles issues in other parts of the plugin.
So this PR can be resumed in the following:
ios.deployment_target
from thePodfile
.