Problem Statement
When the build cache option is enabled, SWIFT_ENABLE_EXPLICIT_MODULES=YES is automatically added to CLI xcodebuild options, which affects all projects in the build environment.
However, some of our projects require SWIFT_ENABLE_EXPLICIT_MODULES=NO to be set. This is mandatory for our app security solution to work properly.
Current Behavior
- Build cache option automatically sets
SWIFT_ENABLE_EXPLICIT_MODULES=YES globally
- This setting is applied to all projects regardless of their individual requirements
- No way to override this on a per-project basis
- Projects that need
SWIFT_ENABLE_EXPLICIT_MODULES=NO cannot use build cache currently
Requested Feature
We would like the build cache to respect project-specific settings. Specifically:
- Project-level configuration: Allow the build cache to check the project’s build settings and respect `SWIFT_ENABLE_EXPLICIT_MODULES` value set in the project
- Conditional cache behavior: If a project has
SWIFT_ENABLE_EXPLICIT_MODULES=NO in its build settings, the build cache should not override it with YES
- Flexibility: Projects should be able to opt-in or opt-out of the automatic
SWIFT_ENABLE_EXPLICIT_MODULES=YES behavior
Thank you for considering this feature request!
Thanks for the detailed feature request @danube83 !
We’ll look into this soon and discuss what the right solution would be.
1 Like
Update: we discussed the potential solutions, and we plan to:
- Add a new option to the Step & CLI to not to set any Xcode settings, except the
proxy path.
- This means that additional setups might be required in your Xcode project settings.
- We’ll also provide a DevCenter guide about how to use this option (what needs to be set in Xcode project settings), and we’ll link to it in the Step Input’s description.
We’ll try to implement this as soon as possible.
2 Likes
Update: FAQ page will go live soon, but in the meantime we already released the related Step update. Short guide:
- Select the
Build Cache for Xcode step in the workflow editor
- Set the input
Skip passing cache flags to xcodebuild to true
- Note: if you don’t see this input make sure you use at lest version
0.4.1 or newer.
- And follow the guide below to configure your Xcode project:
How to pass compilation cache build flags manually?
If you would like to enable compilation caching manually per-project, you can disable passing the necessary flags in the Build cache for Xcode step (on Bitrise CI), by setting the step input “Skip passing cache flags to xcodebuild”. If you are using the Bitrise Build Cache CLI locally, you can pass the --cache-skip-flags to your activate xcode command.
In this case, you will need to manually set some flags per-build, or in your project’s build settings. Note: some might already have a named version in Xcode IDE, e.g. “Enable Compilation Caching”, or “Explicitly Built Modules”. These are the flags we pass by default:
- “COMPILATION_CACHE_ENABLE_PLUGIN”: “YES”
- “COMPILATION_CACHE_ENABLE_INTEGRATED_QUERIES”: “YES”
- “COMPILATION_CACHE_ENABLE_DETACHED_KEY_QUERIES”: “YES”
- “SWIFT_ENABLE_COMPILE_CACHE”: “YES”
- “SWIFT_ENABLE_EXPLICIT_MODULES”: “YES”
- “SWIFT_USE_INTEGRATED_DRIVER”: “YES”
- “CLANG_ENABLE_COMPILE_CACHE”: “YES”
- “CLANG_ENABLE_MODULES”: “YES”
More information about how we pass these flags on Bitrise can be found in this blog post: Lifting the hood on Build Cache for Xcode - Bitrise Blog
If you have any questions let us know!
1 Like
Update: docs are now also live: Xcode Compilation Cache FAQ
Thank you for your updates.
1 Like