Skip to content

Commit dcb0b3b

Browse files
authored
(Desktop) Firestore C++ Core from TIP by default (#855)
* Get Firestore C++ Core from TIP by default * More readable * No Origin * Master! * Keep default dependency unchanged.
1 parent 0e9836f commit dcb0b3b

File tree

3 files changed

+55
-14
lines changed

3 files changed

+55
-14
lines changed

cmake/external/firestore.cmake

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,52 @@ if(TARGET firestore)
1818
return()
1919
endif()
2020

21-
set(version CocoaPods-8.12.1)
22-
ExternalProject_Add(
23-
firestore
21+
function(GetReleasedDep version)
22+
message("Getting released firebase-ios-sdk @ ${version}")
23+
ExternalProject_Add(
24+
firestore
2425

25-
DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR}
26-
URL https://github.com/firebase/firebase-ios-sdk/archive/${version}.tar.gz
26+
DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR}
27+
URL https://github.com/firebase/firebase-ios-sdk/archive/${version}.tar.gz
2728

28-
PREFIX ${PROJECT_BINARY_DIR}
29+
PREFIX ${PROJECT_BINARY_DIR}
30+
31+
CONFIGURE_COMMAND ""
32+
BUILD_COMMAND ""
33+
INSTALL_COMMAND ""
34+
TEST_COMMAND ""
35+
HTTP_HEADER "${EXTERNAL_PROJECT_HTTP_HEADER}"
36+
)
37+
endfunction()
38+
39+
function(GetTag t)
40+
message("Getting firebase-ios-sdk from ${t}")
41+
ExternalProject_Add(
42+
firestore
43+
44+
DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR}
45+
GIT_REPOSITORY "https://github.com/firebase/firebase-ios-sdk.git"
46+
GIT_TAG ${t}
47+
GIT_SHALLOW "ON"
48+
49+
PREFIX ${PROJECT_BINARY_DIR}
50+
51+
CONFIGURE_COMMAND ""
52+
BUILD_COMMAND ""
53+
INSTALL_COMMAND ""
54+
TEST_COMMAND ""
55+
HTTP_HEADER "${EXTERNAL_PROJECT_HTTP_HEADER}"
56+
)
57+
endfunction()
58+
59+
if((NOT FIRESTORE_DEP_SOURCE) OR (FIRESTORE_DEP_SOURCE STREQUAL "RELEASED"))
60+
# Get from released dependency by default
61+
GetReleasedDep("CocoaPods-8.12.1")
62+
else()
63+
if(FIRESTORE_DEP_SOURCE STREQUAL "TIP")
64+
GetTag("origin/master")
65+
else()
66+
GetTag(${FIRESTORE_DEP_SOURCE})
67+
endif()
68+
endif()
2969

30-
CONFIGURE_COMMAND ""
31-
BUILD_COMMAND ""
32-
INSTALL_COMMAND ""
33-
TEST_COMMAND ""
34-
HTTP_HEADER "${EXTERNAL_PROJECT_HTTP_HEADER}"
35-
)

cmake/external_rules.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ function(download_external_sources)
9898
-DEXTERNAL_PROJECT_HTTP_HEADER=${EXTERNAL_PROJECT_HTTP_HEADER}
9999
-DFIREBASE_CPP_BUILD_TESTS=${FIREBASE_CPP_BUILD_TESTS}
100100
-DFIREBASE_CPP_BUILD_STUB_TESTS=${FIREBASE_CPP_BUILD_STUB_TESTS}
101+
-DFIRESTORE_DEP_SOURCE=${FIRESTORE_DEP_SOURCE}
101102
${PROJECT_SOURCE_DIR}/cmake/external
102103
OUTPUT_FILE ${PROJECT_BINARY_DIR}/external/output_cmake_config.txt
103104
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/external

scripts/gha/build_desktop.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ def install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library, cleanup=True
175175

176176
def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='legacy',
177177
build_tests=True, config=None, target_format=None,
178-
use_openssl=False, disable_vcpkg=False, gha_build=False, verbose=False):
178+
use_openssl=False, disable_vcpkg=False, firestore_dep_source=None,
179+
gha_build=False, verbose=False):
179180
""" CMake configure.
180181
181182
If you are seeing problems when running this multiple times,
@@ -193,6 +194,7 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
193194
use_openssl (bool) : Use prebuilt OpenSSL library instead of using boringssl
194195
downloaded and built during the cmake configure step.
195196
disable_vcpkg (bool): If True, skip vcpkg and just use CMake for deps.
197+
firestore_dep_source (str): Where to get Firestore C++ Core source code.
196198
gha_build (bool): If True, this build will be marked as having been built
197199
from GitHub, which is useful for metrics tracking.
198200
verbose (bool): If True, enable verbose mode in the CMake file.
@@ -252,6 +254,9 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
252254
if not use_openssl:
253255
cmd.append('-DFIREBASE_USE_BORINGSSL=ON')
254256

257+
if firestore_dep_source:
258+
cmd.append('-DFIRESTORE_DEP_SOURCE={0}'.format(firestore_dep_source))
259+
255260
# When building from GitHub Actions, this should always be set.
256261
if gha_build:
257262
cmd.append('-DFIREBASE_GITHUB_ACTION_BUILD=ON')
@@ -288,7 +293,7 @@ def main():
288293
# CMake configure
289294
cmake_configure(args.build_dir, args.arch, args.msvc_runtime_library, args.linux_abi,
290295
args.build_tests, args.config, args.target_format,
291-
args.use_openssl, args.disable_vcpkg, args.gha_build, args.verbose)
296+
args.use_openssl, args.disable_vcpkg, args.firestore_dep_source, args.gha_build, args.verbose)
292297

293298
# CMake build
294299
# cmake --build build -j 8
@@ -318,6 +323,7 @@ def parse_cmdline_args():
318323
parser.add_argument('--target', nargs='+', help='A list of CMake build targets (eg: firebase_app firebase_auth)')
319324
parser.add_argument('--target_format', default=None, help='(Mac only) whether to output frameworks (default) or libraries.')
320325
parser.add_argument('--use_openssl', action='store_true', default=None, help='Use openssl for build instead of boringssl')
326+
parser.add_argument('--firestore_dep_source', default='RELEASED', help='Where to get Firestore C++ Core source code. "RELEASED"/"TIP"/(Git tag/branch/commit)')
321327
parser.add_argument('--gha_build', action='store_true', default=None, help='Set to true when building on GitHub, for metric tracking purposes (also changes some prerequisite installation behavior).')
322328
args = parser.parse_args()
323329
return args

0 commit comments

Comments
 (0)