Skip to content

Commit eba69c8

Browse files
authored
Merge branch 'dev' into bugfix/integration-tests-mac-openssl-error
2 parents 9ec7ab9 + 96cfae2 commit eba69c8

File tree

31 files changed

+1633
-2
lines changed

31 files changed

+1633
-2
lines changed

.github/workflows/integration_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
required: true
1010
apis:
1111
description: 'CSV of apis to build and test'
12-
default: 'admob,analytics,auth,database,dynamic_links,firestore,functions,instance_id,messaging,remote_config,storage'
12+
default: 'admob,analytics,auth,database,dynamic_links,firestore,functions,installations,instance_id,messaging,remote_config,storage'
1313
required: true
1414
operating_systems:
1515
description: 'CSV of VMs to run on'

Android/firebase_dependencies.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ class Dependencies {
8888
def getFunctions() {
8989
libSet.add('functions')
9090
}
91+
def getInstallations() {
92+
libSet.add('installations')
93+
}
9194
def getInstanceId() {
9295
libSet.add('instance_id')
9396
}

app/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ if (IOS)
498498
${FIREBASE_SOURCE_DIR}/functions/src/include/firebase/functions/common.h)
499499
set(instance_id_HDRS
500500
${FIREBASE_SOURCE_DIR}/instance_id/src/include/firebase/instance_id.h)
501+
set(installations_HDRS
502+
${FIREBASE_SOURCE_DIR}/installations/src/include/firebase/installations.h)
501503
set(messaging_HDRS
502504
${FIREBASE_SOURCE_DIR}/messaging/src/include/firebase/messaging.h)
503505
set(remote_config_HDRS
@@ -520,6 +522,7 @@ if (IOS)
520522
${firestore_HDRS}
521523
${functions_HDRS}
522524
${instance_id_HDRS}
525+
${installations_HDRS}
523526
${messaging_HDRS}
524527
${remote_config_HDRS}
525528
${storage_HDRS})

build_scripts/ios/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ usage(){
2121
set -e
2222

2323
readonly SUPPORTED_ARCHITECTURES=(arm64 armv7 x86_64 i386)
24-
readonly SUPPORTED_TARGETS=(firebase_admob firebase_analytics firebase_auth firebase_database firebase_dynamic_links firebase_firestore firebase_functions firebase_instance_id firebase_messaging firebase_remote_config firebase_storage)
24+
readonly SUPPORTED_TARGETS=(firebase_admob firebase_analytics firebase_auth firebase_database firebase_dynamic_links firebase_firestore firebase_functions firebase_installations firebase_instance_id firebase_messaging firebase_remote_config firebase_storage)
2525

2626
# build default value
2727
buildpath="ios_build"

installations/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ elseif(IOS)
8686
FirebaseCore
8787
FirebaseInstallations
8888
)
89+
90+
if (FIREBASE_XCODE_TARGET_FORMAT STREQUAL "frameworks")
91+
set_target_properties(firebase_installations PROPERTIES
92+
FRAMEWORK TRUE
93+
)
94+
endif()
8995
endif()
9096

