Skip to content

Commit 067579d

Browse files
committed
Merge branch 'dev' of https://github.com/firebase/firebase-cpp-sdk into dev
2 parents a035047 + 04d4dbd commit 067579d

27 files changed

+1502
-114
lines changed

.github/workflows/android.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ jobs:
3131

3232
- name: Set env variables for subsequent steps (all)
3333
run: |
34-
echo "::set-env name=MATRIX_UNIQUE_NAME::${{ matrix.os }}-${{ matrix.architecture }}"
35-
echo "::set-env name=GHA_INSTALL_CCACHE::1"
34+
echo "MATRIX_UNIQUE_NAME=${{ matrix.os }}-${{ matrix.architecture }}" >> $GITHUB_ENV
35+
echo "GHA_INSTALL_CCACHE=1" >> $GITHUB_ENV
3636
3737
- name: Setup python
3838
uses: actions/setup-python@v2

.github/workflows/cpp-packaging.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ jobs:
229229

230230
- name: Set env variables for subsequent steps (all)
231231
run: |
232-
echo "::set-env name=VCPKG_RESPONSE_FILE::external/vcpkg_${{ matrix.vcpkg_triplet }}_response_file.txt"
233-
echo "::set-env name=MATRIX_UNIQUE_NAME::${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}"
234-
echo "::set-env name=SDK_NAME::${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.linkage }}"
232+
echo "VCPKG_RESPONSE_FILE=external/vcpkg_${{ matrix.vcpkg_triplet }}_response_file.txt" >> $GITHUB_ENV
233+
echo "MATRIX_UNIQUE_NAME=${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}" >> $GITHUB_ENV
234+
echo "SDK_NAME=${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.linkage }}" >> $GITHUB_ENV
235235
236236
- name: Add msbuild to PATH (windows)
237237
if: startsWith(matrix.os, 'windows')

.github/workflows/desktop.yml

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Desktop Builds
22

3-
on:
3+
on:
44
pull_request:
55
types: [opened, reopened, synchronize]
66

@@ -9,26 +9,34 @@ env:
99

1010
jobs:
1111
build:
12-
name: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}
12+
name: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.msvc_runtime}}
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
fail-fast: false
1616
matrix:
1717
os: [windows-latest, ubuntu-latest, macos-latest]
1818
build_type: ["Release", "Debug"]
19-
architecture: ["x64",]
19+
architecture: ["x64", "x86"]
20+
msvc_runtime: ["static", "dynamic"]
2021
python_version: [3.7]
2122
include:
2223
- os: windows-latest
23-
architecture: "x64"
24-
vcpkg_triplet: "x64-windows-static"
25-
msbuild_platform: "x64"
24+
vcpkg_triplet_suffix: "windows-static"
25+
- os: windows-latest
26+
msvc_runtime: "dynamic"
27+
vcpkg_triplet_suffix: "windows-static-md"
2628
- os: ubuntu-latest
27-
architecture: "x64"
28-
vcpkg_triplet: "x64-linux"
29+
vcpkg_triplet_suffix: "linux"
30+
- os: macos-latest
31+
vcpkg_triplet_suffix: "osx"
32+
33+
exclude:
2934
- os: macos-latest
30-
architecture: "x64"
31-
vcpkg_triplet: "x64-osx"
35+
architecture: "x86"
36+
- os: macos-latest
37+
msvc_runtime: "dynamic"
38+
- os: ubuntu-latest
39+
msvc_runtime: "dynamic"
3240

3341
steps:
3442
- uses: actions/checkout@v2
@@ -37,15 +45,15 @@ jobs:
3745

3846
- name: Set env variables for subsequent steps (all)
3947
run: |
40-
echo "::set-env name=VCPKG_RESPONSE_FILE::external/vcpkg_${{ matrix.vcpkg_triplet }}_response_file.txt"
41-
echo "::set-env name=MATRIX_UNIQUE_NAME::${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}"
48+
echo "VCPKG_RESPONSE_FILE=external/vcpkg_custom_data/response_files/${{ matrix.architecture }}-${{ matrix.vcpkg_triplet_suffix }}.txt" >> $GITHUB_ENV
49+
echo "MATRIX_UNIQUE_NAME=${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.msvc_runtime }}" >> $GITHUB_ENV
4250
4351
- name: Cache vcpkg C++ dependencies
4452
id: cache_vcpkg
4553
uses: actions/cache@v2
4654
with:
4755
path: external/vcpkg/installed
48-
key: dev-vcpkg-${{ matrix.vcpkg_triplet }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }}
56+
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') }}
4957

