This document guides you through how to config cocoapods-binary-cache
via the config_cocoapods_binary_cache
method in Podfile.
Following are the options available in config_cocoapods_binary_cache
. Options marked with (*) are mandatory for the plugin.
Configure cache repo
config_cocoapods_binary_cache(
cache_repo: {
"default" => {
"remote" => "git@cache_repo.git",
"local" => "~/.cocoapods-binary-cache/prebuilt-frameworks-debug-config"
},
"test" => {
"remote" => "git@another_cache_repo.git",
"local" => "~/.cocoapods-binary-cache/prebuilt-frameworks-test-config"
}
}
)
Note: The cache repo can be specified in the CLI of fetch
/prebuild
/push
command with the --repo
option (default
is used if not specified):
bundle exec pod binary fetch --repo=test
- Default:
_Prebuild
. - The path to the prebuild sandbox.
- Default:
Debug
. - The configuration to use (such as
Debug
) when prebuilding pods.
Note: This config can be overriden by the option --config
in the prebuild
CLI:
bundle exec pod binary prebuild --config=Test
- Default:
[]
. - A list of pods to exclude (ie. treat them as non-prebuilt pods).
Note:
- By default, pods with empty sources (ie. pods with header files only) will be automatically excluded and they will be later integrated as normal. For now, we rely on the
source_files
patterns declared in podspec to heuristically detect empty-sources pods. - However, there are cases in which the
source_files
of a pod looks like non-empty sources (ex.s.source_files = "**/*.{c,h,m,mm,cpp}"
) despite having header files only. For those cases, you need to manually add them to theexcluded_pods
option.
- Default:
false
. - Enable bitcode generation when building frameworks
- Default:
false
. - Enable prebuilt frameworks to be used with devices.
- Default:
false
. - Enable
xcframework
support. This is useful when prebuilding for multi architectures (for simulators & devices).
NOTE: On ARM-based macs, please set this option totrue
as creating fat binaries withlipo
no longer works on those machines.
- Default:
false
. - Disable dSYM generation when prebuilding frameworks.
- Default:
nil
. - The path to save cache validation (missed/hit). Do nothing if not specified.
- Default:
nil
. - Validate build settings of the prebuilt frameworks. A framework that has incompatible build settings will be treated as a cache miss. If this option is not specified, only versions of the prebuilt pods are used to check for cache hit/miss. Below is a sample build settings validation:
config_cocoapods_binary_cache(
validate_prebuilt_settings: lambda { |target|
settings = {}
settings["MACH_O_TYPE"] = "mh_dylib" if must_be_dynamic_frameworks.include?(target)
settings["SWIFT_VERSION"] = swift_version_for(target)
settings
}
)
- Default:
nil
. - This option provide a hook to run code generation for prebuilding frameworks (in a prebuild job). A typical example is when you need to generate code using R.swift.
- If the code generation is independent of
Pods.xcodeproj
, it is recommended to move code generation prior to pod installation. In that case, you don't need this option. - Otherwise, use this option to trigger code generation. It will be triggered just before prebuilding frameworks.
Do take note that if the code generation requires thePods.xcodeproj
, the project should correspond to the prebuilt sandbox (for ex._Prebuild/
, accessed viainstaller.sandbox.root
), not the standard sandbox (Pods
)
- If the code generation is independent of
config_cocoapods_binary_cache(
prebuild_code_gen: lambda { |installer, targets_to_prebuild|
`sh scripts/codegen_for_prebuild.sh`
}
)
- Default:
false
. - Suppress build output.
- Default:
nil
. - The
xcodebuild
log when prebuilding frameworks.