Skip to content

Commit fb49fd5

Browse files
committed
Merge remote-tracking branch 'origin/master' into ghm
2 parents 1c2017e + 8f2716f commit fb49fd5

File tree

258 files changed

+23040
-395
lines changed

Some content is hidden

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

258 files changed

+23040
-395
lines changed

Android/firebase_dependencies.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ def firebaseDependenciesMap = [
2020
'admob' : ['com.google.firebase:firebase-ads:18.3.0',
2121
'com.google.android.gms:play-services-measurement-sdk-api:17.2.1'],
2222
'analytics' : ['com.google.firebase:firebase-analytics:17.2.1'],
23-
'auth' : ['com.google.firebase:firebase-auth:19.1.0'],
23+
'auth' : ['com.google.firebase:firebase-auth:19.2.0'],
2424
'database' : ['com.google.firebase:firebase-database:19.2.0'],
2525
'dynamic_links' : ['com.google.firebase:firebase-dynamic-links:19.0.0'],
2626
'functions' : ['com.google.firebase:firebase-functions:19.0.1'],
27-
'instance_id' : ['com.google.firebase:firebase-iid:20.0.1'],
27+
'instance_id' : ['com.google.firebase:firebase-iid:20.0.2'],
2828
'invites' : ['com.google.firebase:firebase-invites:17.0.0'],
2929
// Messaging has an additional local dependency to include.
30-
'messaging' : ['com.google.firebase:firebase-messaging:20.0.1',
30+
'messaging' : ['com.google.firebase:firebase-messaging:20.1.0',
3131
'firebase_cpp_sdk.messaging:messaging_java'],
32-
'performance' : ['com.google.firebase:firebase-perf:19.0.2'],
33-
'remote_config' : ['com.google.firebase:firebase-config:19.0.3'],
32+
'performance' : ['com.google.firebase:firebase-perf:19.0.4'],
33+
'remote_config' : ['com.google.firebase:firebase-config:19.1.0'],
3434
'storage' : ['com.google.firebase:firebase-storage:19.1.0']
3535
]
3636

CMakeLists.txt

+19-13
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,20 @@ option(FIREBASE_CPP_BUILD_TESTS
4444
"Enable the Firebase C++ Build Tests." OFF)
4545
option(FIREBASE_FORCE_FAKE_SECURE_STORAGE
4646
"Disable use of platform secret store and use fake impl." OFF)
47+
option(FIREBASE_CPP_BUILD_PACKAGE
48+
"Bundle the Firebase C++ libraries into a zip file." OFF)
4749

48-
if(WIN32)
49-
# Turn on the use of the __cplusplus compiler define that is used to detect if
50-
# move operators are supported
51-
add_definitions("/Zc:__cplusplus")
52-
endif()
50+
# Define this directory to be the root of the C++ SDK, which the libraries can
51+
# then refer to.
52+
set(FIREBASE_CPP_SDK_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
53+
54+
project (firebase NONE)
55+
enable_language(C)
56+
enable_language(CXX)
5357

5458
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_LIST_DIR}/cmake)
5559
include(external_rules)
60+
include(cpp_pack)
5661

5762
if(FIREBASE_CPP_BUILD_TESTS)
5863
enable_testing()
@@ -74,10 +79,6 @@ set(FIREBASE_GEN_FILE_DIR ${CMAKE_BINARY_DIR}/generated)
7479
# Directory for any shared scripts.
7580
set(FIREBASE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_DIR})
7681

77-
project (firebase NONE)
78-
enable_language(C)
79-
enable_language(CXX)
80-
8182
if (FIREBASE_CPP_BUILD_TESTS AND MSVC)
8283
# Googletest requires MSVC to compile with the static version of the runtime
8384
# library, so define the appropriate runtime flag, before adding libraries.
@@ -94,7 +95,9 @@ set(FIREBASE_INSTALL_DIR ${PROJECT_BINARY_DIR}/opt)
9495
set(FIREBASE_DOWNLOAD_DIR ${PROJECT_BINARY_DIR}/downloads)
9596

