Skip to content

Commit c08a435

Browse files
committed
Merge branch 'dev' into feature/js-save-package-hash
2 parents cf715d0 + 5f32e93 commit c08a435

File tree

6 files changed

+74
-61
lines changed

6 files changed

+74
-61
lines changed

.github/workflows/android.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
submodules: true
3131

3232
- name: Set env variables for subsequent steps (all)
33+
shell: bash
3334
run: |
3435
echo "MATRIX_UNIQUE_NAME=${{ matrix.os }}-${{ matrix.architecture }}" >> $GITHUB_ENV
3536
echo "GHA_INSTALL_CCACHE=1" >> $GITHUB_ENV
@@ -42,7 +43,7 @@ jobs:
4243

4344
- name: Add msbuild to PATH
4445
if: startsWith(matrix.os, 'windows')
45-
uses: microsoft/[email protected].1
46+
uses: microsoft/[email protected].2
4647

4748
- name: Install prerequisites
4849
shell: bash

.github/workflows/cpp-packaging.yml

Lines changed: 37 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ on:
1414

1515
env:
1616
# Packaging prerequisites
17-
# Binutils 2.34 released Feb 1, 2020
18-
binutilsVer: 2.34
17+
# Binutils 2.35.1 released Sep 19, 2020
18+
binutilsVer: 2.35.1
1919
# Demumble 1.1.0 released Nov 13, 2018
2020
demumbleVer: 1.1.0
2121
# Use SHA256 for hashing files.
@@ -197,67 +197,47 @@ jobs:
197197
path: firebase-cpp-sdk-android-${{ matrix.stl }}-package.tgz
198198

199199
build_desktop:
200-
name: build-${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.linkage }}
200+
name: build-${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.msvc_runtime }}
201201
runs-on: ${{ matrix.os }}
202202
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
203203
strategy:
204204
fail-fast: false
205205
matrix:
206206
os: [windows-latest, ubuntu-latest, macos-latest]
207-
architecture: ["x86", "x64"]
208-
build_type: ["Debug", "Release"]
209-
linkage: ["dynamic", "static"]
207+
build_type: ["Release", "Debug"]
208+
architecture: ["x64", "x86"]
209+
msvc_runtime: ["static", "dynamic"]
210210
python_version: [3.7]
211211
include:
212212
- os: windows-latest
213-
linkage: "static"
214-
architecture: "x64"
215-
vcpkg_triplet: "x64-windows-static"
216-
sdk_platform: windows
213+
vcpkg_triplet_suffix: "windows-static"
217214
additional_build_flags: "--build_tests"
215+
sdk_platform: "windows"
218216
- os: windows-latest
219-
linkage: "dynamic"
220-
architecture: "x64"
221-
vcpkg_triplet: "x64-windows"
222-
sdk_platform: windows
223-
additional_build_flags: "--build_tests"
224-
- os: windows-latest
225-
linkage: "static"
226-
architecture: "x86"
227-
vcpkg_triplet: "x86-windows-static"
228-
sdk_platform: windows
229-
additional_build_flags: "--build_tests"
230-
- os: windows-latest
231-
linkage: "dynamic"
232-
architecture: "x86"
233-
vcpkg_triplet: "x86-windows"
234-
sdk_platform: windows
217+
msvc_runtime: "dynamic"
218+
vcpkg_triplet_suffix: "windows-static-md"
235219
additional_build_flags: "--build_tests"
220+
sdk_platform: "windows"
236221
- os: ubuntu-latest
237-
architecture: "x86"
238-
vcpkg_triplet: "x86-linux-dynamic" # special case
239-
sdk_platform: linux
240-
additional_build_flags: ""
241-
- os: ubuntu-latest
242-
architecture: "x64"
243-
vcpkg_triplet: "x64-linux"
244-
sdk_platform: linux
222+
vcpkg_triplet_suffix: "linux"
245223
additional_build_flags: ""
224+
sdk_platform: "linux"
246225
- os: macos-latest
247-
vcpkg_triplet: "x64-osx"
248-
sdk_platform: darwin
226+
vcpkg_triplet_suffix: "osx"
249227
additional_build_flags: "--target_format libraries"
228+
sdk_platform: "darwin"
229+
250230
exclude:
251231
- os: macos-latest
252232
architecture: "x86"
253233
- os: macos-latest
254-
build_type: "Debug"
234+
msvc_runtime: "dynamic"
255235
- os: macos-latest
256-
linkage: "dynamic"
257-
- os: ubuntu-latest
258236
build_type: "Debug"
259237
- os: ubuntu-latest
260-
linkage: "dynamic"
238+
msvc_runtime: "dynamic"
239+
- os: ubuntu-latest
240+
build_type: "Debug"
261241

