-
Notifications
You must be signed in to change notification settings - Fork 2.7k
8000
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
@@ -50,6 +50,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` | |||
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) | |||
[#7081](https://github.com/CocoaPods/CocoaPods/issues/7081) | |||
|
|||
* Avoid 'Unspecificed' value for SWIFT_VERSION build settings and make 'Swift 3.2' the default value |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
typo, Unspecified
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
thanks... fixing it!
@@ -470,7 +470,7 @@ def install_pod | |||
next unless (native_target = pod_target.native_target) | |||
native_target.build_configuration_list.build_configurations.each do |build_configuration| | |||
(build_configuration.build_settings['OTHER_CFLAGS'] ||= '$(inherited)') << ' -Wincomplete-umbrella' | |||
build_configuration.build_settings['SWIFT_VERSION'] = swift_version if pod_target.uses_swift? | |||
build_configuration.build_settings['SWIFT_VERSION'] = swift_version if pod_target.uses_swift? && !swift_version.nil? |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
is there a test that covers the !swift_version.nil?
part? If not can you please add one?
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
i'm not a ruby developer, i will try my best to write unit tests
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
not a problem! There are plenty of examples around the *_spec.rb
for the class you are writing a test for you can cargo cult from.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
i'm trying to figure out how to run unit tests in ruby. reading this tutorial here: https://code.tutsplus.com/tutorials/ruby-for-newbies-testing-with-rspec--net-21297
but i'm getting this error:
/Users/victor/.rvm/gems/ruby-2.0.0-p648/gems/rspec-core-3.6.0/lib/rspec/core/formatters.rb:206:in `built_in_formatter': cannot load such file -- rspec/core/formatters/progress_formatter (LoadError)
googling it to figure out how to fix it. if know the solution, please let me know please.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
nvm... i figured how to run bundle exec bacon ...
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
you can also run bundle exec rake spec
or bundle exec rake spec:unit
for only unit tests
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@heyzooi can you provide a case where the part !swift_version.nil?
can be true?
@@ -100,7 +100,7 @@ def self.add_xctest_search_paths(target) | |||
# | |||
def self.add_swift_version(target, swift_version) | |||
target.build_configurations.each do |configuration| | |||
configuration.build_settings['SWIFT_VERSION'] = swift_version | |||
configuration.build_settings['SWIFT_VERSION'] = !swift_version.nil? ? swift_version : Validator::DEFAULT_SWIFT_VERSION |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
needs a test
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nit pick here, rather than checking for nil in each loop, could the desired value be extracted to before the loop? Something like
version_to_set = swift_version || Validator::DEFAULT_SWIFT_VERSION
target.build_configurations.each do |configuration|
configuration.build_settings['SWIFT_VERSION'] = version_to_set
end
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
sure! let me do that
@@ -25,6 +25,9 @@ def initialize(path, skip_initialization = false, | |||
@pods = new_group('Pods') | |||
@development_pods = new_group('Development Pods') | |||
self.symroot = LEGACY_BUILD_ROOT | |||
root_object.build_configuration_list.build_configurations.each do |config| |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
why do we care for the entire project to set this value? It seems that each and every other pod target that uses swift should use a value now.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
if you don't specify a value for the SWIFT_VERSION
build settings, Xcode will not compile, so the idea here was to set a default version and allow each pod to override the default version as needed.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@heyzooi doesnt each pod that uses swift automatically get assigned a version? I am still not 100% convinced we need to be changing the project configuration in this PR.
@@ -894,10 +894,10 @@ def test_swiftpod_with_dot_swift_version(version = '3.1.0') | |||
end | |||
|
|||
describe '#swift_version' do | |||
it 'defaults to Swift 3.0' do | |||
it 'defaults to Swift 3.2' do |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
There is a test right above this that contains a warning message starting with The validator for Swift projects uses Swift 3.0 by default
- could that test (and possibly the code that generates that warning) be updated as well?
Edit: this is now fixed
hey guys, how do I link the |
@heyzooi That PR needs to be accepted before this one, then update the git submodule reference to point to the latest commit |
@@ -1,8 +1,12 @@ | |||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
does this file need to change?
This change we should overall land but there are still a few questions remaining before we do so. |
@@ -99,8 +99,9 @@ def self.add_xctest_search_paths(target) | |||
# @return [void] | |||
# | |||
def self.add_swift_version(target, swift_version) | |||
version_to_set = !swift_version.nil? ? swift_version : Validator::DEFAULT_SWIFT_VERSION |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Not sure this belongs in this method. If it does it most certainly needs documentation update.
I still need to clearly understand a case in which in validator.rb
...
# @return [String] the SWIFT_VERSION to use for validation.
#
def swift_version
return @swift_version if defined?(@swift_version)
if version = dot_swift_version
@swift_version = version
else
DEFAULT_SWIFT_VERSION
end
end
...can return nil
? Is it if the contents of the .swift-version
file are empty?
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
if .swift-version
is empty, it returns nil, and goes to DEFAULT_SWIFT_VERSION
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. F438 Learn more.
So yes I don't see the reason why we are doing a nil?
check here and in the other place, @heyzooi
as of recent, i've encountered this issue with the following project: 📎 https://github.com/piemonte/player even though i have a .swift-verision and properly specified project file, linting still seems to fail. i haven't been able to push the latest release. |
@dnkoutso ah, yes, i am. you're awesome, thanks for the link. |