Skip to content

Commit 19eec56

Browse files
markchandlera-maurice
authored andcommitted
Firebase cpp: Refactored pod file install for iOS to be a single build step to avoid multi job builds running into file locks
PiperOrigin-RevId: 281301811
1 parent cb10944 commit 19eec56

File tree

17 files changed

+267
-433
lines changed

17 files changed

+267
-433
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ endif()
279279
# then refer to.
280280
set(FIREBASE_CPP_SDK_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
281281

282+
include(binary_to_array)
283+
include(firebase_cpp_gradle)
284+
285+
add_subdirectory(ios_pod)
286+
282287
# If we're building tests, we need to include the 'testing' folder before any
283288
# of the tests actually get built.
284289
if(FIREBASE_CPP_BUILD_TESTS)

admob/CMakeLists.txt

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@
1414

1515
# CMake file for the firebase_admob library
1616

17-
cmake_minimum_required (VERSION 3.1)
18-
set (CMAKE_CXX_STANDARD 11)
19-
20-
include(binary_to_array)
21-
include(download_pod_headers)
22-
include(firebase_cpp_gradle)
23-
24-
project(firebase_admob NONE)
25-
enable_language(C)
26-
enable_language(CXX)
27-
2817
# Common source files used by all platforms
2918
set(common_SRCS
3019
src/common/admob_common.cc
@@ -121,29 +110,13 @@ elseif(IOS)
121110
APPEND_STRING PROPERTY
122111
COMPILE_FLAGS "-fobjc-arc")
123112

124-
# Setup the target for getting the Firebase iOS SDK headers through Cocoapods.
125-
set(pod_target_name "download_admob_pod_headers")
126-
set(pods_dir "${PROJECT_BINARY_DIR}/Pods")
127-
set(pod_list "")
128-
list(APPEND pod_list "'Firebase/AdMob', '6.10.0'")
129-
130-
setup_pod_headers_target("${pod_target_name}" "${pods_dir}" "${pod_list}")
131-
132-
# Add the Cocoapod headers to the include directories
133-
set(base_header_dir "${pods_dir}/Pods/Headers/Public")
134-
target_include_directories(firebase_admob
135-
PRIVATE
136-
${base_header_dir}/Google-Mobile-Ads-SDK
113+
setup_pod_headers(
114+
firebase_admob
115+
POD_NAMES
116+
Google-Mobile-Ads-SDK
137117
)
138-
string(CONCAT google_mobile_ads_framework_path
139-
"${pods_dir}/Pods/Google-Mobile-Ads-SDK/"
140-
"Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.framework")
118+
141119
# AdMob expects the header files to be in a subfolder, so set up a symlink to
142120
# accomplish that.
143-
symlink_framework_headers(firebase_admob ${pod_target_name}
144-
${google_mobile_ads_framework_path} GoogleMobileAds
145-
)
146-
147-
# Add a dependency to downloading the headers onto admob.
148-
add_dependencies(firebase_admob ${pod_target_name})
121+
symlink_pod_headers(firebase_admob Google-Mobile-Ads-SDK GoogleMobileAds)
149122
endif()

analytics/CMakeLists.txt

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,6 @@
1414

1515
# CMake file for the firebase_analytics library
1616

17-
cmake_minimum_required (VERSION 3.1)
18-
set (CMAKE_CXX_STANDARD 11)
19-
20-
include(download_pod_headers)
21-
include(firebase_cpp_gradle)
22-
23-
project(firebase_analytics NONE)
24-
enable_language(C)
25-
enable_language(CXX)
26-
2717
# Analytics generates header files for default events, parameters, and
2818
# properties based on the iOS SDK, that are used across all platforms.
2919
set(analytics_generated_headers_dir
@@ -131,27 +121,12 @@ elseif(IOS)
131121
APPEND_STRING PROPERTY
132122
COMPILE_FLAGS "-fobjc-arc")
133123

134-
# Setup the target for getting the Firebase iOS SDK headers through Cocoapods.
135-
set(pod_target_name "download_analytics_pod_headers")
136-
set(pods_dir "${PROJECT_BINARY_DIR}/Pods")
137-
set(pod_list "")
138-
list(APPEND pod_list "'Firebase/Core', '6.10.0'")
139-
list(APPEND pod_list "'Firebase/Analytics', '6.10.0'")
140-
141-
setup_pod_headers_target("${pod_target_name}" "${pods_dir}" "${pod_list}")
142-
143-
# Add the Cocoapod headers to the include directories
144-
set(base_header_dir "${pods_dir}/Pods/Headers/Public")
145-
set(analytics_framework_path
146-
"${pods_dir}/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework")
147-
target_include_directories(firebase_analytics
148-
PRIVATE
149-
${base_header_dir}/FirebaseCore
150-
${analytics_framework_path}/Headers
124+
setup_pod_headers(
125+
firebase_analytics
126+
POD_NAMES
127+
FirebaseCore
128+
FirebaseAnalytics
151129
)
152-
153-
# Add a dependency to downloading the headers onto analytics.
154-
add_dependencies(firebase_analytics ${pod_target_name})
155130
endif()
156131

157132
if(FIREBASE_CPP_BUILD_TESTS)

app/CMakeLists.txt

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,6 @@
1414

1515
# CMake file for the firebase_app library
1616

17-
cmake_minimum_required (VERSION 3.1)
18-
set (CMAKE_CXX_STANDARD 11)
19-
20-
include(FindPkgConfig)
21-
include(binary_to_array)
22-
include(download_pod_headers)
23-
include(firebase_cpp_gradle)
24-
25-
project(firebase_app NONE)
26-
enable_language(C)
27-
enable_language(CXX)
28-
2917
# Define how to generate google_services_resource_(source/header)
3018
binary_to_array("google_services_resource"
3119
"${CMAKE_CURRENT_LIST_DIR}/google_services.fbs"
@@ -356,27 +344,15 @@ elseif(IOS)
356344
APPEND_STRING PROPERTY
357345
COMPILE_FLAGS "-fobjc-arc")
358346

359-
# Setup the target for getting the Firebase iOS SDK headers through Cocoapods.
360-
set(pod_target_name "download_app_pod_headers")
361-
set(pods_dir "${PROJECT_BINARY_DIR}/Pods")
362-
set(pod_list "")
363-
list(APPEND pod_list "'Firebase/Core', '6.10.0'")
364-
list(APPEND pod_list "'Firebase/DynamicLinks', '6.10.0'")
365-
366-
setup_pod_headers_target("${pod_target_name}" "${pods_dir}" "${pod_list}")
367-
368-
# Add the Cocoapod headers to the include directories
369-
set(base_header_dir "${pods_dir}/Pods/Headers/Public")
370-
target_include_directories(firebase_app
371-
PRIVATE
372-
${base_header_dir}
373-
${base_header_dir}/FirebaseCore
374-
${base_header_dir}/FirebaseDynamicLinks
375-
${base_header_dir}/FirebaseInstanceID
347+
# Add empty include path to get root include folder '.'
348+
setup_pod_headers(
349+
firebase_app
350+
POD_NAMES
351+
.
352+
FirebaseCore
353+
FirebaseDynamicLinks
354+
FirebaseInstanceID
376355
)
377-
378-
# Add a dependency to downloading the headers onto app.
379-
add_dependencies(firebase_app ${pod_target_name})
380356
endif()
381357

382358
if (NOT ANDROID AND NOT IOS)

auth/CMakeLists.txt

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@
1414

1515
# CMake file for the firebase_auth library
1616

17-
cmake_minimum_required (VERSION 3.1)
18-
set (CMAKE_CXX_STANDARD 11)
19-
20-
include(binary_to_array)
21-
include(download_pod_headers)
22-
include(firebase_cpp_gradle)
23-
24-
project(firebase_auth NONE)
25-
enable_language(C)
26-
enable_language(CXX)
27-
2817
# Generate the resource files from the flatbuffer schema files.
2918
binary_to_array("request_resource"
3019
"${CMAKE_CURRENT_LIST_DIR}/src/desktop/rpcs/request.fbs"
@@ -208,25 +197,12 @@ elseif(IOS)
208197
APPEND_STRING PROPERTY
209198
COMPILE_FLAGS "-fobjc-arc")
210199

211-
# Setup the target for getting the Firebase iOS SDK headers through Cocoapods.
212-
set(pod_target_name "download_auth_pod_headers")
213-
set(pods_dir "${PROJECT_BINARY_DIR}/Pods")
214-
set(pod_list "")
215-
list(APPEND pod_list "'Firebase/Core', '6.10.0'")
216-
list(APPEND pod_list "'Firebase/Auth', '6.10.0'")
217-
218-
setup_pod_headers_target("${pod_target_name}" "${pods_dir}" "${pod_list}")
219-
220-
# Add the Cocoapod headers to the include directories
221-
set(base_header_dir "${pods_dir}/Pods/Headers/Public")
222-
target_include_directories(firebase_auth
223-
PRIVATE
224-
${base_header_dir}/FirebaseCore
225-
${base_header_dir}/FirebaseAuth
200+
setup_pod_headers(
201+
firebase_auth
202+
POD_NAMES
203+
FirebaseCore
204+
FirebaseAuth
226205
)
227-
228-
# Add a dependency to downloading the headers onto auth.
229-
add_dependencies(firebase_auth ${pod_target_name})
230206
endif()
231207

232208
if(FIREBASE_CPP_BUILD_TESTS)

cmake/download_pod_headers.cmake

Lines changed: 0 additions & 109 deletions
This file was deleted.

database/CMakeLists.txt

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@
1414

1515
# CMake file for the firebase_database library
1616

17-
cmake_minimum_required (VERSION 3.1)
18-
set (CMAKE_CXX_STANDARD 11)
19-
20-
include(binary_to_array)
21-
include(download_pod_headers)
22-
include(firebase_cpp_gradle)
23-
24-
project(firebase_database NONE)
25-
enable_language(C)
26-
enable_language(CXX)
27-
2817
# Common source files used by all platforms
2918
set(common_SRCS
3019
src/common/common.cc
@@ -206,25 +195,12 @@ elseif(IOS)
206195
APPEND_STRING PROPERTY
207196
COMPILE_FLAGS "-fobjc-arc")
208197

209-
# Setup the target for getting the Firebase iOS SDK headers through Cocoapods.
210-
set(pod_target_name "download_database_pod_headers")
211-
set(pods_dir "${PROJECT_BINARY_DIR}/Pods")
212-
set(pod_list "")
213-
list(APPEND pod_list "'Firebase/Core', '6.10.0'")
214-
list(APPEND pod_list "'Firebase/Database', '6.10.0'")
215-
216-
setup_pod_headers_target("${pod_target_name}" "${pods_dir}" "${pod_list}")
217-
218-
# Add the Cocoapod headers to the include directories
219-
set(base_header_dir "${pods_dir}/Pods/Headers/Public")
220-
target_include_directories(firebase_database
221-
PRIVATE
222-
${base_header_dir}/FirebaseCore
223-
${base_header_dir}/FirebaseDatabase
198+
setup_pod_headers(
199+
firebase_database
200+
POD_NAMES
201+
FirebaseCore
202+
FirebaseDatabase
224203
)
225-
226-
# Add a dependency to downloading the headers onto database.
227-
add_dependencies(firebase_database ${pod_target_name})
228204
endif()
229205

230206
if(FIREBASE_CPP_BUILD_TESTS)

0 commit comments

Comments
 (0)