@@ -65,8 +65,7 @@ def install_x86_support_libraries():
65
65
utils .run_command (['apt' , 'install' , 'libsecret-1-dev:i386' ], as_root = True )
66
66
67
67
68
- def install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library ,
69
- attempt_auto_fix = False ):
68
+ def _install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library ):
70
69
"""Install packages with vcpkg.
71
70
72
71
This does the following,
@@ -76,13 +75,6 @@ def install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library,
76
75
Args:
77
76
arch (str): Architecture (eg: 'x86', 'x64').
78
77
msvc_runtime_library (str): Runtime library for MSVC (eg: 'static', 'dynamic').
79
- attempt_auto_fix (bool): In case of errors, try to auto fix.
80
- Returns:
81
- (bool): True if installation was successful.
82
- False if installation wasn't successful but auto fix was attempted
83
- and we should retry the installation.
84
- Raises:
85
- (ValueError): If installation wasn't successful and auto fix wasn't attempted.
86
78
"""
87
79
88
80
# Install vcpkg executable if its not installed already
@@ -107,17 +99,36 @@ def install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library,
107
99
utils .run_command ([vcpkg_executable_file_path , 'install' ,
108
100
'@' + vcpkg_response_file_path , '--disable-metrics' ])
109
101
110
- # Some errors in vcpkg installation are not bubbled up. Verify existence
111
- # of certain important directories before proceeding.
112
- success = utils .verify_vcpkg_build (vcpkg_triplet , attempt_auto_fix )
113
- if not success :
114
- return False
102
+ def install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library , cleanup = True ):
103
+ """Install packages with vcpkg and optionally cleanup any intermediates.
104
+
105
+ This is a wrapper over a low level installation function and attempts the
106
+ installation twice, a second time after attempting to auto fix known issues.
107
+
108
+ Args:
109
+ arch (str): Architecture (eg: 'x86', 'x64').
110
+ msvc_runtime_library (str): Runtime library for MSVC (eg: 'static', 'dynamic').
111
+ cleanup (bool): Clean up intermediate files used during installation.
115
112
116
- # Clear temporary directories and files created by vcpkg buildtrees
117
- # could be several GBs and cause github runners to run out of space
118
- utils .clean_vcpkg_temp_data ()
119
- return True
113
+ Raises:
114
+ (ValueError) If installation wasn't successful.
115
+ """
116
+ _install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library )
117
+ vcpkg_triplet = utils .get_vcpkg_triplet (arch , msvc_runtime_library )
118
+ # Verify the installation with an attempt to auto fix any issues.
119
+ success = utils .verify_vcpkg_build (vcpkg_triplet , attempt_auto_fix = True )
120
+ if not success :
121
+ print ("Installation was not successful but auto fix was attempted. "
122
+ "Retrying installation..." )
123
+ # Retry once more after attempted auto fix.
124
+ _install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library )
125
+ # Check for success again. If installation failed, this call will raise a ValueError.
126
+ success = utils .verify_vcpkg_build (vcpkg_triplet , attempt_auto_fix = False )
120
127
128
+ if cleanup :
129
+ # Clear temporary directories and files created by vcpkg buildtrees
130
+ # could be several GBs and cause github runners to run out of space
131
+ utils .clean_vcpkg_temp_data ()
121
132
122
133
def cmake_configure (build_dir , arch , msvc_runtime_library = 'static' ,
123
134
build_tests = True , config = None , target_format = None ):
@@ -190,22 +201,12 @@ def main():
190
201
if args .arch == 'x86' and utils .is_linux_os ():
191
202
install_x86_support_libraries ()
192
203
193
- # Install platform dependent cpp dependencies with vcpkg
194
- # Try once with auto-fixing any errors (if any)
195
- success = install_cpp_dependencies_with_vcpkg (args .arch ,
196
- args .msvc_runtime_library ,
197
- attempt_auto_fix = True )
198
- if not success :
199
- # If auto-fix was attempted, give it one more try.
200
- # If it fails again, a ValueError will be raised and script will exit.
201
- print ("Installation was not successful but auto fix was attempted. "
202
- "Retrying installation..." )
203
- install_cpp_dependencies_with_vcpkg (args .arch ,
204
- args .msvc_runtime_library ,
205
- attempt_auto_fix = False )
204
+ # Install C++ dependencies using vcpkg
205
+ install_cpp_dependencies_with_vcpkg (args .arch , args .msvc_runtime_library ,
206
+ cleanup = True )
206
207
207
208
if args .vcpkg_step_only :
208
- print ("Exiting without building the SDK as just vcpkg step was requested." )
209
+ print ("Exiting without building the Firebase C++ SDK as just vcpkg step was requested." )
209
210
return
210
211
211
212
# CMake configure
0 commit comments