Skip to content

Commit 2b18fdf

Browse files
committed
[LOCAL][iOS] Fix RNTester project and remove CCACHE from project when disabled
1 parent 92c6d22 commit 2b18fdf

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

packages/react-native/scripts/cocoapods/utils.rb

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,12 @@ def self.set_ccache_compiler_and_linker_build_settings(installer, react_native_p
9898
Pod::UI.puts("#{message_prefix}: Ccache found at #{ccache_path}")
9999
end
100100

101+
# Using scripts wrapping the ccache executable, to allow injection of configurations
102+
ccache_clang_sh = File.join("$(REACT_NATIVE_PATH)", 'scripts', 'xcode', 'ccache-clang.sh')
103+
ccache_clangpp_sh = File.join("$(REACT_NATIVE_PATH)", 'scripts', 'xcode', 'ccache-clang++.sh')
104+
101105
if ccache_available and ccache_enabled
102106
Pod::UI.puts("#{message_prefix}: Setting CC, LD, CXX & LDPLUSPLUS build settings")
103-
# Using scripts wrapping the ccache executable, to allow injection of configurations
104-
ccache_clang_sh = File.join("$(REACT_NATIVE_PATH)", 'scripts', 'xcode', 'ccache-clang.sh')
105-
ccache_clangpp_sh = File.join("$(REACT_NATIVE_PATH)", 'scripts', 'xcode', 'ccache-clang++.sh')
106107

107108
projects.each do |project|
108109
project.build_configurations.each do |config|
@@ -119,6 +120,20 @@ def self.set_ccache_compiler_and_linker_build_settings(installer, react_native_p
119120
Pod::UI.puts("#{message_prefix}: Pass ':ccache_enabled => true' to 'react_native_post_install' in your Podfile or set environment variable 'USE_CCACHE=1' to increase the speed of subsequent builds")
120121
elsif !ccache_available and ccache_enabled
121122
Pod::UI.warn("#{message_prefix}: Install ccache or ensure your neither passing ':ccache_enabled => true' nor setting environment variable 'USE_CCACHE=1'")
123+
else
124+
Pod::UI.puts("#{message_prefix}: Removing Ccache from CC, LD, CXX & LDPLUSPLUS build settings")
125+
126+
projects.each do |project|
127+
project.build_configurations.each do |config|
128+
# Using the un-qualified names means you can swap in different implementations, for example ccache
129+
config.build_settings["CC"] = config.build_settings["CC"] ? config.build_settings["CC"].gsub(/#{Regexp.escape(ccache_clang_sh)}/, '') : ""
130+
config.build_settings["LD"] = config.build_settings["LD"] ? config.build_settings["LD"].gsub(/#{Regexp.escape(ccache_clang_sh)}/, "") : ""
131+
config.build_settings["CXX"] = config.build_settings["CXX"] ? config.build_settings["CXX"].gsub(/#{Regexp.escape(ccache_clangpp_sh)}/, "") : ""
132+
config.build_settings["LDPLUSPLUS"] = config.build_settings["LDPLUSPLUS"] ? config.build_settings["LDPLUSPLUS"].gsub(/#{Regexp.escape(ccache_clangpp_sh)}/, "") : ""
133+
end
134+
135+
project.save()
136+
end
122137
end
123138
end
124139

packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@
162162
E7DB215F22B2F3EC005AC45F /* RCTUIManagerScenarioTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIManagerScenarioTests.m; sourceTree = "<group>"; };
163163
E7DB218B22B41FCD005AC45F /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = XCTest.framework; sourceTree = DEVELOPER_DIR; };
164164
EB39930F368F8A8EF2223131 /* Pods-RNTesterIntegrationTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterIntegrationTests.release.xcconfig"; path = "Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests.release.xcconfig"; sourceTree = "<group>"; };
165-
FDC71B375B04D2F3DD483B6C /* libPods-RNTester.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTester.a"; sourceTree = BUILT_PRODUCTS_DIR; };
166165
F0D621C22BBB9E38005960AC /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
166+
FDC71B375B04D2F3DD483B6C /* libPods-RNTester.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTester.a"; sourceTree = BUILT_PRODUCTS_DIR; };
167167
/* End PBXFileReference section */
168168

169169
/* Begin PBXFrameworksBuildPhase section */
@@ -863,7 +863,7 @@
863863
isa = XCBuildConfiguration;
864864
buildSettings = {
865865
ALWAYS_SEARCH_USER_PATHS = NO;
866-
CC = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang.sh";
866+
CC = "";
867867
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
868868
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
869869
CLANG_CXX_LIBRARY = "libc++";
@@ -894,7 +894,7 @@
894894
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
895895
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
896896
COPY_PHASE_STRIP = NO;
897-
CXX = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang++.sh";
897+
CXX = "";
898898
ENABLE_BITCODE = NO;
899899
ENABLE_STRICT_OBJC_MSGSEND = YES;
900900
ENABLE_TESTABILITY = YES;
@@ -935,8 +935,8 @@
935935
"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
936936
);
937937
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
938-
LD = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang.sh";
939-
LDPLUSPLUS = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang++.sh";
938+
LD = "";
939+
LDPLUSPLUS = "";
940940
MTL_ENABLE_DEBUG_INFO = YES;
941941
ONLY_ACTIVE_ARCH = YES;
942942
OTHER_CFLAGS = "$(inherited)";
@@ -967,7 +967,7 @@
967967
isa = XCBuildConfiguration;
968968
buildSettings = {
969969
ALWAYS_SEARCH_USER_PATHS = NO;
970-
CC = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang.sh";
970+
CC = "";
971971
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
972972
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
973973
CLANG_CXX_LIBRARY = "libc++";
@@ -998,7 +998,7 @@
998998
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
999999
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
10001000
COPY_PHASE_STRIP = YES;
1001-
CXX = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang++.sh";
1001+
CXX = "";
10021002
ENABLE_BITCODE = NO;
10031003
ENABLE_NS_ASSERTIONS = NO;
10041004
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -1032,8 +1032,8 @@
10321032
"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
10331033
);
10341034
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
1035-
LD = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang.sh";
1036-
LDPLUSPLUS = "$(REACT_NATIVE_PATH)/scripts/xcode/ccache-clang++.sh";
1035+
LD = "";
1036+
LDPLUSPLUS = "";
10371037
MTL_ENABLE_DEBUG_INFO = NO;
10381038
OTHER_CFLAGS = "$(inherited)";
10391039
OTHER_CPLUSPLUSFLAGS = (

0 commit comments

Comments
 (0)