SPM utils
Hey there! This is a repo with a bunch of utility scripts for SPM compiled to a ruby gem. I really like working with SPM nowadays, but I needed to automate some things that I could reuse both on my local computer and also on the CI - maybe you want to use them too! If you have an idea for a cool fixer/utility - don't hesitate to file and issue or make a PR!
Current functionalities:
- Clean your project (remove cache, builds, xcodeproj etc)
- Fix Quick on SPM
- Update Swift version in given target or all targets
- Inhibit all warnings in given target or all targets
Before you use the script:
- Go to your SPM project.
- Backup/commit your files.
- Clean your project if needed.
- Run
swift package generate-xcodeproj
(make sure it passes) - Install this gem using
gem install spm_utils
Cleaning your project
Whenever something goes wrong with building/caching/resolving, try cleaning your project:
spm_utils clean_project
Quick fixer
See issue Quick#751 and PR swift-package-manager#955. TL;DR because of SPM, Quick can't set CLANG_ENABLE_MODULES
by itself.
This script automates it for you:
spm_utils fix_quick
Swift version - update your targets to Swift 3 or 4
By running swift package generate-xcodeproj
you don't necessarily get all your targets built with Swift 4 (see SR-5940). You might also want to change one of the targets to use Swift 3 or 4. This script fixes that for you!
To update all targets to use Swift 3:
spm_utils swift 3.0
To update all targets to use Swift 4:
spm_utils swift 4.0
To update all targets to use Swift 4.2:
spm_utils swift 4.2
To update few targets to use Swift 4.2:
spm_utils swift --target Quick --target Nimble 4.2
Inhibit warnings
In CocoaPods there is an option to hide your dependencies warnings. This basically does the same thing.
To inhibit warnings for all targets
spm_utils inhibit_all_warnings
To inhibit warnings for only one target
spm_utils inhibit_all_warnings --target Nimble
To inhibit warnings for multiple targets
spm_utils inhibit_all_warnings --target Nimble --target Moya
License
MIT.