69
69
import datetime
70
70
from distutils import dir_util
71
71
import os
72
- import pathlib
73
72
import platform
74
73
import shutil
75
74
import subprocess
75
+ import sys
76
76
77
77
from absl import app
78
78
from absl import flags
81
81
import attr
82
82
83
83
from integration_testing import config_reader
84
- from integration_testing import provisioning
85
84
from integration_testing import xcodebuild
85
+ import utils
86
86
87
87
# Environment variables
88
88
_JAVA_HOME = "JAVA_HOME"
@@ -195,14 +195,18 @@ def main(argv):
195
195
196
196
if update_pod_repo and _IOS in platforms :
197
197
_run (["pod" , "repo" , "update" ])
198
-
198
+
199
199
config = config_reader .read_config ()
200
200
cmake_flags = _get_desktop_compiler_flags (FLAGS .compiler , config .compilers )
201
201
if _DESKTOP in platforms and FLAGS .use_vcpkg :
202
- _run (["git" , "submodule" , "update" , "--init" ])
203
- vcpkg = Vcpkg .generate (os .path .join (sdk_dir , config .vcpkg_dir ))
204
- vcpkg .install_and_run ()
205
- cmake_flags .extend (vcpkg .cmake_flags )
202
+ installer = os .path .join (sdk_dir , "scripts" , "gha" , "build_desktop.py" )
203
+ _run ([sys .executable , installer , "--vcpkg_step_only" ])
204
+ toolchain_file = os .path .join (
205
+ sdk_dir , "external" , "vcpkg" , "scripts" , "buildsystems" , "vcpkg.cmake" )
206
+ cmake_flags .extend ((
207
+ "-DCMAKE_TOOLCHAIN_FILE=%s" % toolchain_file ,
208
+ "-DVCPKG_TARGET_TRIPLET=%s" % utils .get_vcpkg_triplet (arch = "x64" )
209
+ ))
206
210
207
211
failures = []
208
212
for testapp in testapps :
@@ -226,7 +230,7 @@ def main(argv):
226
230
227
231
228
232
def _build (
229
- testapp , platforms , api_config , output_dir , sdk_dir , ios_framework_exist ,
233
+ testapp , platforms , api_config , output_dir , sdk_dir , ios_framework_exist ,
230
234
timestamp , root_dir , ios_sdk , cmake_flags , execute_desktop_testapp ):
231
235
"""Builds one testapp on each of the specified platforms."""
232
236
testapp_dir = os .path .join (root_dir , api_config .testapp_path )
@@ -382,7 +386,7 @@ def _validate_android_environment_variables():
382
386
"Neither %s nor %s is set" , _ANDROID_SDK_HOME , _ANDROID_HOME )
383
387
384
388
385
- # If sdk_dir contains no framework, consider it is Github repo, then
389
+ # If sdk_dir contains no framework, consider it is Github repo, then
386
390
# generate makefiles for ios frameworks
387
391
def _generate_makefiles_from_repo (sdk_dir ):
388
392
ios_framework_builder = os .path .join (
@@ -401,14 +405,14 @@ def _generate_makefiles_from_repo(sdk_dir):
401
405
def _build_ios_framework_from_repo (sdk_dir , api_config ):
402
406
ios_framework_builder = os .path .join (
403
407
sdk_dir , "build_scripts" , "ios" , "build.sh" )
404
-
408
+
405
409
# build only required targets to save time
406
410
target = set ()
407
411
for framework in api_config .frameworks :
408
412
target .add (os .path .splitext (framework )[0 ])
409
413
# firebase is not a target in CMake, firebase_app is the target
410
- # firebase_app will be built by other target as well
411
- target .remove ("firebase" )
414
+ # firebase_app will be built by other target as well
415
+ target .remove ("firebase" )
412
416
413
417
framework_builder_args = [
414
418
ios_framework_builder ,
@@ -444,7 +448,7 @@ def _build_ios(
444
448
app_podfile_path = os .path .join (
445
449
project_dir , "Podfile" )
446
450
podfile_patcher_args = [
447
- "python" , podfile_tool_path ,
451
+ sys . executable , podfile_tool_path ,
448
452
"--sdk_podfile" , sdk_podfile_path ,
449
453
"--app_podfile" , app_podfile_path
450
454
]
@@ -496,7 +500,7 @@ def _run_setup_script(root_dir, testapp_dir):
496
500
"""Runs the setup_integration_tests.py script if needed."""
497
501
script_path = os .path .join (root_dir , "setup_integration_tests.py" )
498
502
if os .path .isfile (script_path ):
499
- _run (["python" , script_path , testapp_dir ])
503
+ _run ([sys . executable , script_path , testapp_dir ])
500
504
else :
501
505
logging .info ("setup_integration_tests.py not found" )
502
506
@@ -529,55 +533,6 @@ def _fix_path(path):
529
533
return os .path .abspath (os .path .expanduser (path ))
530
534
531
535
532
- @attr .s (frozen = True , eq = False )
533
- class Vcpkg (object ):
534
- """Holds data related to the vcpkg tool used for managing dependent tools."""
535
- installer = attr .ib ()
536
- binary = attr .ib ()
537
- triplet = attr .ib ()
538
- response_file = attr .ib ()
539
- toolchain_file = attr .ib ()
540
-
541
- @classmethod
542
- def generate (cls , vcpkg_dir ):
543
- """Generates the vcpkg data based on the given vcpkg submodule path."""
544
- installer = os .path .join (vcpkg_dir , "bootstrap-vcpkg" )
545
- binary = os .path .join (vcpkg_dir , "vcpkg" )
546
- response_file_fmt = vcpkg_dir + "_%s_response_file.txt"
547
- if platform .system () == "Windows" :
548
- triplet = "x64-windows-static"
549
- installer += ".bat"
550
- binary += ".exe"
551
- elif platform .system () == "Darwin" :
552
- triplet = "x64-osx"
553
- installer += ".sh"
554
- elif platform .system () == "Linux" :
555
- triplet = "x64-linux"
556
- installer += ".sh"
557
- else :
558
- raise ValueError ("Unrecognized system: %s" % platform .system ())
559
- return cls (
560
- installer = installer ,
561
- binary = binary ,
562
- triplet = triplet ,
563
- response_file = response_file_fmt % triplet ,
564
- toolchain_file = os .path .join (
565
- vcpkg_dir , "scripts" , "buildsystems" , "vcpkg.cmake" ))
566
-
567
- def install_and_run (self ):
568
- """Installs vcpkg (if needed) and runs it to install dependencies."""
569
- if not os .path .exists (self .binary ):
570
- _run ([self .installer ])
571
- _run ([
572
- self .binary , "install" , "@" + self .response_file , "--disable-metrics" ])
573
-
574
- @property
575
- def cmake_flags (self ):
576
- return [
577
- "-DCMAKE_TOOLCHAIN_FILE=%s" % self .toolchain_file ,
578
- "-DVCPKG_TARGET_TRIPLET=%s" % self .triplet ]
579
-
580
-
581
536
@attr .s (frozen = True , eq = False )
582
537
class Failure (object ):
583
538
"""Holds context for the failure of a testapp to build/run."""
0 commit comments