Skip to content

Commit 7f5a572

Browse files
jonsimantovwu-hui
andauthored
Update to C++14. (#1250)
* Update CXX_STANDARD to 14. * Add CMAKE_CXX_STANDARD_REQUIRED setting. * Update C++ version in testapps. * Upgrade to grpc 150 and C++ 14 for firestore (#1182) * Upgrade to grpc 150 and C++ 14 for firestore * Add firestore_dep_source to workflow * Use C++14 make_unique * Ensure CXX14 * Formatting * CXX required in test * C++14 for xcode project * Ensures lineendings on windows so we can apply patch files * Fix build error * Add readme note about c++14. * Remove C++ version warning header. --------- Co-authored-by: wu-hui <[email protected]>
1 parent 4318a1d commit 7f5a572

File tree

52 files changed

+90
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+90
-141
lines changed

.github/workflows/integration_tests.yml

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ on:
3939
description: 'Optional: Packaging run # to build against?'
4040
test_pull_request:
4141
description: 'Optional: Pull request # to build and test? (With optional commit hash, separated by a colon. Specify the FULL hash.)'
42+
firestore_dep_source:
43+
description: 'Optional: Where to get firestore iOS SDK from: "RELEASED", "TIP" or "<git-commit> from firestore-ios-sdk"'
4244

4345
env:
4446
triggerLabelPrefix: "tests-requested: "
@@ -330,6 +332,8 @@ jobs:
330332
if [[ "${{ github.event.schedule }}" == "0 11 * * *" ]]; then
331333
# at 3am PST/4am PDT. Running firestore desktop integration test aginst tip-of-tree ios repo
332334
additional_flags+=(--cmake_flag=-DFIRESTORE_DEP_SOURCE=TIP)
335+
elif [[ "${{ github.event.inputs.firestore_dep_source }}" ]]; then
336+
additional_flags+=(--cmake_flag=-DFIRESTORE_DEP_SOURCE=${{ github.event.inputs.firestore_dep_source }})
333337
fi
334338
python scripts/gha/build_testapps.py --p Desktop \
335339
--t ${{ needs.check_and_prepare.outputs.apis }} \

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
cmake_minimum_required (VERSION 3.1)
1818

19-
set (CMAKE_CXX_STANDARD 11)
19+
set (CMAKE_CXX_STANDARD 14)
20+
set (CMAKE_CXX_STANDARD_REQUIRED YES) # Don't fall back to an earlier version.
2021

2122
# Turn on virtual folders for visual studio
2223
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

admob/integration_test/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ set(FIREBASE_INTEGRATION_TEST_SRCS
8484
# The include directory for the testapp.
8585
include_directories(src)
8686

87-
# Integration test uses some features that require C++ 11, such as lambdas.
88-
set (CMAKE_CXX_STANDARD 11)
87+
# Firebase C++ SDK requires C++14.
88+
set (CMAKE_CXX_STANDARD 14)
89+
set (CMAKE_CXX_STANDARD_REQUIRED YES) # Don't fall back to an earlier version.
8990

9091
# Download and unpack googletest (and googlemock) at configure time
9192
set(GOOGLETEST_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/googletest)

admob/src/include/firebase/admob.h

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "firebase/admob/rewarded_video.h"
2929
#include "firebase/admob/types.h"
3030
#include "firebase/app.h"
31-
#include "firebase/cpp_version_warning.h"
3231
#include "firebase/internal/common.h"
3332

3433
#if !defined(DOXYGEN) && !defined(SWIG)

analytics/integration_test/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ set(FIREBASE_INTEGRATION_TEST_SRCS
8484
# The include directory for the testapp.
8585
include_directories(src)
8686

87-
# Integration test uses some features that require C++ 11, such as lambdas.
88-
set (CMAKE_CXX_STANDARD 11)
87+
# Firebase C++ SDK requires C++14.
88+
set (CMAKE_CXX_STANDARD 14)
89+
set (CMAKE_CXX_STANDARD_REQUIRED YES) # Don't fall back to an earlier version.
8990

9091
# Download and unpack googletest (and googlemock) at configure time
9192
set(GOOGLETEST_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/googletest)

analytics/src/include/firebase/analytics.h

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <string>
2424

2525
#include "firebase/app.h"
26-
#include "firebase/cpp_version_warning.h"
2726
#include "firebase/future.h"
2827
#include "firebase/internal/common.h"
2928
#include "firebase/variant.h"

app/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ endif()
251251

252252
set(internal_HDRS
253253
src/include/firebase/app.h
254-
src/include/firebase/cpp_version_warning.h
255254
src/include/firebase/future.h
256255
src/include/firebase/internal/common.h
257256
src/include/firebase/internal/future_impl.h

app/integration_test/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ set(FIREBASE_INTEGRATION_TEST_SRCS
8484
# The include directory for the testapp.
8585
include_directories(src)
8686

87-
# Integration test uses some features that require C++ 11, such as lambdas.
88-
set (CMAKE_CXX_STANDARD 11)
87+
# Firebase C++ SDK requires C++14.
88+
set (CMAKE_CXX_STANDARD 14)
89+
set (CMAKE_CXX_STANDARD_REQUIRED YES) # Don't fall back to an earlier version.
8990

9091
# Download and unpack googletest (and googlemock) at configure time
9192
set(GOOGLETEST_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/googletest)

app/rest/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
# CMake file for the firebase_rest_lib library
1616

1717
cmake_minimum_required (VERSION 3.1)
18-
set (CMAKE_CXX_STANDARD 11)
18+
# Firebase C++ SDK requires C++14.
19+
set (CMAKE_CXX_STANDARD 14)
20+
set (CMAKE_CXX_STANDARD_REQUIRED YES) # Don't fall back to an earlier version.
1921

2022
project(firebase_rest_lib NONE)
2123
enable_language(C)

app/src/include/firebase/app.h

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#ifndef FIREBASE_APP_SRC_INCLUDE_FIREBASE_APP_H_
1818
#define FIREBASE_APP_SRC_INCLUDE_FIREBASE_APP_H_
1919

20-
#include "cpp_version_warning.h"
2120
#include "firebase/internal/platform.h"
2221

2322
#if FIREBASE_PLATFORM_ANDROID

app/src/include/firebase/cpp_version_warning.h

-21
This file was deleted.

app_check/integration_test/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ set(FIREBASE_INTEGRATION_TEST_SRCS
8484
# The include directory for the testapp.
8585
include_directories(src)
8686

87-
# Integration test uses some features that require C++ 11, such as lambdas.
88-
set (CMAKE_CXX_STANDARD 11)
87+
# Firebase C++ SDK requires C++14.
88+
set (CMAKE_CXX_STANDARD 14)
89+
set (CMAKE_CXX_STANDARD_REQUIRED YES) # Don't fall back to an earlier version.
8990

9091
# Download and unpack googletest (and googlemock) at configure time
9192
set(GOOGLETEST_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/googletest)

app_check/src/include/firebase/app_check.h

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <string>
1919

2020
#include "firebase/app.h"
21-
#include "firebase/cpp_version_warning.h"
2221
#include "firebase/future.h"
2322

2423
namespace firebase {

auth/integration_test/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ set(FIREBASE_INTEGRATION_TEST_SRCS
8484
# The include directory for the testapp.
8585
include_directories(src)
8686

87-
# Integration test uses some features that require C++ 11, such as lambdas.
88-
set (CMAKE_CXX_STANDARD 11)
87+
# Firebase C++ SDK requires C++14.
88+
set (CMAKE_CXX_STANDARD 14)
89+
set (CMAKE_CXX_STANDARD_REQUIRED YES) # Don't fall back to an earlier version.
8990

9091
# Download and unpack googletest (and googlemock) at configure time
9192
set(GOOGLETEST_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/googletest)

auth/src/include/firebase/auth.h

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
#include "firebase/app.h"
2323
#include "firebase/auth/user.h"
24-
#include "firebase/cpp_version_warning.h"
2524
#include "firebase/future.h"
2625
#include "firebase/internal/common.h"
2726

cmake/external/firestore.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function(GetTag t)
4949
DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR}
5050
GIT_REPOSITORY "https://github.com/firebase/firebase-ios-sdk.git"
5151
GIT_TAG ${t}
52+
GIT_CONFIG "core.autocrlf=input"
5253
GIT_SHALLOW "ON"
5354

5455
PREFIX ${PROJECT_BINARY_DIR}

database/integration_test/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ set(FIREBASE_INTEGRATION_TEST_SRCS
8484
# The include directory for the testapp.
8585
include_directories(src)
8686

87-
# Integration test uses some features that require C++ 11, such as lambdas.
88-
set (CMAKE_CXX_STANDARD 11)
87+
# Firebase C++ SDK requires C++14.
88+
set (CMAKE_CXX_STANDARD 14)
89+
set (CMAKE_CXX_STANDARD_REQUIRED YES) # Don't fall back to an earlier version.
8990

9091
# Download and unpack googletest (and googlemock) at configure time
9192
set(GOOGLETEST_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/googletest)

database/src/include/firebase/database.h

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#define FIREBASE_DATABASE_SRC_INCLUDE_FIREBASE_DATABASE_H_
1717

1818
#include "firebase/app.h"
19-
#include "firebase/cpp_version_warning.h"
2019
#include "firebase/database/common.h"
2120
#include "firebase/database/data_snapshot.h"
2221
#include "firebase/database/database_reference.h"

dynamic_links/integration_test/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ set(FIREBASE_INTEGRATION_TEST_SRCS
8484
# The include directory for the testapp.
8585
include_directories(src)
8686

87-
# Integration test uses some features that require C++ 11, such as lambdas.
88-
set (CMAKE_CXX_STANDARD 11)
87+
# Firebase C++ SDK requires C++14.
88+
set (CMAKE_CXX_STANDARD 14)
89+
set (CMAKE_CXX_STANDARD_REQUIRED YES) # Don't fall back to an earlier version.
8990

9091
# Download and unpack googletest (and googlemock) at configure time
9192
set(GOOGLETEST_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/googletest)

dynamic_links/src/include/firebase/dynamic_links.h

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <string>
1919

2020
#include "firebase/app.h"
21-
#include "firebase/cpp_version_warning.h"
2221
#include "firebase/internal/common.h"
2322

2423
#if !defined(DOXYGEN) && !defined(SWIG)

firestore/integration_test/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ set(FIREBASE_INTEGRATION_TEST_SRCS
8484
# The include directory for the testapp.
8585
include_directories(src)
8686

87-
# Integration test uses some features that require C++ 11, such as lambdas.
88-
set (CMAKE_CXX_STANDARD 11)
87+
# Firebase C++ SDK requires C++14.
88+
set (CMAKE_CXX_STANDARD 14)
89+
set (CMAKE_CXX_STANDARD_REQUIRED YES) # Don't fall back to an earlier version.
8990

9091
# Download and unpack googletest (and googlemock) at configure time
9192
set(GOOGLETEST_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/googletest)

firestore/integration_test_internal/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,9 @@ include_directories(${ABSEIL_CPP_ROOT})
232232
# Allow testing internal Firebase APIs.
233233
add_definitions(-DINTERNAL_EXPERIMENTAL)
234234

235-
# Integration test uses some features that require C++ 11, such as lambdas.
236-
set (CMAKE_CXX_STANDARD 11)
235+
# Firebase C++ SDK requires C++14.
236+
set (CMAKE_CXX_STANDARD 14)
237+
set (CMAKE_CXX_STANDARD_REQUIRED YES) # Don't fall back to an earlier version.
237238

238239
# Download and unpack googletest (and googlemock) at configure time
239240
set(GOOGLETEST_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/googletest)

firestore/integration_test_internal/integration_test.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@
680680
isa = XCBuildConfiguration;
681681
buildSettings = {
682682
ALWAYS_SEARCH_USER_PATHS = NO;
683-
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
683+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
684684
CLANG_CXX_LIBRARY = "libc++";
685685
CLANG_ENABLE_MODULES = YES;
686686
CLANG_ENABLE_OBJC_ARC = YES;
@@ -723,7 +723,7 @@
723723
isa = XCBuildConfiguration;
724724
buildSettings = {
725725
ALWAYS_SEARCH_USER_PATHS = NO;
726-
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
726+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
727727
CLANG_CXX_LIBRARY = "libc++";
728728
CLANG_ENABLE_MODULES = YES;
729729
CLANG_ENABLE_OBJC_ARC = YES;

firestore/integration_test_internal/src/android/promise_android_test.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "firestore/src/android/exception_android.h"
3232
#include "firestore/src/android/firestore_android.h"
3333
#include "firestore/src/android/promise_factory_android.h"
34-
#include "firestore/src/common/make_unique.h"
3534
#include "firestore/src/include/firebase/firestore.h"
3635
#include "firestore/src/jni/env.h"
3736
#include "firestore/src/jni/integer.h"
@@ -210,7 +209,7 @@ class TestCompletion : public TestCompletionBase<PublicType, InternalType> {
210209
if (result == nullptr) {
211210
result_.reset(nullptr);
212211
} else {
213-
result_ = make_unique<PublicType>(*result);
212+
result_ = std::make_unique<PublicType>(*result);
214213
}
215214
}
216215

firestore/integration_test_internal/src/jni/env_test.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "app/meta/move.h"
2323
#include "firestore/src/android/exception_android.h"
2424
#include "firestore/src/common/macros.h"
25-
#include "firestore/src/common/make_unique.h"
2625
#include "firestore/src/jni/array.h"
2726
#include "firestore_integration_test.h"
2827
#include "gtest/gtest.h"
@@ -33,7 +32,7 @@ namespace jni {
3332

3433
class EnvTest : public FirestoreIntegrationTest {
3534
public:
36-
EnvTest() : env_(make_unique<Env>(GetEnv())) {}
35+
EnvTest() : env_(std::make_unique<Env>(GetEnv())) {}
3736

3837
~EnvTest() override {
3938
// Ensure that after the test is done that any pending exception is cleared

firestore/integration_test_internal/src/util/integration_test_util.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
*/
1616

1717
#include <chrono> // NOLINT(build/c++11)
18+
#include <memory>
1819
#include <thread> // NOLINT(build/c++11)
1920

20-
#include "absl/memory/memory.h"
2121
#include "app_framework.h"
2222
#include "firebase/app.h"
2323
#include "firebase/firestore.h"
@@ -37,8 +37,8 @@ struct TestFriend {
3737
static FirestoreInternal* CreateTestFirestoreInternal(App* app) {
3838
#if !defined(__ANDROID__)
3939
return new FirestoreInternal(
40-
app, absl::make_unique<credentials::EmptyAuthCredentialsProvider>(),
41-
absl::make_unique<credentials::EmptyAppCheckCredentialsProvider>());
40+
app, std::make_unique<credentials::EmptyAuthCredentialsProvider>(),
41+
std::make_unique<credentials::EmptyAppCheckCredentialsProvider>());
4242
#else
4343
return new FirestoreInternal(app);
4444
#endif // !defined(__ANDROID__)

firestore/src/android/firestore_android.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
#include "firestore/src/android/wrapper.h"
6161
#include "firestore/src/android/write_batch_android.h"
6262
#include "firestore/src/common/hard_assert_common.h"
63-
#include "firestore/src/common/make_unique.h"
6463
#include "firestore/src/include/firebase/firestore.h"
6564
#include "firestore/src/jni/array.h"
6665
#include "firestore/src/jni/array_list.h"
@@ -285,7 +284,7 @@ FirestoreInternal::FirestoreInternal(App* app) {
285284
FIREBASE_ASSERT(java_user_callback_executor.get() != nullptr);
286285
user_callback_executor_ = java_user_callback_executor;
287286

288-
promises_ = make_unique<PromiseFactory<AsyncFn>>(this);
287+
promises_ = std::make_unique<PromiseFactory<AsyncFn>>(this);
289288
}
290289

291290
/* static */

firestore/src/android/promise_android.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "firestore/src/android/exception_android.h"
2929
#include "firestore/src/android/firestore_android.h"
3030
#include "firestore/src/android/query_snapshot_android.h"
31-
#include "firestore/src/common/make_unique.h"
3231
#include "firestore/src/jni/env.h"
3332
#include "firestore/src/jni/object.h"
3433
#include "firestore/src/jni/task.h"
@@ -98,7 +97,7 @@ class Promise {
9897
ReferenceCountedFutureImpl* impl,
9998
Completion* completion)
10099
: firestore_ref_(firestore_ref),
101-
completer_(make_unique<Completer<PublicType, InternalType>>(
100+
completer_(std::make_unique<Completer<PublicType, InternalType>>(
102101
firestore_ref, impl, completion)),
103102
impl_(impl) {}
104103

firestore/src/common/make_unique.h

-37
This file was deleted.

0 commit comments

Comments
 (0)