🌈
Attempted to run either pod trunk push or pod spec lint on the Alamofire 4.0.0-beta.1 tag to push it to trunk.
Project successfully pushed to trunk.
Linting fails due to an error building the watch target in App.xcworkspace.
=== BUILD TARGET App OF PROJECT App WITH CONFIGURATION Release ===
Check dependencies
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
This occurs on both the 1.1.0.beta.1 and master versions.
CocoaPods : 1.1.0.beta.1
Ruby : ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
RubyGems : 2.5.1
Host : Mac OS X 10.11.6 (15G31)
Xcode : 8.0 (8S201h)
Git : git version 2.8.4 (Apple Git-73)
Ruby lib dir : /Users/jshier/.rvm/rubies/ruby-2.3.1/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 655083e6947900b35e6ab2755b9420ea6bcf1c3b
Executable Path: /Users/jshier/.rvm/gems/ruby-2.3.1@alamofire/bin/pod
cocoapods-deintegrate : 1.0.0
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.0.0
cocoapods-try : 1.1.0
You can replicate this issue by cloning Alamofire and attempting to run pod spec lint against the swift3 branch.
Any workaround for the meantime would be appreciated, as we'd like to get the 4.0.0-beta.1 release on CocoaPods ASAP.
See #5650, I would suggest applying Samuel's suggestion from that thread or using a similar approach as in the PR, just replacing "2.3" with "3.0".
@neonichu Tried updating our podspec to:
Pod::Spec.new do |s|
s.name = 'Alamofire'
s.version = '4.0.0-beta.2'
s.license = 'MIT'
s.summary = 'Elegant HTTP Networking in Swift'
s.homepage = 'https://github.com/Alamofire/Alamofire'
s.social_media_url = 'http://twitter.com/AlamofireSF'
s.authors = { 'Alamofire Software Foundation' => '[email protected]' }
s.source = { :git => 'https://github.com/Alamofire/Alamofire.git', :tag => s.version }
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.11'
s.tvos.deployment_target = '9.0'
s.watchos.deployment_target = '2.0'
s.source_files = 'Source/*.swift'
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '3.0' }
end
pod spec lint still doesn't pass locally. Did I misunderstand the workaround?
No, you're right, it doesn't actually work for linting, because the generated application target still doesn't get a SWIFT_VERSION setting.
Seems like the only feasible workaround is patching master right now, sorry.
@jshier, I am currently using this hack in the /lib/cocoapods/generator/xcconfig/xcconfig_helper.rb file to lint and push my Swift 3.0 library.
def self.add_code_signing_settings(target, xcconfig)
build_settings = {}
if target.platform.to_sym == :osx
build_settings['CODE_SIGN_IDENTITY'] = ''
end
build_settings['SWIFT_VERSION'] = '3.0' # <--- Hack to allow linting of Swift 3.0 projects.
xcconfig.merge!(build_settings)
end
Also, one needs to remove ensure_in_repo! from the lib/cocoapods/sources_manager.rb file in order to do pod trunk push which is done in this pull request: https://github.com/CocoaPods/CocoaPods/pull/5822
@evgenyneu Thanks, that worked great! We've successfully pushed Alamofire 4 to CocoaPods!
@evgenyneu I'm dying to try this workaround but I have no idea where to find the /lib/cocoapods/generator/xcconfig/xcconfig_helper.rb file. Could you help me locating it, please? 🙏
Running
cd /lib/cocoapods/generator/xcconfig/xcconfig_helper.rb says "no such file"
@3lvis, the location may vary, so one can use sudo find / -iname xcconfig_helper.rb to find it.
@evgenyneu Thanks a lot, that's very helpful :)
Most helpful comment
@jshier, I am currently using this hack in the
/lib/cocoapods/generator/xcconfig/xcconfig_helper.rbfile to lint and push my Swift 3.0 library.Also, one needs to remove
ensure_in_repo!from thelib/cocoapods/sources_manager.rbfile in order to dopod trunk pushwhich is done in this pull request: https://github.com/CocoaPods/CocoaPods/pull/5822