Skip to content

Commit 475e0d7

Browse files
Riccardo Cipolleschifacebook-github-bot
authored andcommitted
Fix Glog for earlier versions of Xcode
Summary: Glog has a piece of code which looks like this: ``` namespace google { // They need the definitions of integer types. #include "glog/log_severity.h" #include "glog/vlog_is_on.h" ``` This fragment is: - Always valid when the pod does not define a module - Valid for Xcode >= 14.3, when the pod do define a module - Invalid for Xcode < 14.3, when the pod do define a module Modules are required to support Swift, so, in the long run, we want to have `DEFINES_MODULE` set to `YES` for `Glog`. This is a temporary workaround to keep supporting older versions of Xcode while Apple keeps allowing to use Xcode 14.1 to submit apps to the store. Historically, Apple pushes the minimum version of Xcode every April, so we expect to be able to remove this workaround in April 2024. ## Changelog: [Internal] - Make Glog work with older versions of Xcode Differential Revision: D50410487
1 parent 87dbe44 commit 475e0d7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

packages/react-native/third-party-podspecs/glog.podspec

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,23 @@ Pod::Spec.new do |spec|
2929
'src/base/*.h'
3030
spec.exclude_files = "src/windows/**/*"
3131
spec.compiler_flags = '-Wno-shorten-64-to-32'
32+
33+
# TODO: T167482718 Remove this code after April 2024, when Apple will
34+
# push the lower version of Xcode required to upload apps to the Store.
35+
xcode_path = `xcode-select -p` # This return the current version of Xcode
36+
37+
match = xcode_path.match(/Xcode(?:-|\_)(\d+)\.(\d+)/)
38+
major_version = match[1].to_i
39+
minor_version = match[2].to_i
40+
is_greater_than_15 = major_version >= 15
41+
is_greater_than_14_3 = major_version == 14 && minor_version >= 3
42+
should_define_modules = is_greater_than_15 ? "YES" : is_greater_than_14_3 ? "YES" : "NO"
43+
# End TODO.
44+
3245
spec.pod_target_xcconfig = {
3346
"USE_HEADERMAP" => "NO",
3447
"HEADER_SEARCH_PATHS" => "$(PODS_TARGET_SRCROOT)/src",
35-
"DEFINES_MODULE" => "YES"
48+
"DEFINES_MODULE" => should_define_modules # When the workaround is removed, set this var to "YES"
3649
}
3750

3851
# Pinning to the same version as React.podspec.

0 commit comments

Comments
 (0)