Skip to content

Commit 1349ace

Browse files
authored
Merge pull request #255 from firebase/bugfix/integration-tests-mac-openssl-error
Bugfix/integration tests mac openssl error
2 parents 08f1456 + 31e40b2 commit 1349ace

File tree

10 files changed

+73
-10
lines changed

10 files changed

+73
-10
lines changed

.github/workflows/integration_tests.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,20 @@ jobs:
135135
run: |
136136
choco install openssl -r
137137
138+
- name: Install OpenSSL (MacOS)
139+
if: matrix.target_platform == 'Desktop' &&
140+
matrix.ssl_variant == 'openssl' &&
141+
startsWith(matrix.os, 'macos')
142+
run: |
143+
brew install openssl
144+
145+
- name: Install OpenSSL (Linux)
146+
if: matrix.target_platform == 'Desktop' &&
147+
matrix.ssl_variant == 'openssl' &&
148+
startsWith(matrix.os, 'ubuntu')
149+
run: |
150+
sudo apt install openssl
151+
138152
- name: Build integration tests
139153
shell: bash
140154
run: |

external/vcpkg

Submodule vcpkg updated 3753 files
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openssl
2+
protobuf
3+
zlib
4+
--triplet
5+
x64-linux
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openssl
2+
protobuf
3+
zlib
4+
--triplet
5+
x64-osx
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openssl
2+
protobuf
3+
zlib
4+
--triplet
5+
x64-windows-static-md
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openssl
2+
protobuf
3+
zlib
4+
--triplet
5+
x64-windows-static
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openssl
2+
protobuf
3+
zlib
4+
--triplet
5+
x86-linux
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openssl
2+
protobuf
3+
zlib
4+
--triplet
5+
x86-windows-static-md
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
openssl
2+
protobuf
3+
zlib
4+
--triplet
5+
x86-windows-static

scripts/gha/build_desktop.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def install_x86_support_libraries():
7575
utils.run_command(['apt', 'install', '-y'] + packages, as_root=True)
7676

7777

78-
def _install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library):
78+
def _install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library, use_openssl=False):
7979
"""Install packages with vcpkg.
8080
8181
This does the following,
@@ -85,6 +85,7 @@ def _install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library):
8585
Args:
8686
arch (str): Architecture (eg: 'x86', 'x64').
8787
msvc_runtime_library (str): Runtime library for MSVC (eg: 'static', 'dynamic').
88+
use_openssl (bool): Use OpenSSL based vcpkg response files.
8889
"""
8990

9091
# Install vcpkg executable if its not installed already
@@ -101,15 +102,21 @@ def _install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library):
101102
# for each desktop platform, there exists a vcpkg response file in the repo
102103
# (external/vcpkg_<triplet>_response_file.txt) defined for each target triplet
103104
vcpkg_triplet = utils.get_vcpkg_triplet(arch, msvc_runtime_library)
104-
vcpkg_response_file_path = os.path.join(os.getcwd(), 'external', 'vcpkg_custom_data',
105-
'response_files', '{0}.txt'.format(vcpkg_triplet))
105+
vcpkg_response_files_dir_path = os.path.join(os.getcwd(), 'external', 'vcpkg_custom_data',
106+
'response_files')
107+
if use_openssl:
108+
vcpkg_response_files_dir_path = os.path.join(vcpkg_response_files_dir_path, 'openssl')
109+
110+
vcpkg_response_file_path = os.path.join(vcpkg_response_files_dir_path,
111+
'{0}.txt'.format(vcpkg_triplet))
106112

107113
# Eg: ./external/vcpkg/vcpkg install @external/vcpkg_x64-osx_response_file.txt
108114
# --disable-metrics
109115
utils.run_command([vcpkg_executable_file_path, 'install',
110116
'@' + vcpkg_response_file_path, '--disable-metrics'])
111117

