Created
September 5, 2017 03:26
-
-
Save banjun/ce9f4446f6919599fe7f4462477b8e6c to your computer and use it in GitHub Desktop.
Legacy Swift Pods list with generating warnings for non-Swift pods and already Swift 4 pods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LEGACY_SWIFT_PODS = [] # set all the derived pods initially. e.g. %w(BrightFutures JetToTheFuture) | |
| def set_legacy_swift(installer) | |
| UI.warn "#{LEGACY_SWIFT_PODS.count} pods are marked as legacy swift: #{LEGACY_SWIFT_PODS}" | |
| installer.pods_project.targets.select {|t| LEGACY_SWIFT_PODS.include? t.name}.each do |target| | |
| pod_target = installer.pod_targets.find {|t| t.name == target.name} | |
| unless pod_target.uses_swift? | |
| UI.warn "#{target.name} does not use Swift." | |
| next | |
| end | |
| pushed_version = pod_target.root_spec.attributes_hash['pushed_with_swift_version'].to_i | |
| if pushed_version >= 4 | |
| UI.warn "#{target.name} has pushed_with_swift_version #{pushed_version}." | |
| end | |
| target.build_configurations.each do |config| | |
| config.build_settings['SWIFT_VERSION'] = '3.0' | |
| end | |
| end | |
| end | |
| post_install do |installer| | |
| set_legacy_swift installer | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment