Skip to content

Commit 6cf151f

Browse files
authored
Fix Xcode 8 builds (again) (#3695)
The fix in #3647 was essentially undone in #3648 because even though the podspec no longer depends on FirebaseCoreDiagnostics, adding in local pod declarations for these brought them back into the project. This change removes local pod declarations for the dependencies that break under Xcode 8 as well.
1 parent 4422243 commit 6cf151f

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

Firestore/Example/Podfile

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ def use_local_sources()
3535
return ENV.has_key?('USE_LOCAL_SOURCES') || ENV['TRAVIS_PULL_REQUEST'] == 'false'
3636
end
3737

38+
def xcode_major_version()
39+
version = `xcodebuild -version`
40+
if version =~ /^Xcode\s*(\d+)\./
41+
return $1.to_i
42+
else
43+
raise "Could not find Xcode version in '$version'"
44+
end
45+
end
46+
3847
# Adds a `pod name, :path => ../..` declaration to use local sources if the
3948
# Podfile has been configured to operate that way.
4049
def maybe_local_pod(name)
@@ -57,11 +66,28 @@ def configure_local_pods()
5766
# Pull in local sources conditionally.
5867
maybe_local_pod 'FirebaseAuth'
5968
maybe_local_pod 'FirebaseAuthInterop'
60-
maybe_local_pod 'FirebaseCoreDiagnostics'
61-
maybe_local_pod 'FirebaseCoreDiagnosticsInterop'
62-
maybe_local_pod 'GoogleDataTransport'
63-
maybe_local_pod 'GoogleDataTransportCCTSupport'
6469
maybe_local_pod 'GoogleUtilities'
70+
71+
if xcode_major_version() >= 9
72+
# Firestore still compiles with Xcode 8 to help verify general conformance
73+
# with C++11 by using an older compiler that doesn't have as many
74+
# extensions from later versions of the language. However, Firebase as a
75+
# whole does not support this environment and @available checks in
76+
# GoogleDataTransport would otherwise break this build.
77+
#
78+
# Firestore doesn't depend on GoogleDataTransport directly--it comes in as
79+
# a dependency of FirebaseCoreDiagnostics. Luckily, FirebaseCore does not
80+
# strongly depend on this, so we can edit the dependency out in the podspec
81+
# and then avoid adding those dependencies here to prevent CocoaPods from
82+
# importing it.
83+
#
84+
# This list should include the transitive closure of all dependencies of
85+
# FirebaseCoreDiagnostics, except GoogleUtilities which we otherwise need.
86+
maybe_local_pod 'FirebaseCoreDiagnostics'
87+
maybe_local_pod 'FirebaseCoreDiagnosticsInterop'
88+
maybe_local_pod 'GoogleDataTransport'
89+
maybe_local_pod 'GoogleDataTransportCCTSupport'
90+
end
6591
end
6692

6793
target 'Firestore_Example_iOS' do

0 commit comments

Comments
 (0)