Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,26 @@ If you've cloned the repo and want to run the sample app, you will first need to
yarn sample android
```

## Optional: Speed up builds with ccache
## Optional: Speed up builds with sccache

For faster native compilation (especially on incremental builds), you can install [ccache](https://ccache.dev/), a compiler cache:
For faster native compilation (especially on incremental builds), you can install [sccache](https://github.com/mozilla/sccache), a shared compilation cache:

```sh
# macOS (using Homebrew)
brew install ccache
brew install sccache

# Ubuntu/Debian
sudo apt-get install ccache
cargo install sccache

# Other systems: see https://ccache.dev/download.html
# Other systems: see https://github.com/mozilla/sccache#installation
```

The build scripts will automatically detect and use ccache if available. If you encounter any build issues, you can temporarily disable it:
The build scripts will automatically detect and use sccache if available. If you encounter any build issues, you can temporarily disable it:

```sh
# Disable ccache for a single build
CCACHE=false yarn sample ios
CCACHE=false yarn sample android
# Disable sccache for a single build
SCCACHE=false yarn sample ios
SCCACHE=false yarn sample android
```

## Making changes to the Native Module
Expand Down
6 changes: 3 additions & 3 deletions dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type: node
up:
- packages:
- swiftlint
- ccache
- sccache
- ruby
- xcode:
version: "26.2"
Expand Down Expand Up @@ -63,8 +63,8 @@ commands:
yarn module clean
yarn sample clean
yarn clean
if command -v ccache >/dev/null 2>&1; then
ccache -C
if command -v sccache >/dev/null 2>&1; then
sccache --stop-server 2>/dev/null || true
fi
echo "✅ Cleaned root, module and sample workspaces"

Expand Down
3 changes: 1 addition & 2 deletions sample/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ target 'ReactNative' do

post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
# Enable ccache by default - controlled via build script PATH manipulation
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false,
:ccache_enabled => true
:ccache_enabled => false
)
end
end
2 changes: 1 addition & 1 deletion sample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3002,6 +3002,6 @@ SPEC CHECKSUMS:
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: a742cc68e8366fcfc681808162492bc0aa7a9498

PODFILE CHECKSUM: fd33aecb7567319d7ce333f6952f4bf6c215a4e1
PODFILE CHECKSUM: 81acd7bd19af2e0a9570ba0704d5dee4fb230eca

COCOAPODS: 1.15.2
18 changes: 8 additions & 10 deletions sample/ios/ReactNative.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CC = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang.sh";
CCACHE_BINARY = /opt/homebrew/bin/ccache;
CC = "";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -845,7 +844,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CXX = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang++.sh";
CXX = "";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
Expand All @@ -866,8 +865,8 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.6;
LD = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang.sh";
LDPLUSPLUS = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang++.sh";
LD = "";
LDPLUSPLUS = "";
LD_RUNPATH_SEARCH_PATHS = (
/usr/lib/swift,
"$(inherited)",
Expand Down Expand Up @@ -900,8 +899,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CC = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang.sh";
CCACHE_BINARY = /opt/homebrew/bin/ccache;
CC = "";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -929,7 +927,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
CXX = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang++.sh";
CXX = "";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
Expand All @@ -946,8 +944,8 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.6;
LD = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang.sh";
LDPLUSPLUS = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang++.sh";
LD = "";
LDPLUSPLUS = "";
LD_RUNPATH_SEARCH_PATHS = (
/usr/lib/swift,
"$(inherited)",
Expand Down
18 changes: 10 additions & 8 deletions sample/scripts/build_ios
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
set -ex
set -eo pipefail

# Add ccache to PATH if available for faster compilation outside of CI environments
# Can be disabled with CCACHE=false for debugging or matching CI behavior locally
if [ "$CI" = "true" ] || [ "$CCACHE" = "false" ]; then
# CI detected or ccache explicitly disabled - skipping ccache for clean builds
if command -v ccache >/dev/null 2>&1; then
ccache -C
# Add sccache for faster compilation outside of CI environments
# Can be disabled with SCCACHE=false for debugging or matching CI behavior locally
if [ "$CI" = "true" ] || [ "$SCCACHE" = "false" ]; then
# CI detected or sccache explicitly disabled - skipping sccache for clean builds
if command -v sccache >/dev/null 2>&1; then
sccache --stop-server 2>/dev/null || true
fi
else
if [ -d "/opt/homebrew/opt/ccache/libexec" ]; then
export PATH="/opt/homebrew/opt/ccache/libexec:$PATH"
if command -v sccache >/dev/null 2>&1; then
export RUSTC_WRAPPER=sccache
export CC="sccache clang"
export CXX="sccache clang++"
fi
fi

Expand Down
Loading