Skip to content

Commit 0da97f9

Browse files
authored
Conditionally use local sources for Firestore (#3648)
This will force post-merge builds to validate compatibility with pre-release versions of other Firebase pods
1 parent 937a736 commit 0da97f9

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

Firestore/Example/Podfile

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,50 @@ post_install do |installer|
2929
end
3030
end
3131

32+
# Returns true if the user has explicitly requested local sources or if this is
33+
# a non-PR Travis build.
34+
def use_local_sources()
35+
return ENV.has_key?('USE_LOCAL_SOURCES') || ENV['TRAVIS_PULL_REQUEST'] == 'false'
36+
end
37+
38+
# Adds a `pod name, :path => ../..` declaration to use local sources if the
39+
# Podfile has been configured to operate that way.
40+
def maybe_local_pod(name)
41+
if use_local_sources()
42+
pod name, :path => '../..'
43+
end
44+
end
45+
46+
# Adds local pod declarations for all Firestore's transitive dependencies if
47+
# required.
48+
def configure_local_pods()
49+
# Firestore is always local; that's what's under development here.
50+
pod 'FirebaseFirestore', :path => '../../'
51+
52+
# FirebaseCore must always be a local pod so that CI builds that make changes
53+
# to its podspec can still function. See Firestore-*-xcodebuild in
54+
# scripts/install_prereqs.sh for more details.
55+
pod 'FirebaseCore', :path => '../..'
56+
57+
# Pull in local sources conditionally.
58+
maybe_local_pod 'FirebaseAuth'
59+
maybe_local_pod 'FirebaseAuthInterop'
60+
maybe_local_pod 'FirebaseCoreDiagnostics'
61+
maybe_local_pod 'FirebaseCoreDiagnosticsInterop'
62+
maybe_local_pod 'GoogleDataTransport'
63+
maybe_local_pod 'GoogleDataTransportCCTSupport'
64+
maybe_local_pod 'GoogleUtilities'
65+
end
3266

3367
target 'Firestore_Example_iOS' do
3468
platform :ios, '8.0'
3569

3670
# The next line is the forcing function for the Firebase pod. The Firebase
3771
# version's subspecs should depend on the component versions in their
38-
# corresponding podspec's.
72+
# corresponding podspecs.
3973
pod 'Firebase/CoreOnly', '6.7.0'
4074

41-
pod 'FirebaseFirestore', :path => '../../'
42-
pod 'FirebaseCore', :path => '../../'
75+
configure_local_pods()
4376

4477
target 'Firestore_Tests_iOS' do
4578
inherit! :search_paths
@@ -86,8 +119,7 @@ end
86119
target 'Firestore_Example_macOS' do
87120
platform :osx, '10.11'
88121

89-
pod 'FirebaseFirestore', :path => '../../'
90-
pod 'FirebaseCore', :path => '../../'
122+
configure_local_pods()
91123

92124
target 'Firestore_Tests_macOS' do
93125
inherit! :search_paths
@@ -116,8 +148,7 @@ end
116148
target 'Firestore_Example_tvOS' do
117149
platform :tvos, '10.0'
118150

119-
pod 'FirebaseFirestore', :path => '../../'
120-
pod 'FirebaseCore', :path => '../../'
151+
configure_local_pods()
121152

122153
target 'Firestore_Tests_tvOS' do
123154
inherit! :search_paths

scripts/sync_project.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def sync_firestore(test_only)
141141

142142
['iOS', 'macOS', 'tvOS'].each do |platform|
143143
s.target "Firestore_Example_#{platform}" do |t|
144-
t.xcconfig = xcconfig_objc + {
144+
t.xcconfig = xcconfig_objc + xcconfig_swift + {
145145
# Passing -all_load is required to get all our C++ code into the test
146146
# host.
147147
#
@@ -171,7 +171,7 @@ def sync_firestore(test_only)
171171
# These files are integration tests, handled below
172172
'Firestore/Example/Tests/Integration/**',
173173
]
174-
t.xcconfig = xcconfig_objc
174+
t.xcconfig = xcconfig_objc + xcconfig_swift
175175
end
176176
end
177177

0 commit comments

Comments
 (0)