How to use buildcache with Fastlane?
eladgel opened this issue · 1 comments
Will this also work for projects that use Fastlane?
Hi there! fastlane and any compiler caches are orthogonal I think - stated differently, they have different concerns. Fastlane orchestrates builds, buildcache (or ccache, etc) accelerate builds (possibly orchestrated by fastlane)
Okay that's blah blah blah ;-), I use fastlane also and if you have buildcache (or ccache) installed as a symlink and you have your build configured such that whenever you call "xcodebuild" it calls "clang" with no absolute path or calls your symlinked-to-buildcache clang, then it works yes!
That's still a little abstract, here's how I actually do it, by using a post-install hook in my Podfile to modify what clang/clang++/ld/ld++ my project uses during any build. After doing this, any Xcode build will end up using the symlink, so the compiler cache is accessed, so when fastlane calls xcodebuild it all works.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# Using the un-qualified names means you can swap in different implementations, for example ccache
config.build_settings["CC"] = "clang"
config.build_settings["LD"] = "clang"
config.build_settings["CXX"] = "clang++"
config.build_settings["LDPLUSPLUS"] = "clang++"
end
end
end