Skip to content

Commit 4dba110

Browse files
committed
Apply React Native's ccache tuning to the Xcode build
The first green run cached almost nothing: 2160 of 2190 calls uncacheable, and the 30 hits came from the CMake bootstrap rather than Xcode. React Native ships scripts/xcode/ccache.conf for exactly this, but it only takes effect through their ccache-clang.sh wrapper, which sets CCACHE_CONFIGPATH to it. Moving ccache to a compiler launcher dropped the wrapper and with it that config, leaving ccache on its defaults — under which Xcode's -fmodules, precompiled headers, -index-store-path and -ivfsoverlay all make a compile "too hard" to cache. So set the same options directly. They land in the config file the ccache action already writes, which is where the launcher's ccache reads them from, so the previous CCACHE_DIR/MAXSIZE/COMPILERCHECK exports are now redundant and go. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UxzZtpa5Nz3F8ACXzX7Hww
1 parent da7fc9a commit 4dba110

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

‎.github/workflows/check.yml‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,17 @@ jobs:
197197
env:
198198
CMAKE_RN_TRIPLETS: arm64;x86_64-apple-ios-sim
199199
FERRIC_TARGETS: aarch64-apple-ios-sim,x86_64-apple-ios
200-
# So the ccache action's config applies to the ccache Xcode launches too.
201-
- name: Expose Ccache config to Xcode
200+
# Mirrors React Native's scripts/xcode/ccache.conf, which only applied
201+
# while ccache ran through their wrapper script (it sets CCACHE_CONFIGPATH
202+
# to it) and so no longer does now that it runs as a compiler launcher.
203+
# Without this sloppiness Xcode's modules, PCH and index-store flags leave
204+
# ccache treating almost every compile as uncacheable.
205+
- name: Tune ccache for Xcode
202206
run: |
203-
echo "CCACHE_DIR=`ccache --get-config cache_dir`" >> $GITHUB_ENV
204-
echo "CCACHE_MAXSIZE=`ccache --get-config max_size`" >> $GITHUB_ENV
205-
echo "CCACHE_COMPILERCHECK=`ccache --get-config compiler_check`" >> $GITHUB_ENV
207+
ccache --set-config sloppiness=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros
208+
ccache --set-config file_clone=true
209+
ccache --set-config depend_mode=true
210+
ccache --set-config inode_cache=true
206211
# Must precede `pod install`: react-native-test-app embeds the resources
207212
# declared in app.json when generating the workspace, skipping missing
208213
# ones, and the app would then expect a Metro dev server at runtime.

0 commit comments

Comments
 (0)