2525--t (full name: testapps, default: None)
2626--p (full name: platforms, default: None)
2727
28+ By default, this tool will build integration tests from source, which involves
29+ building the underlying SDK libraries. To build from a packaged/released SDK,
30+ supply the path to the SDK to --packaged_sdk:
31+
32+ python build_testapps.py --t auth --p iOS --packaged_sdk ~/firebase_cpp_sdk
33+
2834Under most circumstances the other flags don't need to be set, but can be
2935seen by running --help. Note that all path flags will forcefully expand
3036the user ~.
3137
38+
3239DEPENDENCIES:
3340
34- ----Firebase SDK ----
35- The Firebase SDK (prebuilt) or repo must be locally present.
41+ ----Firebase Repo ----
42+ The Firebase C++ SDK repo must be locally present.
3643Path specified by the flag:
3744
38- --sdk_dir (default: current working directory)
45+ --repo_dir (default: current working directory)
3946
4047----Python Dependencies----
4148The requirements.txt file has the required dependencies for this Python tool.
107114FLAGS = flags .FLAGS
108115
109116flags .DEFINE_string (
110- "sdk_dir" , os .getcwd (), "Unzipped Firebase C++ sdk OR Github repo." )
117+ "packaged_sdk" , None , "(Optional) Firebase SDK directory. If not"
118+ " supplied, will build from source." )
111119
112120flags .DEFINE_string (
113121 "output_directory" , "~" ,
114122 "Build output will be placed in this directory." )
115123
116124flags .DEFINE_string (
117- "root_dir" , os .getcwd (),
118- "Directory with which to join the relative paths in the config."
119- " Used to find e.g. the integration test projects. If using the SDK repo"
120- " this will be the same as the sdk dir, but not if using prebuilts."
121- " Defaults to the current directory." )
125+ "repo_dir" , os .getcwd (),
126+ "Firebase C++ SDK Git repository. Current directory by default." )
122127
123128flags .DEFINE_list (
124129 "testapps" , None , "Which testapps (Firebase APIs) to build, e.g."
152157 " Check the config file to see valid choices for this flag."
153158 " If none, will invoke cmake without specifying a compiler." )
154159
155- flags .DEFINE_bool (
156- "use_vcpkg" , False ,
157- "(Desktop only) Use the vcpkg repo inside the C++ repo. For"
158- " this to work, sdk_dir must be set to the repo, not the prebuilt SDK."
159- " Will install vcpkg, use it to install dependencies, and then configure"
160- " CMake to use it." )
161-
162160flags .DEFINE_multi_string (
163161 "cmake_flag" , None ,
164162 "Pass an additional flag to the CMake configure step."
@@ -178,9 +176,9 @@ def main(argv):
178176 platforms = FLAGS .platforms
179177 testapps = FLAGS .testapps
180178
181- sdk_dir = _fix_path (FLAGS .sdk_dir )
179+ sdk_dir = _fix_path (FLAGS .packaged_sdk or FLAGS . repo_dir )
182180 output_dir = _fix_path (FLAGS .output_directory )
183- root_dir = _fix_path (FLAGS .root_dir )
181+ repo_dir = _fix_path (FLAGS .repo_dir )
184182
185183 update_pod_repo = FLAGS .update_pod_repo
186184 if FLAGS .add_timestamp :
@@ -199,11 +197,14 @@ def main(argv):
199197
200198 config = config_reader .read_config ()
201199 cmake_flags = _get_desktop_compiler_flags (FLAGS .compiler , config .compilers )
202- if _DESKTOP in platforms and FLAGS .use_vcpkg :
203- installer = os .path .join (sdk_dir , "scripts" , "gha" , "build_desktop.py" )
200+ # VCPKG is used to install dependencies for the desktop SDK.
201+ # Building from source requires building the underlying SDK libraries,
202+ # so we need to use VCPKG as well.
203+ if _DESKTOP in platforms and not FLAGS .packaged_sdk :
204+ installer = os .path .join (repo_dir , "scripts" , "gha" , "build_desktop.py" )
204205 _run ([sys .executable , installer , "--vcpkg_step_only" ])
205206 toolchain_file = os .path .join (
206- sdk_dir , "external" , "vcpkg" , "scripts" , "buildsystems" , "vcpkg.cmake" )
207+ repo_dir , "external" , "vcpkg" , "scripts" , "buildsystems" , "vcpkg.cmake" )
207208 cmake_flags .extend ((
208209 "-DCMAKE_TOOLCHAIN_FILE=%s" % toolchain_file ,
209210 "-DVCPKG_TARGET_TRIPLET=%s" % utils .get_vcpkg_triplet (arch = "x64" )
@@ -222,7 +223,7 @@ def main(argv):
222223 output_dir = output_dir ,
223224 sdk_dir = sdk_dir ,
224225 ios_framework_exist = ios_framework_exist ,
225- root_dir = root_dir ,
226+ repo_dir = repo_dir ,
226227 ios_sdk = FLAGS .ios_sdk ,
227228 cmake_flags = cmake_flags )
228229 logging .info ("END building for %s" , testapp )
@@ -233,9 +234,9 @@ def main(argv):
233234
234235def _build (
235236 testapp , platforms , api_config , output_dir , sdk_dir , ios_framework_exist ,
236- root_dir , ios_sdk , cmake_flags ):
237+ repo_dir , ios_sdk , cmake_flags ):
237238 """Builds one testapp on each of the specified platforms."""
238- testapp_dir = os .path .join (root_dir , api_config .testapp_path )
239+ testapp_dir = os .path .join (repo_dir , api_config .testapp_path )
239240 project_dir = os .path .join (
240241 output_dir , api_config .full_name , os .path .basename (testapp_dir ))
241242
@@ -246,8 +247,8 @@ def _build(
246247 logging .info ("Changing directory to %s" , project_dir )
247248 os .chdir (project_dir )
248249
249- _run_setup_script (root_dir , project_dir )
250-
250+ _run_setup_script (repo_dir , project_dir )
251+
251252 failures = []
252253
253254 if _DESKTOP in platforms :
@@ -279,7 +280,7 @@ def _build(
279280 sdk_dir = sdk_dir ,
280281 ios_framework_exist = ios_framework_exist ,
281282 project_dir = project_dir ,
282- root_dir = root_dir ,
283+ repo_dir = repo_dir ,
283284 api_config = api_config ,
284285 ios_sdk = ios_sdk )
285286 except subprocess .SubprocessError as e :
@@ -422,7 +423,7 @@ def _build_ios_framework_from_repo(sdk_dir, api_config):
422423
423424
424425def _build_ios (
425- sdk_dir , ios_framework_exist , project_dir , root_dir , api_config , ios_sdk ):
426+ sdk_dir , ios_framework_exist , project_dir , repo_dir , api_config , ios_sdk ):
426427 """Builds an iOS application (.app, .ipa or both)."""
427428 if not ios_framework_exist :
428429 _build_ios_framework_from_repo (sdk_dir , api_config )
@@ -440,10 +441,10 @@ def _build_ios(
440441 framework_paths .append (framework_dest_path )
441442
442443 podfile_tool_path = os .path .join (
443- root_dir , "scripts" , "gha" , "integration_testing" , "update_podfile.py" )
444+ repo_dir , "scripts" , "gha" , "integration_testing" , "update_podfile.py" )
444445 podfile_patcher_args = [
445446 sys .executable , podfile_tool_path ,
446- "--sdk_podfile" , os .path .join (root_dir , "ios_pod" , "Podfile" ),
447+ "--sdk_podfile" , os .path .join (repo_dir , "ios_pod" , "Podfile" ),
447448 "--app_podfile" , os .path .join (project_dir , "Podfile" )
448449 ]
449450 _run (podfile_patcher_args )
@@ -452,7 +453,7 @@ def _build_ios(
452453 entitlements_path = os .path .join (
453454 project_dir , api_config .ios_target + ".entitlements" )
454455 xcode_tool_path = os .path .join (
455- root_dir , "scripts" , "gha" , "integration_testing" , "xcode_tool.rb" )
456+ repo_dir , "scripts" , "gha" , "integration_testing" , "xcode_tool.rb" )
456457 xcode_patcher_args = [
457458 "ruby" , xcode_tool_path ,
458459 "--XCodeCPP.xcodeProjectDir" , project_dir ,
0 commit comments