9697
# Run the CMake build logic that will download all the external dependencies.
98+
message(STATUS "Downloading external project dependencies...")
9799
download_external_sources()
100+
message(STATUS "Download complete.")
98101

99102
# Disable the Flatbuffer build tests, install and flathash
100103
set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "")
@@ -264,10 +267,6 @@ else()
264267
set(FIREBASE_FLATBUFFERS_DEPENDENCIES "")
265268
endif()
266269

267-
# Define this directory to be the root of the C++ SDK, which the libraries can
268-
# then refer to.
269-
set(FIREBASE_CPP_SDK_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
270-
271270
include(binary_to_array)
272271
include(firebase_cpp_gradle)
273272

@@ -311,3 +310,10 @@ endif()
311310
if (FIREBASE_INCLUDE_STORAGE)
312311
add_subdirectory(storage)
313312
endif()
313+
314+
# Place the CMake and gradle build files provided to easily link against the
315+
# prebuilt libraries at the root of the package.
316+
cpp_pack_dir(
317+
"${CMAKE_CURRENT_LIST_DIR}/release_build_files/"
318+
.
319+
)

admob/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,6 @@ elseif(IOS)
120120
# accomplish that.
121121
symlink_pod_headers(firebase_admob Google-Mobile-Ads-SDK GoogleMobileAds)
122122
endif()
123+
124+
cpp_pack_library(firebase_admob "")
125+
cpp_pack_public_headers()

admob/src/android/banner_view_internal_android.cc

+1
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ BoundingBox BannerViewInternalAndroid::GetBoundingBox() const {
188188
// x-coordinate, and y-coordinate.
189189
int count = static_cast<int>(env->GetArrayLength(jni_int_array));
190190
assert(count == 4);
191+
(void)count;
191192

192193
jint* bounding_box_elements =
193194
env->GetIntArrayElements(jni_int_array, nullptr);

admob/src/android/native_express_ad_view_internal_android.cc

+1
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ BoundingBox NativeExpressAdViewInternalAndroid::GetBoundingBox() const {
198198
// x-coordinate, and y-coordinate.
199199
int count = static_cast<int>(env->GetArrayLength(jni_int_array));
200200
assert(count == 4);
201+
(void)count;
201202

202203
jint* bounding_box_elements =
203204
env->GetIntArrayElements(jni_int_array, nullptr);

analytics/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,6 @@ if(FIREBASE_CPP_BUILD_TESTS)
133133
# Add the tests subdirectory
134134
add_subdirectory(tests)
135135
endif()
136+
137+
cpp_pack_library(firebase_analytics "")
138+
cpp_pack_public_headers()

app/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -365,3 +365,9 @@ if(FIREBASE_CPP_BUILD_TESTS)
365365
# Add the tests subdirectory
366366
add_subdirectory(tests)
367367
endif()
368+
369+
cpp_pack_library(firebase_app "")
370+
cpp_pack_public_headers()
371+
if (NOT ANDROID AND NOT IOS)
372+
cpp_pack_library(flatbuffers "deps/app/external")
373+
endif()

app/instance_id/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,5 @@ target_compile_definitions(firebase_instance_id_desktop_impl
5858
PRIVATE
5959
-DINTERNAL_EXPERIMENTAL=1
6060
)
61+
62+
cpp_pack_library(firebase_instance_id_desktop_impl "deps/app")

app/rest/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,9 @@ if(FIREBASE_CPP_BUILD_TESTS)
126126
# Add the tests subdirectory
127127
add_subdirectory(tests)
128128
endif()
129+
130+
cpp_pack_library(firebase_rest_lib "deps/app")
131+
cpp_pack_library(libcurl "deps/app/external")
132+
cpp_pack_library(zlibstatic "deps/app/external")
133+
cpp_pack_library_file(${OPENSSL_SSL_LIBRARY} "deps/app/external")
134+
cpp_pack_library_file(${OPENSSL_CRYPTO_LIBRARY} "deps/app/external")

app/src/include/firebase/app.h

-34
Original file line numberDiff line numberDiff line change
@@ -54,40 +54,6 @@ class FunctionRegistry;
5454
namespace internal {
5555
class AppInternal;
5656
} // namespace internal
57-
namespace auth {
58-
class Auth;
59-
} // namespace auth
60-
namespace crashlytics {
61-
namespace internal {
62-
class CrashlyticsInternal;
63-
} // namespace internal
64-
} // namespace crashlytics
65-
namespace database {
66-
namespace internal {
67-
class DatabaseInternal;
68-
} // namespace internal
69-
} // namespace database
70-
#ifdef INTERNAL_EXPERIMENTAL
71-
namespace firestore {
72-
class FirestoreInternal;
73-
} // namespace firestore
74-
#endif // INTERNAL_EXPERIMENTAL
75-
namespace functions {
76-
namespace internal {
77-
class FunctionsInternal;
78-
} // namespace internal
79-
} // namespace functions
80-
namespace internal {
81-
class InstanceId;
82-
} // namespace internal
83-
namespace instance_id {
84-
class InstanceId;
85-
} // namespace instance_id
86-
namespace storage {
87-
namespace internal {
88-
class StorageInternal;
89-
} // namespace internal
90-
} // namespace storage
9157

9258
/// @brief Reports whether a Firebase module initialized successfully.
9359
enum InitResult {

app/src/secure/user_secure_linux_internal.cc

+17-19
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ SecretSchema BuildSchema(const char key_namespace[]) {
4747

4848
UserSecureLinuxInternal::UserSecureLinuxInternal(const char* domain,
4949
const char* key_namespace)
50-
: domain_(domain), key_namespace_(key_namespace) {
50+
: domain_(domain), key_namespace_(key_namespace), known_error_code_(0) {
5151
storage_schema_ = BuildSchema(key_namespace_.c_str());
5252
}
5353

@@ -68,14 +68,8 @@ std::string UserSecureLinuxInternal::LoadUserData(const std::string& app_name) {
6868
/* key1= */ kAppNameKey,
6969
/* value1= */ app_name.c_str(), /* key2= */ kStorageDomainKey,
7070
/* value2= */ domain_.c_str(), nullptr);
71-
if (error) {
72-
g_error_free(error);
73-
LogWarning("Secret lookup failed, please make sure libsecret is "
74-
"installed.");
75-
return empty_str;
76-
}
7771

78-
if (result == nullptr) {
72+
if (CheckForError(&error, "lookup") || result == nullptr) {
7973
return empty_str;
8074
}
8175
std::string str_result(result);
@@ -97,10 +91,7 @@ void UserSecureLinuxInternal::SaveUserData(const std::string& app_name,
9791
/* value1= */ app_name.c_str(),
9892
/* key2= */ kStorageDomainKey, /* value2= */ domain_.c_str(), nullptr);
9993

100-
if (error) {
101-
g_error_free(error);
102-
LogWarning("Secret store failed, please make sure libsecret is installed.");
103-
}
94+
CheckForError(&error, "store");
10495
}
10596

10697
void UserSecureLinuxInternal::DeleteUserData(const std::string& app_name) {
@@ -115,10 +106,7 @@ void UserSecureLinuxInternal::DeleteUserData(const std::string& app_name) {
115106
/* key2= */ kStorageDomainKey,
116107
/* value2= */ domain_.c_str(), nullptr);
117108

118-
if (error) {
119-
g_error_free(error);
120-
LogWarning("Secret clear failed, please make sure libsecret is installed.");
121-
}
109+
CheckForError(&error, "clear");
122110
}
123111

124112
void UserSecureLinuxInternal::DeleteAllData() {
@@ -130,10 +118,20 @@ void UserSecureLinuxInternal::DeleteAllData() {
130118
/* error= */ &error,
131119
/* key2= */ kStorageDomainKey,
132120
/* value2= */ domain_.c_str(), nullptr);
133-
if (error) {
134-
g_error_free(error);
135-
LogWarning("Secret clear failed, please make sure libsecret is installed.");
121+
CheckForError(&error, "clear");
122+
}
123+
124+
bool UserSecureLinuxInternal::CheckForError(GError** error,
125+
const char* function_name) {
126+
if (error == nullptr || *error == nullptr) return false;
127+
if ((*error)->code != known_error_code_) {
128+
LogWarning("Secret %s failed. Error %d: %s", function_name, (*error)->code,
129+
(*error)->message);
130+
known_error_code_ = (*error)->code;
136131
}
132+
g_error_free(*error);
133+
*error = nullptr;
134+
return true;
137135
}
138136

139137
} // namespace secure

app/src/secure/user_secure_linux_internal.h

+6
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,15 @@ class UserSecureLinuxInternal : public UserSecureInternal {
4545
void DeleteAllData() override;
4646

4747
private:
48+
// Check if there is an error, log it and free it if there is.
49+
// Returns true iff there was an error.
50+
bool CheckForError(GError** error, const char* function_name);
51+
4852
const std::string domain_;
4953
const std::string key_namespace_;
5054
SecretSchema storage_schema_;
55+
int known_error_code_; // If nonzero, this error was already logged, so
56+
// don't be too spammy about it.
5157
};
5258

5359
} // namespace secure

auth/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,6 @@ if(FIREBASE_CPP_BUILD_TESTS)
209209
# Add the tests subdirectory
210210
add_subdirectory(tests)
211211
endif()
212+
213+
cpp_pack_library(firebase_auth "")
214+
cpp_pack_public_headers()

auth/auth_resources/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ android {
4646

4747
dependencies {
4848
implementation 'com.google.firebase:firebase-analytics:17.2.1'
49-
implementation 'com.google.firebase:firebase-auth:19.1.0'
49+
implementation 'com.google.firebase:firebase-auth:19.2.0'
5050
implementation project(':app:app_resources')
5151
}
5252

auth/samples/src/doc_samples.cc

+20
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ struct MyProgramContext {
4444
JNIEnv* my_jni_env = nullptr;
4545
jobject my_activity = nullptr;
4646
#endif // defined(__ANDROID__)
47+
const char* apple_id_token = nullptr;
48+
const char* raw_nonce = nullptr;
4749
const char* email = nullptr;
4850
const char* password = nullptr;
4951
const char* google_id_token = nullptr;
@@ -74,6 +76,14 @@ firebase::auth::Auth* AuthFromApp(firebase::App* app) {
7476
}
7577

7678
void VariousCredentials(firebase::auth::Auth* auth) {
79+
{
80+
// [START auth_credential_apple]
81+
firebase::auth::Credential credential =
82+
firebase::auth::OAuthProvider::GetCredential(
83+
"apple.com", apple_id_token, raw_nonce, nullptr);
84+
// [END auth_credential_apple]
85+
(void)credential;
86+
}
7787
{
7888
// [START auth_credential_email]
7989
firebase::auth::Credential credential =
@@ -113,6 +123,16 @@ void VariousSignIns(firebase::auth::Auth* auth) {
113123
// [END auth_create_user]
114124
(void)result;
115125
}
126+
{
127+
// [START auth_sign_in_apple]
128+
firebase::auth::Credential credential =
129+
firebase::auth::OAuthProvider::GetCredential(
130+
"apple.com", apple_id_token, raw_nonce, nullptr);
131+
firebase::Future<firebase::auth::User*> result =
132+
auth->SignInWithCredential(credential);
133+
// [END auth_sign_in_apple]
134+
(void)result;
135+
}
116136
{
117137
// [START auth_sign_in_email]
118138
firebase::Future<firebase::auth::User*> result =

0 commit comments

Comments
 (0)