Caching, a simple solution to speeding up build times
Build times can be long, excruciatingly long, especially when dealing with Swift. A simple solution to mitigate the problem is caching pre-built dependencies. Rome is a tool that can help with that in combination with Carthage.
Caching, a simple solution to speeding up build times Rome, a cache for Carthage Tommaso Piazza - @tmpz https://github.com/blender/Rome - CocoaHeads Berlin 17/05/2017 - @tmpz
More Problems • Frameworks versions change very frequently (every build) • Long app build times (~45m) • Change branch, rebuild at different hash • Sharing https://github.com/blender/Rome - CocoaHeads Berlin 17/05/2017 - @tmpz
Existing solutions - 2 • Attach build to Github release • Github is not an option for everyone • Tag every build https://github.com/blender/Rome - CocoaHeads Berlin 17/05/2017 - @tmpz
Rome Features • Cache just what you need • Per dependency cache keys derived from Cartfile.resolved • Cache redundancy • local folder • Amazon S3 https://github.com/blender/Rome - CocoaHeads Berlin 17/05/2017 - @tmpz
More Rome Features • Probe cache for presence of single key • Blacklist some keys • Selective Download/Upload • 1,2,3... all frameworks • Per platform cache • iOS, tvOS, MacOS, watchOS https://github.com/blender/Rome - CocoaHeads Berlin 17/05/2017 - @tmpz
Automation Ready • Use on CI • Use with fastlane • @netbe's fastlane-plugin-rome https://github.com/blender/Rome - CocoaHeads Berlin 17/05/2017 - @tmpz
Alone? Useful for a one man team • Change branch • Pull framework version from cache • Enjoy • No rebuilds, no waiting • Productive, not painful experience https://github.com/blender/Rome - CocoaHeads Berlin 17/05/2017 - @tmpz
Workflow example • Download available frameworks • Build only what is missing • Upload what was built • rome list --missing --platform ios | awk '{print $1}' | xargs carthage build --platform ios https://github.com/blender/Rome - CocoaHeads Berlin 17/05/2017 - @tmpz
Set up checklist • Cartfile.resolved • Romefile And you're done! • When using S3 • ~/.aws/config or environment variable • ~/.aws/credentials or environment variable https://github.com/blender/Rome - CocoaHeads Berlin 17/05/2017 - @tmpz
Why Romefile? - Cache Section To specify cache locations and names [Cache] # Mandatory section S3-Bucket = feingoldtech-development-ios # Optional local = ~/Library/Caches/Rome # Optional, but at least one of the two [RepositoryMap] ... [IgnoreMap] ... https://github.com/blender/Rome - CocoaHeads Berlin 17/05/2017 - @tmpz
Why Romefile? - RepositoryMap Section Not needed if dependencies follow Organisation\FrameworkName naming pattern. From Cartfile.resolved git "ssh://...:7999/cppdsp/feingoldtech-cpp-vadsegmentor" "d702...6d2" github "bitstadium/HockeySDK-iOS" "3.8.6" • No Organisation\FrameworkName pattern • Framework name is FGVoice • Organisation\FrameworkName pattern • Framework Name is HockeySDK • Multiple targets per project https://github.com/blender/Rome - CocoaHeads Berlin 17/05/2017 - @tmpz