Skip to content

Commit

Permalink
Automatic merge of main into feature_branch/ump-sdk - Aug 07, 2023 (#…
Browse files Browse the repository at this point in the history
…1419)

* iOS: Remove Analytics dependency from GMA integration test (#1386)

* Try using CoreOnly instead of Analytics cocoapod for tests.

* Update readme.

* Add stub workflow for updating feature branches.

* Add script to merge main into all active feature branches on a regular schedule. (#1394)

* Add workflow for automatically updating feature branches weekly.

* Corrected filename, and added inputs.

* Remove trailing spaces.

* Fix workflow.

* Fix workflow name.

* Fix syntax.

* Fix syntax.

* List remote branches instead.

* Clean up script.

* Untab.

* Add branch list for debugging.

* Untab.

* Specify remote branches.

* Skip second stage if no first.

* Typo

* Error.

* List all branches.

* Fix logic.

* Fix spacing.

* Fix output

* Fix parameters.

* Fix merge to use origin.

* Remove debug echos.

* Add git config.

* Fix PR creation.

* Fix PR creation.

* Fix automatic push.

* Increase retry. (#1402)

* Add Firestore test history report (#1403)

* Add --firestore flag to report Firestore history.

* Add Firestore report to nightly cron job.

* Remove multiline commands.

* Revert "Remove multiline commands."

This reverts commit 6393ae9.

* Fix tabbing.

* Fix packaging test detection for Firestore.

* Revert "OR Query Implementation (#1335)" (#1399)

This reverts commit 11332d4.

* Wrap the real-time RemoteConfig test in flaky-block to automatically retry. (#1406)

* Only use flaky_test on android

* Update the iOS version used by FTL (#1408)

* Kick off nightly packaging an hour earlier (#1409)

* Fix crash on gma::Initialize without a Firebase App (#1320)

Initialize Util before using Util::FIndClass. Also add an integration test for initializing gma without a firebase app.

* build: pass along the CMake path (#1410)

When building the subproject, we would invoke `cmake` directly, relying on the path lookup of the tool, which may or may not match the currently executing CMake.  Use `CMAKE_COMMAND` which gives us the path to the current CMake executable ensuring that we use the same CMake for building the dependencies.

* Add log to gsutil fetch. (#1411)

* Update mobile dependencies - Thu Aug 03 2023 (#1413)

* Update mobile dependencies - Thu Aug 03 2023

### Android

- com.google.firebase.firebase_bom → 32.2.2

### iOS

- Firebase/Analytics → 10.13.0
- Firebase/AppCheck → 10.13.0
- Firebase/Auth → 10.13.0
- Firebase/Core → 10.13.0
- Firebase/CoreOnly → 10.13.0
- Firebase/Crashlytics → 10.13.0
- Firebase/Database → 10.13.0
- Firebase/DynamicLinks → 10.13.0
- Firebase/Firestore → 10.13.0
- Firebase/Functions → 10.13.0
- Firebase/Installations → 10.13.0
- Firebase/Messaging → 10.13.0
- Firebase/RemoteConfig → 10.13.0
- Firebase/Storage → 10.13.0
- Google-Mobile-Ads-SDK → 10.9.0

> Created by [Update Android and iOS dependencies workflow](https://github.com/firebase/firebase-cpp-sdk/actions/runs/5755777170).

* Ensure using a Swift bridging header that supports both arm64 and x86_64.

* Add release note about i386 no longer being supported.

* Remove armv7 as well.

---------

Co-authored-by: firebase-workflow-trigger-bot <firebase-workflow-trigger-bot@google.com>
Co-authored-by: Jon Simantov <jsimantov@google.com>
Co-authored-by: almostmatt@google.com <almostmatt@google.com>

* feat(auth): Add emulator support (#1400)

* add auth emulator support

* fix ios number parse

* update the documentation part

* reduce lint warning

* more lint warnings

* code format

* use environment to decide using emulator or not

* fix a typo

* add readme entry for FirebaseApp.GetApps()

* update for review comment

* add missing `

---------

Co-authored-by: Cynthia Jiang <cynthiajiang@google.com>

---------

Co-authored-by: Jon Simantov <jsimantov@google.com>
Co-authored-by: Tom Andersen <tom-andersen@users.noreply.github.com>
Co-authored-by: Matthew Hyndman <almostmatt@google.com>
Co-authored-by: a-maurice <amaurice@google.com>
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
Co-authored-by: firebase-workflow-trigger[bot] <80733318+firebase-workflow-trigger[bot]@users.noreply.github.com>
Co-authored-by: firebase-workflow-trigger-bot <firebase-workflow-trigger-bot@google.com>
Co-authored-by: Cynthia J <cynthiajoan@users.noreply.github.com>
Co-authored-by: Cynthia Jiang <cynthiajiang@google.com>
  • Loading branch information
9 people authored Aug 7, 2023
1 parent 570104d commit 64369f4
Show file tree
Hide file tree
Showing 77 changed files with 5,992 additions and 1,855 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cpp-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
# Run a full packaging step any time a new branch is merged into main.
- main
schedule:
- cron: "0 9 * * *" # 9am UTC = 1am PST / 2am PDT
- cron: "0 8 * * *" # 8am UTC = 12am PST / 1am PDT
workflow_dispatch:
inputs:
preserveIntermediateArtifacts:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
cd -
# Copy all *-Swift.h header files into ios_pod/swift_headers/
echo "Copying headers..."
find "${ziptmp}" -name '*-Swift.h' -print0 | xargs -0 -n 1 -J REPLACETEXT cp -f REPLACETEXT ios_pod/swift_headers/
find "${ziptmp}" -name '*-Swift.h' -path '*ios*arm64*x86_64*simulator*' -print0 | xargs -0 -n 1 -J REPLACETEXT cp -f REPLACETEXT ios_pod/swift_headers/
copyright_line="// Copyright $(date +%Y) Google LLC"
# Add a note to each file about its source.
for ios_header in ios_pod/swift_headers/*.h; do
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ gcs_key_file.json
*_build/
cmake-build-*/
testing/test_framework/external/
CMakeFiles/
CMakeCache.txt

# XCode user specific folders
**/xcuserdata/
Expand Down
2 changes: 1 addition & 1 deletion Android/firebase_dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ project.afterEvaluate {

// Add the bill-of-materials
project.dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.0')
implementation platform('com.google.firebase:firebase-bom:32.2.2')
}
for (String lib : firebaseCpp.dependencies.libSet) {
// Generate and include the proguard file
Expand Down
4 changes: 2 additions & 2 deletions analytics/integration_test/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use_frameworks! :linkage => :static

target 'integration_test' do
platform :ios, '11.0'
pod 'Firebase/Analytics', '10.12.0'
pod 'Firebase/Analytics', '10.13.0'
end

target 'integration_test_tvos' do
platform :tvos, '12.0'
pod 'Firebase/Analytics', '10.12.0'
pod 'Firebase/Analytics', '10.13.0'
end

post_install do |installer|
Expand Down
2 changes: 1 addition & 1 deletion analytics/ios_headers/FIREventNames.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2023 Google LLC

// Copied from Firebase Analytics iOS SDK 10.12.0.
// Copied from Firebase Analytics iOS SDK 10.13.0.

/// @file FIREventNames.h
///
Expand Down
2 changes: 1 addition & 1 deletion analytics/ios_headers/FIRParameterNames.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2023 Google LLC

// Copied from Firebase Analytics iOS SDK 10.12.0.
// Copied from Firebase Analytics iOS SDK 10.13.0.

/// @file FIRParameterNames.h
///
Expand Down
2 changes: 1 addition & 1 deletion analytics/ios_headers/FIRUserPropertyNames.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2023 Google LLC

// Copied from Firebase Analytics iOS SDK 10.12.0.
// Copied from Firebase Analytics iOS SDK 10.13.0.

/// @file FIRUserPropertyNames.h
///
Expand Down
2 changes: 1 addition & 1 deletion app/app_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ android {
}

dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.0')
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-analytics'
}

Expand Down
2 changes: 1 addition & 1 deletion app/google_api_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ android {
}

dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.0')
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.android.gms:play-services-base:18.2.0'
implementation project(':app:app_resources')
Expand Down
2 changes: 1 addition & 1 deletion app/integration_test/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ platform :ios, '11.0'
use_frameworks! :linkage => :static

target 'integration_test' do
pod 'Firebase/Analytics', '10.12.0'
pod 'Firebase/Analytics', '10.13.0'
end

post_install do |installer|
Expand Down
2 changes: 1 addition & 1 deletion app/invites_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ android {
}

dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.0')
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-dynamic-links'
implementation project(':app:app_resources')
Expand Down
3 changes: 0 additions & 3 deletions app/src/include/firebase/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -571,11 +571,8 @@ class App {
/// Get the App with the given name, or nullptr if none have been created.
static App* GetInstance(const char* name);

#if !defined(DOXYGEN)
// Hidden from the public documentation for now
/// Get all the apps, including the default one.
static std::vector<App*> GetApps();
#endif // !defined(DOXYGEN)

#ifndef SWIG
// <SWIG>
Expand Down
4 changes: 2 additions & 2 deletions app/src/tests/runner/ios/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
Expand All @@ -46,4 +46,4 @@
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
</plist>
2 changes: 1 addition & 1 deletion app_check/app_check_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ android {
}

dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.0')
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-appcheck'
}

Expand Down
20 changes: 10 additions & 10 deletions app_check/integration_test/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ use_frameworks! :linkage => :static

target 'integration_test' do
platform :ios, '11.0'
pod 'Firebase/AppCheck', '10.12.0'
pod 'Firebase/Database', '10.12.0'
pod 'Firebase/Auth', '10.12.0'
pod 'Firebase/Storage', '10.12.0'
pod 'Firebase/Functions', '10.12.0'
pod 'Firebase/AppCheck', '10.13.0'
pod 'Firebase/Database', '10.13.0'
pod 'Firebase/Auth', '10.13.0'
pod 'Firebase/Storage', '10.13.0'
pod 'Firebase/Functions', '10.13.0'
end

target 'integration_test_tvos' do
platform :tvos, '12.0'
pod 'Firebase/AppCheck', '10.12.0'
pod 'Firebase/Database', '10.12.0'
pod 'Firebase/Auth', '10.12.0'
pod 'Firebase/Storage', '10.12.0'
pod 'Firebase/Functions', '10.12.0'
pod 'Firebase/AppCheck', '10.13.0'
pod 'Firebase/Database', '10.13.0'
pod 'Firebase/Auth', '10.13.0'
pod 'Firebase/Storage', '10.13.0'
pod 'Firebase/Functions', '10.13.0'
end

post_install do |installer|
Expand Down
2 changes: 1 addition & 1 deletion auth/auth_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ android {
}

dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.0')
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-auth'
implementation project(':app:app_resources')
Expand Down
4 changes: 2 additions & 2 deletions auth/integration_test/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use_frameworks! :linkage => :static

target 'integration_test' do
platform :ios, '11.0'
pod 'Firebase/Auth', '10.12.0'
pod 'Firebase/Auth', '10.13.0'
end

target 'integration_test_tvos' do
platform :tvos, '12.0'
pod 'Firebase/Auth', '10.12.0'
pod 'Firebase/Auth', '10.13.0'
end

post_install do |installer|
Expand Down
30 changes: 30 additions & 0 deletions auth/src/android/auth_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <assert.h>
#include <jni.h>

#include <string>

#include "app/src/assert.h"
#include "app/src/embedded_file.h"
#include "app/src/include/firebase/internal/mutex.h"
Expand Down Expand Up @@ -53,6 +55,7 @@ using util::JniStringToString;
X(RemoveIdTokenListener, "removeIdTokenListener", \
"(Lcom/google/firebase/auth/FirebaseAuth$IdTokenListener;)V"), \
X(SignOut, "signOut", "()V"), \
X(UseEmulator, "useEmulator", "(Ljava/lang/String;I)V"), \
X(FetchSignInMethodsForEmail, "fetchSignInMethodsForEmail", \
"(Ljava/lang/String;)" \
"Lcom/google/android/gms/tasks/Task;"), \
Expand Down Expand Up @@ -185,6 +188,31 @@ void UpdateCurrentUser(AuthData* auth_data) {
}
}

const char* const kEmulatorLocalHost = "10.0.2.2";
const char* const kEmulatorPort = "9099";
void CheckEmulator(AuthData* auth_data) {
JNIEnv* env = Env(auth_data);

// Use emulator as long as this env variable is set, regardless its value.
if (std::getenv("USE_AUTH_EMULATOR") == nullptr) {
LogDebug("Using Auth Prod for testing.");
return;
}

// Use AUTH_EMULATOR_PORT if it is set to non empty string,
// otherwise use the default port.
uint32_t port = std::stoi(kEmulatorPort);
if (std::getenv("AUTH_EMULATOR_PORT") != nullptr) {
port = std::stoi(std::getenv("AUTH_EMULATOR_PORT"));
}

jstring j_host = env->NewStringUTF(kEmulatorLocalHost);
env->CallVoidMethod(AuthImpl(auth_data),
auth::GetMethodId(auth::kUseEmulator), j_host, port);
env->DeleteLocalRef(j_host);
firebase::util::CheckAndClearJniExceptions(env);
}

// Release cached Java classes.
static void ReleaseClasses(JNIEnv* env) {
ReleaseAuthClasses(env);
Expand Down Expand Up @@ -269,6 +297,8 @@ void Auth::InitPlatformAuth(AuthData* auth_data) {
// Ensure our User is in-line with underlying API's user.
// It's possible for a user to already be logged-in on start-up.
UpdateCurrentUser(auth_data);

CheckEmulator(auth_data);
}

void Auth::DestroyPlatformAuth(AuthData* auth_data) {
Expand Down
1 change: 1 addition & 0 deletions auth/src/desktop/auth_desktop.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define FIREBASE_AUTH_SRC_DESKTOP_AUTH_DESKTOP_H_

#include <memory>
#include <string>

#include "app/rest/request.h"
#include "app/src/scheduler.h"
Expand Down
38 changes: 38 additions & 0 deletions auth/src/desktop/rpcs/auth_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "app/src/heartbeat/heartbeat_controller_desktop.h"
#include "app/src/include/firebase/app.h"
#include "app/src/include/firebase/internal/mutex.h"
#include "firebase/log.h"

namespace firebase {
namespace auth {
Expand All @@ -37,6 +38,8 @@ AuthRequest::AuthRequest(::firebase::App& app, const char* schema,
// dependencies upon other parts of this library. This complication is due to
// the way the tests are currently configured where each library has minimal
// dependencies.

CheckEmulator();
static std::string auth_user_agent; // NOLINT
static std::string extended_auth_user_agent; // NOLINT
static Mutex* user_agent_mutex = new Mutex();
Expand Down Expand Up @@ -77,5 +80,40 @@ AuthRequest::AuthRequest(::firebase::App& app, const char* schema,
}
}

std::string AuthRequest::GetUrl() {
if (emulator_url.empty()) {
std::string url(kHttps);
url += kServerURL;
return url;
} else {
std::string url(kHttp);
url += emulator_url;
url += kServerURL;
return url;
}
}

void AuthRequest::CheckEmulator() {
if (!emulator_url.empty()) {
LogDebug("Emulator Url already set: %s", emulator_url.c_str());
return;
}
// Use emulator as long as this env variable is set, regardless its value.
if (std::getenv("USE_AUTH_EMULATOR") == nullptr) {
LogDebug("Using Auth Prod for testing.");
return;
}

emulator_url.append(kEmulatorLocalHost);
emulator_url.append(":");
// Use AUTH_EMULATOR_PORT if it is set to non empty string,
// otherwise use the default port.
if (std::getenv("AUTH_EMULATOR_PORT") == nullptr) {
emulator_url.append(kEmulatorPort);
} else {
emulator_url.append(std::getenv("AUTH_EMULATOR_PORT"));
}
}

} // namespace auth
} // namespace firebase
18 changes: 18 additions & 0 deletions auth/src/desktop/rpcs/auth_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#ifndef FIREBASE_AUTH_SRC_DESKTOP_RPCS_AUTH_REQUEST_H_
#define FIREBASE_AUTH_SRC_DESKTOP_RPCS_AUTH_REQUEST_H_

#include <string>

#include "app/rest/request_json.h"
#include "app/src/include/firebase/app.h"
#include "auth/request_generated.h"
Expand All @@ -28,6 +30,16 @@ namespace auth {
// Key name for header when sending language code data.
extern const char* kHeaderFirebaseLocale;

const char* const kHttps = "https://";

const char* const kHttp = "http://";

const char* const kServerURL =
"www.googleapis.com/identitytoolkit/v3/relyingparty/";

const char* const kEmulatorLocalHost = "localhost";
const char* const kEmulatorPort = "9099";

class AuthRequest
: public firebase::rest::RequestJson<fbs::Request, fbs::RequestT> {
public:
Expand All @@ -39,6 +51,12 @@ class AuthRequest
bool deliver_heartbeat)
: AuthRequest(app, reinterpret_cast<const char*>(schema),
deliver_heartbeat) {}

std::string GetUrl();

private:
void CheckEmulator();
std::string emulator_url;
};

} // namespace auth
Expand Down
9 changes: 4 additions & 5 deletions auth/src/desktop/rpcs/create_auth_uri_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "auth/src/desktop/rpcs/create_auth_uri_request.h"

#include <string>

#include "app/src/assert.h"
#include "app/src/include/firebase/app.h"
#include "app/src/log.h"
Expand All @@ -27,11 +29,8 @@ CreateAuthUriRequest::CreateAuthUriRequest(::firebase::App& app,
: AuthRequest(app, request_resource_data, true) {
FIREBASE_ASSERT_RETURN_VOID(api_key);

const char api_host[] =
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/"
"createAuthUri?key=";
std::string url;
url.reserve(strlen(api_host) + strlen(api_key));
const char api_host[] = "createAuthUri?key=";
std::string url = GetUrl();
url.append(api_host);
url.append(api_key);
set_url(url.c_str());
Expand Down
Loading

0 comments on commit 64369f4

Please sign in to comment.