25
25
--t (full name: testapps, default: None)
26
26
--p (full name: platforms, default: None)
27
27
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
+
28
34
Under most circumstances the other flags don't need to be set, but can be
29
35
seen by running --help. Note that all path flags will forcefully expand
30
36
the user ~.
31
37
38
+
32
39
DEPENDENCIES:
33
40
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.
36
43
Path specified by the flag:
37
44
38
- --sdk_dir (default: current working directory)
45
+ --repo_dir (default: current working directory)
39
46
40
47
----Python Dependencies----
41
48
The requirements.txt file has the required dependencies for this Python tool.
107
114
FLAGS = flags .FLAGS
108
115
109
116
flags .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." )
111
119
112
120
flags .DEFINE_string (
113
121
"output_directory" , "~" ,
114
122
"Build output will be placed in this directory." )
115
123
116
124
flags .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." )
122
127
123
128
flags .DEFINE_list (
124
129
"testapps" , None , "Which testapps (Firebase APIs) to build, e.g."
152
157
" Check the config file to see valid choices for this flag."
153
158
" If none, will invoke cmake without specifying a compiler." )
154
159
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
-
162
160
flags .DEFINE_multi_string (
163
161
"cmake_flag" , None ,
164
162
"Pass an additional flag to the CMake configure step."
@@ -178,9 +176,9 @@ def main(argv):
178
176
platforms = FLAGS .platforms
179
177
testapps = FLAGS .testapps
180
178
181
- sdk_dir = _fix_path (FLAGS .sdk_dir )
179
+ sdk_dir = _fix_path (FLAGS .packaged_sdk or FLAGS . repo_dir )
182
180
output_dir = _fix_path (FLAGS .output_directory )
183
- root_dir = _fix_path (FLAGS .root_dir )
181
+ repo_dir = _fix_path (FLAGS .repo_dir )
184
182
185
183
update_pod_repo = FLAGS .update_pod_repo
186
184
if FLAGS .add_timestamp :
@@ -199,11 +197,14 @@ def main(argv):
199
197
200
198
config = config_reader .read_config ()
201
199
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" )
204
205
_run ([sys .executable , installer , "--vcpkg_step_only" ])
205
206
toolchain_file = os .path .join (
206
- sdk_dir , "external" , "vcpkg" , "scripts" , "buildsystems" , "vcpkg.cmake" )
207
+ repo_dir , "external" , "vcpkg" , "scripts" , "buildsystems" , "vcpkg.cmake" )
207
208
cmake_flags .extend ((
208
209
"-DCMAKE_TOOLCHAIN_FILE=%s" % toolchain_file ,
209
210
"-DVCPKG_TARGET_TRIPLET=%s" % utils .get_vcpkg_triplet (arch = "x64" )
@@ -222,7 +223,7 @@ def main(argv):
222
223
output_dir = output_dir ,
223
224
sdk_dir = sdk_dir ,
224
225
ios_framework_exist = ios_framework_exist ,
225
- root_dir = root_dir ,
226
+ repo_dir = repo_dir ,
226
227
ios_sdk = FLAGS .ios_sdk ,
227
228
cmake_flags = cmake_flags )
228
229
logging .info ("END building for %s" , testapp )
@@ -233,9 +234,9 @@ def main(argv):
233
234
234
235
def _build (
235
236
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 ):
237
238
"""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 )
239
240
project_dir = os .path .join (
240
241
output_dir , api_config .full_name , os .path .basename (testapp_dir ))
241
242
@@ -246,8 +247,8 @@ def _build(
246
247
logging .info ("Changing directory to %s" , project_dir )
247
248
os .chdir (project_dir )
248
249
249
- _run_setup_script (root_dir , project_dir )
250
-
250
+ _run_setup_script (repo_dir , project_dir )
251
+
251
252
failures = []
252
253
253
254
if _DESKTOP in platforms :
@@ -279,7 +280,7 @@ def _build(
279
280
sdk_dir = sdk_dir ,
280
281
ios_framework_exist = ios_framework_exist ,
281
282
project_dir = project_dir ,
282
- root_dir = root_dir ,
283
+ repo_dir = repo_dir ,
283
284
api_config = api_config ,
284
285
ios_sdk = ios_sdk )
285
286
except subprocess .SubprocessError as e :
@@ -426,7 +427,7 @@ def _build_ios_framework_from_repo(sdk_dir, api_config):
426
427
427
428
428
429
def _build_ios (
429
- sdk_dir , ios_framework_exist , project_dir , root_dir , api_config , ios_sdk ):
430
+ sdk_dir , ios_framework_exist , project_dir , repo_dir , api_config , ios_sdk ):
430
431
"""Builds an iOS application (.app, .ipa or both)."""
431
432
if not ios_framework_exist :
432
433
_build_ios_framework_from_repo (sdk_dir , api_config )
@@ -444,10 +445,10 @@ def _build_ios(
444
445
framework_paths .append (framework_dest_path )
445
446
446
447
podfile_tool_path = os .path .join (
447
- root_dir , "scripts" , "gha" , "integration_testing" , "update_podfile.py" )
448
+ repo_dir , "scripts" , "gha" , "integration_testing" , "update_podfile.py" )
448
449
podfile_patcher_args = [
449
450
sys .executable , podfile_tool_path ,
450
- "--sdk_podfile" , os .path .join (root_dir , "ios_pod" , "Podfile" ),
451
+ "--sdk_podfile" , os .path .join (repo_dir , "ios_pod" , "Podfile" ),
451
452
"--app_podfile" , os .path .join (project_dir , "Podfile" )
452
453
]
453
454
_run (podfile_patcher_args )
@@ -456,7 +457,7 @@ def _build_ios(
456
457
entitlements_path = os .path .join (
457
458
project_dir , api_config .ios_target + ".entitlements" )
458
459
xcode_tool_path = os .path .join (
459
- root_dir , "scripts" , "gha" , "integration_testing" , "xcode_tool.rb" )
460
+ repo_dir , "scripts" , "gha" , "integration_testing" , "xcode_tool.rb" )
460
461
xcode_patcher_args = [
461
462
"ruby" , xcode_tool_path ,
462
463
"--XCodeCPP.xcodeProjectDir" , project_dir ,
0 commit comments