9197
if(FIREBASE_CPP_BUILD_TESTS)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/* Copyright 2020 Google LLC
4+
**
5+
** Licensed under the Apache License, Version 2.0 (the "License");
6+
** you may not use this file except in compliance with the License.
7+
** You may obtain a copy of the License at
8+
**
9+
** http://www.apache.org/licenses/LICENSE-2.0
10+
**
11+
** Unless required by applicable law or agreed to in writing, software
12+
** distributed under the License is distributed on an "AS IS" BASIS,
13+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
** See the License for the specific language governing permissions and
15+
** limitations under the License.
16+
*/
17+
-->
18+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
19+
package="com.google.firebase.fis.testapp"
20+
android:versionCode="1"
21+
android:versionName="1.0">
22+
<uses-permission android:name="android.permission.INTERNET" />
23+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
24+
<uses-permission android:name="android.permission.WAKE_LOCK" />
25+
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28" />
26+
<application android:label="@string/app_name">
27+
<activity android:name="android.app.NativeActivity"
28+
android:screenOrientation="portrait"
29+
android:configChanges="orientation|screenSize">
30+
<meta-data android:name="android.app.lib_name"
31+
android:value="android_integration_test_main" />
32+
<intent-filter>
33+
<action android:name="android.intent.action.MAIN" />
34+
<category android:name="android.intent.category.LAUNCHER" />
35+
</intent-filter>
36+
<intent-filter>
37+
<action android:name="com.google.intent.action.TEST_LOOP"/>
38+
<category android:name="android.intent.category.DEFAULT"/>
39+
<data android:mimeType="application/javascript"/>
40+
</intent-filter>
41+
</activity>
42+
<meta-data android:name="com.google.test.loops" android:value="1" />
43+
</application>
44+
</manifest>
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# Copyright 2020 Google LLC
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+
15+
# Cmake file for a single C++ integration test build.
16+
17+
cmake_minimum_required(VERSION 2.8)
18+
19+
# User settings for Firebase integration tests.
20+
# Path to Firebase SDK.
21+
# Try to read the path to the Firebase C++ SDK from an environment variable.
22+
if (NOT "$ENV{FIREBASE_CPP_SDK_DIR}" STREQUAL "")
23+
set(DEFAULT_FIREBASE_CPP_SDK_DIR "$ENV{FIREBASE_CPP_SDK_DIR}")
24+
else()
25+
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../cpp_sdk_version.json")
26+
set(DEFAULT_FIREBASE_CPP_SDK_DIR "${CMAKE_CURRENT_LIST_DIR}/../..")
27+
else()
28+
set(DEFAULT_FIREBASE_CPP_SDK_DIR "firebase_cpp_sdk")
29+
endif()
30+
endif()
31+
if ("${FIREBASE_CPP_SDK_DIR}" STREQUAL "")
32+
set(FIREBASE_CPP_SDK_DIR ${DEFAULT_FIREBASE_CPP_SDK_DIR})
33+
endif()
34+
if(NOT EXISTS ${FIREBASE_CPP_SDK_DIR})
35+
message(FATAL_ERROR "The Firebase C++ SDK directory does not exist: ${FIREBASE_CPP_SDK_DIR}. See the readme.md for more information")
36+
endif()
37+
38+
# Copy all prerequisite files for integration tests to run.
39+
if(NOT ANDROID)
40+
if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py)
41+
# If this is running from inside the SDK directory, run the setup script.
42+
execute_process(COMMAND "python" "${CMAKE_CURRENT_LIST_DIR}/../../setup_integration_tests.py" "${CMAKE_CURRENT_LIST_DIR}")
43+
endif()
44+
endif()
45+
46+
# Windows runtime mode, either MD or MT depending on whether you are using
47+
# /MD or /MT. For more information see:
48+
# https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
49+
set(MSVC_RUNTIME_MODE MD)
50+
51+
project(firebase_testapp)
52+
53+
# Integration test source files.
54+
set(FIREBASE_APP_FRAMEWORK_SRCS
55+
src/app_framework.cc
56+
src/app_framework.h
57+
)
58+
59+
set(FIREBASE_TEST_FRAMEWORK_SRCS
60+
src/firebase_test_framework.h
61+
src/firebase_test_framework.cc
62+
)
63+
64+
set(FIREBASE_INTEGRATION_TEST_SRCS
65+
src/integration_test.cc
66+
)
67+
68+
# The include directory for the testapp.
69+
include_directories(src)
70+
71+
# Integration test uses some features that require C++ 11, such as lambdas.
72+
set (CMAKE_CXX_STANDARD 11)
73+
74+
# Download and unpack googletest (and googlemock) at configure time
75+
set(GOOGLETEST_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/googletest)
76+
# Note: Once googletest is downloaded once, it won't be updated or
77+
# downloaded again unless you delete the "external/googletest"
78+
# directory.
79+
if (NOT EXISTS ${GOOGLETEST_ROOT}/src/googletest/src/gtest-all.cc)
80+
configure_file(googletest.cmake
81+
${CMAKE_CURRENT_LIST_DIR}/external/googletest/CMakeLists.txt COPYONLY)
82+
execute_process(COMMAND ${CMAKE_COMMAND} .
83+
RESULT_VARIABLE result
84+
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/external/googletest )
85+
if(result)
86+
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
87+
endif()
88+
execute_process(COMMAND ${CMAKE_COMMAND} --build .
89+
RESULT_VARIABLE result
90+
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/external/googletest )
91+
if(result)
92+
message(FATAL_ERROR "Build step for googletest failed: ${result}")
93+
endif()
94+
endif()
95+
96+
if(ANDROID)
97+
# Build an Android application.
98+
99+
# Source files used for the Android build.
100+
set(FIREBASE_APP_FRAMEWORK_ANDROID_SRCS
101+
src/android/android_app_framework.cc
102+
)
103+
104+
# Source files used for the Android build.
105+
set(FIREBASE_TEST_FRAMEWORK_ANDROID_SRCS
106+
src/android/android_firebase_test_framework.cc
107+
)
108+
109+
# Build native_app_glue as a static lib
110+
add_library(native_app_glue STATIC
111+
${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
112+
113+
# Export ANativeActivity_onCreate(),
114+
# Refer to: https://github.com/android-ndk/ndk/issues/381.
115+
set(CMAKE_SHARED_LINKER_FLAGS
116+
"${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
117+
118+
add_library(gtest STATIC
119+
${GOOGLETEST_ROOT}/src/googletest/src/gtest-all.cc)
120+
target_include_directories(gtest
121+
PRIVATE ${GOOGLETEST_ROOT}/src/googletest
122+
PUBLIC ${GOOGLETEST_ROOT}/src/googletest/include)
123+
add_library(gmock STATIC
124+
${GOOGLETEST_ROOT}/src/googlemock/src/gmock-all.cc)
125+
target_include_directories(gmock
126+
PRIVATE ${GOOGLETEST_ROOT}/src/googletest
127+
PRIVATE ${GOOGLETEST_ROOT}/src/googlemock
128+
PUBLIC ${GOOGLETEST_ROOT}/src/googletest/include
129+
PUBLIC ${GOOGLETEST_ROOT}/src/googlemock/include)
130+
131+
# Define the target as a shared library, as that is what gradle expects.
132+
set(integration_test_target_name "android_integration_test_main")
133+
add_library(${integration_test_target_name} SHARED
134+
${FIREBASE_APP_FRAMEWORK_SRCS}
135+
${FIREBASE_APP_FRAMEWORK_ANDROID_SRCS}
136+
${FIREBASE_INTEGRATION_TEST_SRCS}
137+
${FIREBASE_TEST_FRAMEWORK_SRCS}
138+
${FIREBASE_TEST_FRAMEWORK_ANDROID_SRCS}
139+
)
140+
141+
target_include_directories(${integration_test_target_name} PRIVATE
142+
${ANDROID_NDK}/sources/android/native_app_glue)
143+
144+
set(ADDITIONAL_LIBS log android atomic native_app_glue)
145+
else()
146+
# Build a desktop application.
147+
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
148+
149+
# Prevent overriding the parent project's compiler/linker
150+
# settings on Windows
151+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
152+
153+
# Add googletest directly to our build. This defines
154+
# the gtest and gtest_main targets.
155+
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/external/googletest/src
156+
${CMAKE_CURRENT_LIST_DIR}/external/googletest/build
157+
EXCLUDE_FROM_ALL)
158+
159+
# The gtest/gtest_main targets carry header search path
160+
# dependencies automatically when using CMake 2.8.11 or
161+
# later. Otherwise we have to add them here ourselves.
162+
if (CMAKE_VERSION VERSION_LESS 2.8.11)
163+
include_directories("${gtest_SOURCE_DIR}/include")
164+
include_directories("${gmock_SOURCE_DIR}/include")
165+
endif()
166+
167+
# Windows runtime mode, either MD or MT depending on whether you are using
168+
# /MD or /MT. For more information see:
169+
# https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
170+
set(MSVC_RUNTIME_MODE MD)
171+
172+
# Platform abstraction layer for the desktop integration test.
173+
set(FIREBASE_APP_FRAMEWORK_DESKTOP_SRCS
174+
src/desktop/desktop_app_framework.cc
175+
)
176+
177+
set(integration_test_target_name "integration_test")
178+
add_executable(${integration_test_target_name}
179+
${FIREBASE_APP_FRAMEWORK_SRCS}
180+
${FIREBASE_APP_FRAMEWORK_DESKTOP_SRCS}
181+
${FIREBASE_TEST_FRAMEWORK_SRCS}
182+
${FIREBASE_INTEGRATION_TEST_SRCS}
183+
)
184+
185+
if(APPLE)
186+
set(ADDITIONAL_LIBS
187+
gssapi_krb5
188+
pthread
189+
"-framework CoreFoundation"
190+
"-framework Foundation"
191+
"-framework GSS"
192+
"-framework Security"
193+
)
194+
elseif(MSVC)
195+
set(ADDITIONAL_LIBS advapi32 ws2_32 crypt32)
196+
else()
197+
set(ADDITIONAL_LIBS pthread)
198+
endif()
199+
200+
# If a config file is present, copy it into the binary location so that it's
201+
# possible to create the default Firebase app.
202+
set(FOUND_JSON_FILE FALSE)
203+
foreach(config "google-services-desktop.json" "google-services.json")
204+
if (EXISTS ${config})
205+
add_custom_command(
206+
TARGET ${integration_test_target_name} POST_BUILD
207+
COMMAND ${CMAKE_COMMAND} -E copy
208+
${config} $<TARGET_FILE_DIR:${integration_test_target_name}>)
209+
set(FOUND_JSON_FILE TRUE)
210+
break()
211+
endif()
212+
endforeach()
213+
if(NOT FOUND_JSON_FILE)
214+
message(WARNING "Failed to find either google-services-desktop.json or google-services.json. See the readme.md for more information.")
215+
endif()
216+
endif()
217+
218+
# Add the Firebase libraries to the target using the function from the SDK.
219+
add_subdirectory(${FIREBASE_CPP_SDK_DIR} bin/ EXCLUDE_FROM_ALL)
220+
# Note that firebase_app needs to be last in the list.
221+
set(firebase_libs firebase_installations firebase_app)
222+
set(gtest_libs gtest gmock)
223+
target_link_libraries(${integration_test_target_name} ${firebase_libs}
224+
${gtest_libs} ${ADDITIONAL_LIBS})

0 commit comments

Comments
 (0)