5058
- name: Cache ccache files
5159
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
@@ -59,15 +67,15 @@ jobs:
5967
uses: actions/setup-python@v2
6068
with:
6169
python-version: ${{ matrix.python_version }}
62-
architecture: ${{ matrix.architecture }}
70+
architecture: 'x64'
6371

6472
- name: Install prerequisites
6573
run: |
6674
python scripts/gha/install_prereqs_desktop.py
6775
6876
- name: Build SDK
6977
run: |
70-
python scripts/gha/build_desktop.py --build_tests --arch "${{ matrix.architecture }}" --config "${{ matrix.build_type }}"
78+
python scripts/gha/build_desktop.py --build_tests --arch "${{ matrix.architecture }}" --config "${{ matrix.build_type }}" --msvc_runtime_library "${{ matrix.msvc_runtime }}"
7179
7280
- name: Stats for ccache (mac and linux)
7381
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
@@ -82,23 +90,30 @@ jobs:
8290
find build -name "*.a"
8391
find build -name "*.so"
8492
93+
- name: Inspect firebase libraries for cpu arch and msvc runtime.
94+
shell: bash
95+
run: |
96+
python scripts/gha/inspect_built_libraries.py build/
97+
continue-on-error: true
98+
8599
- name: Prep crash support (linux)
86-
# Ensures directory structure is in place to capture core files on Linux.
100+
# Ensures directory structure is in place to capture core files on Linux.
87101
if: startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'ubuntu')
88102
shell: bash
89103
run: |
90104
echo '/tmp/cores/core.%E' | sudo tee /proc/sys/kernel/core_pattern
91105
sudo mkdir -p /tmp/cores/
92106
sudo rm -rf /tmp/cores/*
93-
107+
94108
- name: Prep crash support (mac)
95109
# Ensures no lingering crashes from the previous run.
96110
if: startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'macos')
97111
run: |
98112
rm -rf ~/Library/Logs/DiagnosticReports/*
99-
113+
100114
- name: Run unit tests (windows & macos)
101-
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macos')
115+
# TODO: Enable tests for x86 once they are all working
116+
if: (startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macos')) && matrix.architecture != 'x86'
102117
env:
103118
LANG: en_US
104119
run: |
@@ -110,14 +125,15 @@ jobs:
110125
# platform-specific `ulimit` to enable crash collection. The ulimit
111126
# command must be invoked in same shell instance of that runs the
112127
# tests.
113-
if: startsWith(matrix.os, 'ubuntu')
128+
# TODO: Enable tests for x86 once they are all working
129+
if: startsWith(matrix.os, 'ubuntu') && matrix.architecture != 'x86'
114130
env:
115131
LANG: en_US
116132
run: |
117-
ulimit -c unlimited
133+
ulimit -c unlimited
118134
cd build
119135
sudo ctest --verbose
120-
136+
121137
- name: Prep bins for achive (linux)
122138
# Copies all of the binary files into one directory for ease in
123139
# archiving. Directory contents are then marked readable for the
@@ -147,7 +163,7 @@ jobs:
147163
shell: bash
148164
if: failure() && startsWith(matrix.build_type, 'Debug') && startsWith(matrix.os, 'macos')
149165
run: |
150-
sudo chmod -R +rwx ~/Library/Logs/DiagnosticReports/* || :
166+
sudo chmod -R +rwx ~/Library/Logs/DiagnosticReports/* || :
151167
152168
- name: Archive crashes and binaries (linux)
153169
uses: actions/upload-artifact@v2
@@ -166,4 +182,3 @@ jobs:
166182
path: |
167183
~/Library/Logs/DiagnosticReports/*
168184
/tmp/bins/*
169-

.github/workflows/integration_tests.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,20 @@ jobs:
6666

6767
- name: Set env vars (ubuntu)
6868
if: startsWith(matrix.os, 'ubuntu')
69-
run: echo "::set-env name=VCPKG_TRIPLET::x64-linux"
69+
run: echo "VCPKG_TRIPLET=x64-linux" >> $GITHUB_ENV
7070
- name: Set env vars (macos)
7171
if: startsWith(matrix.os, 'macos')
72-
run: echo "::set-env name=VCPKG_TRIPLET::x64-osx"
72+
run: echo "VCPKG_TRIPLET=x64-osx" >> $GITHUB_ENV
7373
- name: Set env vars (windows)
7474
if: startsWith(matrix.os, 'windows')
75-
run: echo "::set-env name=VCPKG_TRIPLET::x64-windows-static"
75+
run: echo "VCPKG_TRIPLET=x64-windows-static" >> $GITHUB_ENV
7676
- name: Set env vars(all)
77-
run: echo "::set-env name=VCPKG_RESPONSE_FILE::external/vcpkg_${{ env.VCPKG_TRIPLET }}_response_file.txt"
77+
run: echo "VCPKG_RESPONSE_FILE=external/vcpkg_${{ env.VCPKG_TRIPLET }}_response_file.txt" >> $GITHUB_ENV
7878

7979
- name: Add msbuild to PATH (windows)
8080
if: startsWith(matrix.os, 'windows')
8181
uses: microsoft/[email protected]
82-
82+
8383
- name: Cache vcpkg C++ dependencies
8484
if: matrix.target_platform == 'Desktop'
8585
id: cache_vcpkg
@@ -97,7 +97,7 @@ jobs:
9797
if: matrix.target_platform == 'Desktop'
9898
run: |
9999
python scripts/gha/install_prereqs_desktop.py
100-
100+
101101
- name: Install SDK Android prerequisites
102102
if: matrix.target_platform == 'Android'
103103
shell: bash
@@ -108,27 +108,27 @@ jobs:
108108
if: matrix.target_platform == 'iOS'
109109
run: |
110110
build_scripts/ios/install_prereqs.sh
111-
111+
112112
- name: Prepare for integration tests
113113
run: |
114114
pip install -r scripts/gha/requirements.txt
115115
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
116-
116+
117117
- name: Build integration tests (and run Desktop tests)
118118
# The set up script for Android will download the NDK here.
119119
env:
120120
NDK_ROOT: '/tmp/android-ndk-r16b'
121121
run: |
122122
python scripts/gha/build_testapps.py --t ${{ github.event.inputs.apis }} --p ${{ matrix.target_platform }} --output_directory ${{ github.workspace }} --use_vcpkg --execute_desktop_testapp --noadd_timestamp
123-
123+
124124
# Workaround for https://github.com/GoogleCloudPlatform/github-actions/issues/100
125125
# Must be run after the Python setup action
126126
- name: Set CLOUDSDK_PYTHON (Windows)
127127
if: startsWith(matrix.os, 'windows') && !cancelled()
128-
run: echo "::set-env name=CLOUDSDK_PYTHON::${{env.pythonLocation}}\python.exe"
128+
run: echo "CLOUDSDK_PYTHON=${{env.pythonLocation}}\python.exe" >> $GITHUB_ENV
129129
- name: Install Cloud SDK
130130
if: ${{ !cancelled() }}
131-
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
131+
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
132132
- name: Upload Desktop Artifacts to GCS
133133
if: matrix.target_platform == 'Desktop' && !cancelled()
134134
run: |

.github/workflows/ios.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: iOS Builds
22

3-
on:
3+
on:
44
pull_request:
55
types: [opened, reopened, synchronize]
66

CMakeLists.txt

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,12 @@ project (firebase NONE)
8383
enable_language(C)
8484
enable_language(CXX)
8585

86-
set(compiler_cache_program ccache)
87-
88-
find_program(compilercache_program ${compiler_cache_program})
89-
if(compilercache_program)
90-
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${compiler_cache_program}")
91-
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${compiler_cache_program}")
92-
message( STATUS "Found compiler cache program : ${compiler_cache_program}" )
86+
if(NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER)
87+
find_program(CCACHE_PROGRAM ccache)
88+
if (CCACHE_PROGRAM)
89+
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "Compiler launcher for C")
90+
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "Compiler launcher for CXX")
91+
endif()
9392
endif()
9493

9594
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_LIST_DIR}/cmake)
@@ -122,23 +121,20 @@ set(FIREBASE_GEN_FILE_DIR ${CMAKE_BINARY_DIR}/generated)
122121
# Directory for any shared scripts.
123122
set(FIREBASE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_DIR})
124123

125-
if (MSVC AND MSVC_RUNTIME_LIBRARY_STATIC)
126-
# Use Multithreaded static runtime libraries for MSVC
127-
# if MSVC_RUNTIME_LIBRARY_STATIC is set.
128-
# Default value if nothing is specified is /MD (dll dynamic runtime).
129-
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
130-
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
131-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
132-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
133-
endif()
134-
135-
if (FIREBASE_CPP_BUILD_TESTS AND MSVC)
136-
# GoogleTest requires MSVC to compile with the static version of the runtime
137-
# library, so define the appropriate runtime flag, before adding libraries.
138-
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
139-
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
140-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
141-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
124+
if (MSVC)
125+
if (MSVC_RUNTIME_LIBRARY_STATIC)
126+
add_compile_options(
127+
$<$<CONFIG:>:/MT>
128+
$<$<CONFIG:Debug>:/MTd>
129+
$<$<CONFIG:Release>:/MT>
130+
)
131+
else()
132+
add_compile_options(
133+
$<$<CONFIG:>:/MD>
134+
$<$<CONFIG:Debug>:/MDd>
135+
$<$<CONFIG:Release>:/MD>
136+
)
137+
endif()
142138
endif()
143139

144140
# Set variables that are used by download_external_sources.

build_scripts/android/install_prereqs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ if [[ $(uname) == "Darwin" ]]; then
44
platform=darwin
55
if [[ ! -z "${GHA_INSTALL_CCACHE}" ]]; then
66
brew install ccache
7-
echo "::set-env name=CCACHE_INSTALLED::1"
7+
echo "CCACHE_INSTALLED=1" >> $GITHUB_ENV
88
fi
99
elif [[ $(uname) == "Linux" ]]; then
1010
platform=linux
1111
if [[ ! -z "${GHA_INSTALL_CCACHE}" ]]; then
1212
sudo apt install ccache
13-
echo "::set-env name=CCACHE_INSTALLED::1"
13+
echo "CCACHE_INSTALLED=1" >> $GITHUB_ENV
1414
fi
1515
else
1616
platform=windows

build_scripts/desktop/get_variant.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ os=
2929
arch=
3030
arch_win=
3131
debugmode=Release
32-
msvc_crt_linkage=MD
32+
msvc_runtime_library=MD
3333
vs=VS2015
3434
stl=c++
3535

@@ -99,16 +99,16 @@ for c in $(echo "${filename}" | tr "_.-" "\n\n\n"); do
9999
;;
100100
# Windows OS framework linkages
101101
md)
102-
msvc_crt_linkage=MD
102+
msvc_runtime_library=MD
103103
;;
104104
dynamic)
105-
msvc_crt_linkage=MD
105+
msvc_runtime_library=MD
106106
;;
107107
mt)
108-
msvc_crt_linkage=MT
108+
msvc_runtime_library=MT
109109
;;
110110
static)
111-
msvc_crt_linkage=MT
111+
msvc_runtime_library=MT
112112
;;
113113
# Debug/Release compilation mode
114114
release)
@@ -161,7 +161,7 @@ case ${os} in
161161
echo "Invalid architecture for Windows: ${arch}" 1>&2
162162
exit 1
163163
fi
164-
echo -n "${vs}/${msvc_crt_linkage}/${arch_win}/${debugmode}"
164+
echo -n "${vs}/${msvc_runtime_library}/${arch_win}/${debugmode}"
165165
;;
166166
ios)
167167
if [[ -z "${arch}" ]]; then

cmake/toolchains/linux_32.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2020 Google
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
# Toolchain file for building 32-bit Linux libraries
216

317
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")

0 commit comments

Comments
 (0)