262242
steps:
263243
- uses: actions/checkout@v2
@@ -270,18 +250,18 @@ jobs:
270250
run: |
271251
echo "VCPKG_RESPONSE_FILE=external/vcpkg_${{ matrix.vcpkg_triplet }}_response_file.txt" >> $GITHUB_ENV
272252
echo "MATRIX_UNIQUE_NAME=${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}" >> $GITHUB_ENV
273-
echo "SDK_NAME=${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.linkage }}" >> $GITHUB_ENV
253+
echo "SDK_NAME=${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.msvc_runtime }}" >> $GITHUB_ENV
274254
275255
- name: Add msbuild to PATH (windows)
276256
if: startsWith(matrix.os, 'windows')
277-
uses: microsoft/[email protected].1
257+
uses: microsoft/[email protected].2
278258

279259
- name: Cache vcpkg C++ dependencies
280260
id: cache_vcpkg
281261
uses: actions/cache@v2
282262
with:
283263
path: external/vcpkg/installed
284-
key: dev-vcpkg-${{ matrix.vcpkg_triplet }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }}
264+
key: dev-vcpkg-${{ matrix.architecture }}-${{ matrix.vcpkg_triplet_suffix }}-${{ matrix.msvc_runtime }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }}
285265

286266
- name: Cache ccache files
287267
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
@@ -303,21 +283,27 @@ jobs:
303283
- name: Build desktop SDK
304284
shell: bash
305285
run: |
306-
python scripts/gha/build_desktop.py --arch "${{ matrix.architecture }}" --config "${{ matrix.build_type }}" --build_dir firebase-cpp-sdk-${{ env.SDK_NAME }}-build ${{ matrix.additional_build_flags }}
286+
python scripts/gha/build_desktop.py --arch "${{ matrix.architecture }}" --config "${{ matrix.build_type }}" --msvc_runtime_library "${{ matrix.msvc_runtime }}" --build_dir out-${{ env.SDK_NAME }} ${{ matrix.additional_build_flags }}
307287
# Make a list of all the source files, for debugging purposes.
308-
cd firebase-cpp-sdk-${{ env.SDK_NAME }}-build
288+
cd out-${{ env.SDK_NAME }}
309289
find .. -type f -print > src_file_list.txt
310290
tar -czhf ../firebase-cpp-sdk-${{ env.SDK_NAME }}-build.tgz .
311291
312292
- name: Print built libraries
313293
shell: bash
314294
run: |
315-
find firebase-cpp-sdk-*-build -name "*.lib"
316-
find firebase-cpp-sdk-*-build -name "*.dll"
317-
find firebase-cpp-sdk-*-build -name "*.dylib"
318-
find firebase-cpp-sdk-*-build -name "*.a"
319-
find firebase-cpp-sdk-*-build -name "*.so"
320-
find firebase-cpp-sdk-*-build -name "*.framework"
295+
find out-* -name "*.lib"
296+
find out-* -name "*.dll"
297+
find out-* -name "*.dylib"
298+
find out-* -name "*.a"
299+
find out-* -name "*.so"
300+
find out-* -name "*.framework"
301+
302+
- name: Inspect firebase libraries for cpu arch and msvc runtime.
303+
shell: bash
304+
run: |
305+
python scripts/gha/inspect_built_libraries.py out-${{ env.SDK_NAME }}/
306+
continue-on-error: true
321307

322308
- name: upload artifacts
323309
uses: actions/upload-artifact@v2

.github/workflows/desktop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
vcpkg_triplet_suffix: "windows-static"
2525
- os: windows-latest
2626
msvc_runtime: "dynamic"
27+
2728
vcpkg_triplet_suffix: "windows-static-md"
2829
- os: ubuntu-latest
2930
vcpkg_triplet_suffix: "linux"
@@ -44,6 +45,7 @@ jobs:
4445
submodules: true
4546

4647
- name: Set env variables for subsequent steps (all)
48+
shell: bash
4749
run: |
4850
echo "VCPKG_RESPONSE_FILE=external/vcpkg_custom_data/response_files/${{ matrix.architecture }}-${{ matrix.vcpkg_triplet_suffix }}.txt" >> $GITHUB_ENV
4951
echo "MATRIX_UNIQUE_NAME=${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.msvc_runtime }}" >> $GITHUB_ENV