112-
def install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library, cleanup=True):
118+
def install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library, cleanup=True,
119+
use_openssl=False):
113120
"""Install packages with vcpkg and optionally cleanup any intermediates.
114121
115122
This is a wrapper over a low level installation function and attempts the
@@ -119,11 +126,12 @@ def install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library, cleanup=True
119126
arch (str): Architecture (eg: 'x86', 'x64').
120127
msvc_runtime_library (str): Runtime library for MSVC (eg: 'static', 'dynamic').
121128
cleanup (bool): Clean up intermediate files used during installation.
129+
use_openssl (bool): Use OpenSSL based vcpkg response files.
122130
123131
Raises:
124132
(ValueError) If installation wasn't successful.
125133
"""
126-
_install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library)
134+
_install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library, use_openssl)
127135
vcpkg_triplet = utils.get_vcpkg_triplet(arch, msvc_runtime_library)
128136
# Verify the installation with an attempt to auto fix any issues.
129137
success = utils.verify_vcpkg_build(vcpkg_triplet, attempt_auto_fix=True)
@@ -142,7 +150,7 @@ def install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library, cleanup=True
142150

143151
def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='legacy',
144152
build_tests=True, config=None, target_format=None,
145-
disable_vcpkg=False, verbose=False):
153+
use_openssl=False, disable_vcpkg=False, verbose=False):
146154
""" CMake configure.
147155
148156
If you are seeing problems when running this multiple times,
@@ -157,6 +165,8 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
157165
config (str): Release/Debug config.
158166
If its not specified, cmake's default is used (most likely Debug).
159167
target_format (str): If specified, build for this targetformat ('frameworks' or 'libraries').
168+
use_openssl (bool) : Use prebuilt OpenSSL library instead of using boringssl
169+
downloaded and built during the cmake configure step.
160170
disable_vcpkg (bool): If True, skip vcpkg and just use CMake for deps.
161171
verbose (bool): If True, enable verbose mode in the CMake file.
162172
"""
@@ -203,7 +213,8 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
203213
if (target_format):
204214
cmd.append('-DFIREBASE_XCODE_TARGET_FORMAT={0}'.format(target_format))
205215

206-
cmd.append('-DFIREBASE_USE_BORINGSSL=ON')
216+
if not use_openssl:
217+
cmd.append('-DFIREBASE_USE_BORINGSSL=ON')
207218

208219
# Print out every command while building.
209220
if verbose:
@@ -224,18 +235,20 @@ def main():
224235
if args.arch == 'x86' and utils.is_linux_os():
225236
install_x86_support_libraries()
226237

238+
# Install C++ dependencies using vcpkg
227239
if not args.disable_vcpkg:
228240
# Install C++ dependencies using vcpkg
229241
install_cpp_dependencies_with_vcpkg(args.arch, args.msvc_runtime_library,
230-
cleanup=True)
242+
cleanup=True, use_openssl=args.use_openssl)
231243

232244
if args.vcpkg_step_only:
233245
print("Exiting without building the Firebase C++ SDK as just vcpkg step was requested.")
234246
return
235247

236248
# CMake configure
237249
cmake_configure(args.build_dir, args.arch, args.msvc_runtime_library, args.linux_abi,
238-
args.build_tests, args.config, args.target_format, args.disable_vcpkg, args.verbose)
250+
args.build_tests, args.config, args.target_format,
251+
args.use_openssl, args.disable_vcpkg, args.verbose)
239252

240253
# CMake build
241254
# cmake --build build -j 8
@@ -264,6 +277,7 @@ def parse_cmdline_args():
264277
parser.add_argument('--config', default='Release', help='Release/Debug config')
265278
parser.add_argument('--target', nargs='+', help='A list of CMake build targets (eg: firebase_app firebase_auth)')
266279
parser.add_argument('--target_format', default=None, help='(Mac only) whether to output frameworks (default) or libraries.')
280+
parser.add_argument('--use_openssl', action='store_true', default=None, help='Use openssl for build instead of boringssl')
267281
args = parser.parse_args()
268282
return args
269283

0 commit comments

Comments
 (0)