.github/workflows/integration_tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,16 @@ jobs:
7171
if: startsWith(matrix.os, 'macos')
7272
run: echo "VCPKG_TRIPLET=x64-osx" >> $GITHUB_ENV
7373
- name: Set env vars (windows)
74+
shell: bash
7475
if: startsWith(matrix.os, 'windows')
7576
run: echo "VCPKG_TRIPLET=x64-windows-static" >> $GITHUB_ENV
7677
- name: Set env vars(all)
78+
shell: bash
7779
run: echo "VCPKG_RESPONSE_FILE=external/vcpkg_${{ env.VCPKG_TRIPLET }}_response_file.txt" >> $GITHUB_ENV
7880

7981
- name: Add msbuild to PATH (windows)
8082
if: startsWith(matrix.os, 'windows')
81-
uses: microsoft/[email protected].1
83+
uses: microsoft/[email protected].2
8284

8385
- name: Cache vcpkg C++ dependencies
8486
if: matrix.target_platform == 'Desktop'

scripts/gha/build_desktop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def main():
205205
# Copy libraries from appropriate vcpkg directory to build output
206206
# directory for later inclusion.
207207
vcpkg_path = ('external/vcpkg/installed/%s/%slib/' %
208-
(utils.get_vcpkg_triplet(args.arch),
208+
(utils.get_vcpkg_triplet(args.arch, args.msvc_runtime_library),
209209
'debug/' if args.config == 'Debug' else ''))
210210
if (os.path.exists(vcpkg_path)):
211211
shutil.rmtree('vcpkg-libs', ignore_errors=True)

scripts/merge_libraries.py

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,18 @@ def add_automatic_namespaces(symbols):
475475
# "windows": ["__imp_"]
476476
}
477477

478+
# If a binutils tool returns a "file format is ambiguous" error,
479+
# prefer matching formats that begin with the given prefix (depending
480+
# on the platform). It will select the first format that starts with the
481+
# given prefix. (A blank prefix just means use the first format no
482+
# matter what.)
483+
BINUTILS_PREFERRED_FORMAT_PREFIX_IF_AMBIGUOUS = {
484+
"windows": "pe-",
485+
"linux": "",
486+
"android": "",
487+
"darwin": "",
488+
"ios": "",
489+
}
478490

479491
def read_symbols_from_archive(archive_file):
480492
"""Read the symbols defined in a library archive.
@@ -755,19 +767,29 @@ def run_binutils_command(cmdline, error_output=None, ignore_errors=False):
755767
# Line 0: filename.o: File format is ambiguous
756768
# Line 1: Matching formats: format1 format2 [...]
757769
#
758-
# If this occurs, we will run the command again, passing in --target=format1
759-
# (except on Windows where we know we want fmt2.)
770+
# If this occurs, we will run the command again, passing in the
771+
# target format that we believe we should use instead.
760772
elif (len(error_output) >= 2 and
761773
"ile format is ambiguous" in error_output[0]):
762-
m = re.search("Matching formats: (?P<fmt>[^ ]+) (?P<fmt2>[^ ]+)",
763-
error_output[1])
774+
m = re.search("Matching formats: (.+)", error_output[1])
764775
if m:
765-
fmt = m.group("fmt" if FLAGS.platform != "windows" else "fmt2")
776+
all_formats = m.group(1).split(" ")
777+
preferred_formats = [
778+
fmt
779+
for fmt
780+
in all_formats
781+
if fmt.startswith(
782+
BINUTILS_PREFERRED_FORMAT_PREFIX_IF_AMBIGUOUS[FLAGS.platform])
783+
]
784+
# Or if for some reason none was found, just take the default (first).
785+
retry_format = (preferred_formats[0]
786+
if len(preferred_formats) > 0
787+
else all_formats[0])
766788
error_output = []
767789
logging.debug("Ambiguous file format when running %s %s",
768790
os.path.basename(cmdline[0]), " ".join(cmdline[1:]))
769-
logging.debug("Retrying with --target=%s", fmt)
770-
output = run_command([cmdline[0]] + ["--target=%s" % fmt] + cmdline[1:],
791+
logging.debug("Retrying with --target=%s", retry_format)
792+
output = run_command([cmdline[0]] + ["--target=%s" % retry_format] + cmdline[1:],
771793
error_output, ignore_errors)
772794
if error_output and not ignore_errors:
773795
# If we failed any other way, or if the second run failed, bail.

0 commit comments

Comments
 (0)