Skip to content

Commit 7e7c593

Browse files
authored
GMA Merge to Main (#1001)
Merge the GMA SDK Feature Branch to main.
1 parent dc13f63 commit 7e7c593

File tree

286 files changed

+22719
-1607
lines changed

Some content is hidden

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

286 files changed

+22719
-1607
lines changed

.github/workflows/integration_tests.yml

+47-17
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
required: true
1717
apis:
1818
description: 'CSV of apis to build and test'
19-
default: 'admob,analytics,auth,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'
19+
default: 'admob,analytics,auth,database,dynamic_links,firestore,functions,gma,installations,messaging,remote_config,storage'
2020
required: true
2121
operating_systems:
2222
description: 'CSV of VMs to run on'
@@ -1092,7 +1092,7 @@ jobs:
10921092
10931093
10941094
test_android:
1095-
name: test-android-${{ matrix.build_os }}-${{ matrix.android_device }}
1095+
name: test-android-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }}
10961096
needs: [check_and_prepare, build_android]
10971097
runs-on: macos-12
10981098
if: contains(needs.check_and_prepare.outputs.matrix_platform, 'Android') && needs.check_and_prepare.outputs.apis != '' && !cancelled()
@@ -1101,6 +1101,12 @@ jobs:
11011101
matrix:
11021102
build_os: ${{ fromJson(needs.check_and_prepare.outputs.matrix_os) }}
11031103
android_device: ${{ fromJson(needs.check_and_prepare.outputs.android_device) }}
1104+
test_type: ["gameloop"]
1105+
exclude:
1106+
- android_device: "android_target"
1107+
test_type: "uitest"
1108+
- android_device: "android_latest"
1109+
test_type: "uitest"
11041110
steps:
11051111
- name: setup Xcode version (macos)
11061112
if: runner.os == 'macOS'
@@ -1151,8 +1157,9 @@ jobs:
11511157
if: steps.get-device-type.outputs.device_type == 'virtual'
11521158
run: |
11531159
python scripts/gha/test_simulator.py --testapp_dir testapps \
1160+
--test_type "${{ matrix.test_type }}" \
11541161
--android_device "${{ matrix.android_device }}" \
1155-
--logfile_name "android-${{ matrix.build_os }}-${{ matrix.android_device }}" \
1162+
--logfile_name "android-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }}" \
11561163
--ci
11571164
- name: Install Cloud SDK
11581165
if: steps.get-device-type.outputs.device_type == 'real'
@@ -1163,24 +1170,31 @@ jobs:
11631170
run: |
11641171
python scripts/gha/test_lab.py --testapp_dir testapps \
11651172
--android_device "${{ matrix.android_device }}" \
1166-
--logfile_name "android-${{ matrix.build_os }}-${{ matrix.android_device }}" \
1173+
--logfile_name "android-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }}" \
11671174
--code_platform cpp \
11681175
--key_file_encrypted scripts/gha-encrypted/gcs_key_file.json.gpg \
11691176
--key_file_passphrase "${{ secrets.TEST_SECRET }}"
11701177
- name: Prepare results summary artifact
11711178
if: ${{ !cancelled() }}
11721179
shell: bash
11731180
run: |
1174-
# If testapps do not exist, then it's a build error not test error.
1175-
if [ -d "testapps/testapps-android-${{ matrix.build_os }}" && ! -f "testapps/test-results-android-${{ matrix.build_os }}-${{ matrix.android_device }}.log.json" ]; then
1176-
mkdir -p testapps && echo "__SUMMARY_MISSING__" > "testapps/test-results-android-${{ matrix.build_os }}-${{ matrix.android_device }}.log.json"
1181+
# If testapps do not exist, then it's a build error not test error.
1182+
if [ -d "testapps/testapps-android-${{ matrix.build_os }}" && ! -f "testapps/test-results-android-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }}.log.json" ]; then
1183+
mkdir -p testapps && echo "__SUMMARY_MISSING__" > "testapps/test-results-android-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }}.log.json"
11771184
fi
11781185
- name: Upload Android test results artifact
11791186
if: ${{ !cancelled() }}
11801187
uses: actions/upload-artifact@v3
11811188
with:
11821189
name: log-artifact
1183-
path: testapps/test-results-android-${{ matrix.build_os }}-${{ matrix.android_device }}*
1190+
path: testapps/test-results-android-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }}*
1191+
retention-days: ${{ env.artifactRetentionDays }}
1192+
- name: Upload Android test video artifact
1193+
if: ${{ steps.get-device-type.outputs.device_type == 'virtual' && !cancelled() }}
1194+
uses: actions/upload-artifact@v3
1195+
with:
1196+
name: mobile-simulator-test-video-artifact
1197+
path: testapps/video-*-android-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }}.mp4
11841198
retention-days: ${{ env.artifactRetentionDays }}
11851199
- name: Download log artifacts
11861200
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
@@ -1202,20 +1216,28 @@ jobs:
12021216
if: ${{ !cancelled() }}
12031217
shell: bash
12041218
run: |
1205-
cat "testapps/test-results-android-${{ matrix.build_os }}-${{ matrix.android_device }}.log"
1219+
cat "testapps/test-results-android-${{ matrix.build_os }}-${{ matrix.android_device }}-${{ matrix.test_type }}.log"
12061220
if [[ "${{ job.status }}" != "success" ]]; then
12071221
exit 1
12081222
fi
12091223
12101224
test_ios:
1211-
name: test-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}
1225+
name: test-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}-${{ matrix.test_type }}
12121226
needs: [check_and_prepare, build_ios]
12131227
runs-on: macos-12
12141228
if: contains(needs.check_and_prepare.outputs.matrix_platform, 'iOS') && needs.check_and_prepare.outputs.apis != '' && !cancelled()
12151229
strategy:
12161230
fail-fast: false
12171231
matrix:
12181232
ios_device: ${{ fromJson(needs.check_and_prepare.outputs.ios_device) }}
1233+
test_type: ["gameloop"]
1234+
exclude:
1235+
- ios_device: "ios_min"
1236+
test_type: "uitest"
1237+
- ios_device: "ios_target"
1238+
test_type: "uitest"
1239+
- ios_device: "ios_latest"
1240+
test_type: "uitest"
12191241
build_os: [macos-12]
12201242
steps:
12211243
- name: setup Xcode version (macos)
@@ -1261,8 +1283,9 @@ jobs:
12611283
if: steps.get-device-type.outputs.device_type == 'virtual'
12621284
run: |
12631285
python scripts/gha/test_simulator.py --testapp_dir testapps \
1286+
--test_type "${{ matrix.test_type }}" \
12641287
--ios_device "${{ matrix.ios_device }}" \
1265-
--logfile_name "ios-${{ matrix.build_os }}-${{ matrix.ios_device }}" \
1288+
--logfile_name "ios-${{ matrix.build_os }}-${{ matrix.ios_device }}-${{ matrix.test_type }}" \
12661289
--ci
12671290
- name: Install Cloud SDK
12681291
if: steps.get-device-type.outputs.device_type == 'real'
@@ -1274,24 +1297,31 @@ jobs:
12741297
run: |
12751298
python scripts/gha/test_lab.py --testapp_dir testapps \
12761299
--ios_device "${{ matrix.ios_device }}" \
1277-
--logfile_name "ios-${{ matrix.build_os }}-${{ matrix.ios_device }}" \
1300+
--logfile_name "ios-${{ matrix.build_os }}-${{ matrix.ios_device }}-${{ matrix.test_type }}" \
12781301
--code_platform cpp \
12791302
--key_file_encrypted scripts/gha-encrypted/gcs_key_file.json.gpg \
12801303
--key_file_passphrase "${{ secrets.TEST_SECRET }}"
12811304
- name: Prepare results summary artifact
12821305
if: ${{ !cancelled() }}
12831306
shell: bash
12841307
run: |
1285-
# If testapps do not exist, then it's a build error not test error.
1286-
if [ -d "testapps/testapps-ios-${{ matrix.build_os }}" && ! -f "testapps/test-results-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}.log.json" ]; then
1287-
mkdir -p testapps && echo "__SUMMARY_MISSING__" > "testapps/test-results-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}.log.json"
1308+
# If testapps do not exist, then it's a build error not test error.
1309+
if [ -d "testapps/testapps-ios-${{ matrix.build_os }}" && ! -f "testapps/test-results-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}-${{ matrix.test_type }}.log.json" ]; then
1310+
mkdir -p testapps && echo "__SUMMARY_MISSING__" > "testapps/test-results-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}-${{ matrix.test_type }}.log.json"
12881311
fi
12891312
- name: Upload iOS test results artifact
12901313
if: ${{ !cancelled() }}
12911314
uses: actions/upload-artifact@v3
12921315
with:
12931316
name: log-artifact
1294-
path: testapps/test-results-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}*
1317+
path: testapps/test-results-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}-${{ matrix.test_type }}*
1318+
retention-days: ${{ env.artifactRetentionDays }}
1319+
- name: Upload iOS test video artifact
1320+
if: ${{ steps.get-device-type.outputs.device_type == 'virtual' && !cancelled() }}
1321+
uses: actions/upload-artifact@v3
1322+
with:
1323+
name: mobile-simulator-test-video-artifact
1324+
path: testapps/video-*-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}-${{ matrix.test_type }}.mp4
12951325
retention-days: ${{ env.artifactRetentionDays }}
12961326
- name: Download log artifacts
12971327
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
@@ -1313,7 +1343,7 @@ jobs:
13131343
if: ${{ !cancelled() }}
13141344
shell: bash
13151345
run: |
1316-
cat "testapps/test-results-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}.log"
1346+
cat "testapps/test-results-ios-${{ matrix.build_os }}-${{ matrix.ios_device }}-${{ matrix.test_type }}.log"
13171347
if [[ "${{ job.status }}" != "success" ]]; then
13181348
exit 1
13191349
fi

Android/firebase_dependencies.gradle

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def firebaseDependenciesMap = [
2626
'dynamic_links' : ['com.google.firebase:firebase-dynamic-links'],
2727
'firestore' : ['com.google.firebase:firebase-firestore'],
2828
'functions' : ['com.google.firebase:firebase-functions'],
29+
'gma' : ['com.google.android.gms:play-services-ads:21.0.0'],
2930
'installations' : ['com.google.firebase:firebase-installations'],
3031
'invites' : ['com.google.firebase:firebase-invites'],
3132
// Messaging has an additional local dependency to include.
@@ -48,6 +49,7 @@ def firebaseResourceDependenciesMap = [
4849
'auth' : [':auth:auth_resources'],
4950
'database' : [':database:database_resources'],
5051
'firestore' : [':firestore:firestore_resources'],
52+
'gma' : [':gma:gma_resources'],
5153
'storage' : [':storage:storage_resources']
5254
]
5355

@@ -87,6 +89,9 @@ class Dependencies {
8789
def getFirestore() {
8890
libSet.add('firestore')
8991
}
92+
def getGma() {
93+
libSet.add('gma')
94+
}
9095
def getFunctions() {
9196
libSet.add('functions')
9297
}

CMakeLists.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ option(FIREBASE_INCLUDE_FIRESTORE
4646
option(FIREBASE_INCLUDE_FUNCTIONS
4747
"Include the Cloud Functions for Firebase library."
4848
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
49+
option(FIREBASE_INCLUDE_GMA "Include the GMA library."
50+
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
4951
option(FIREBASE_INCLUDE_INSTALLATIONS
5052
"Include the Firebase Installations library."
5153
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
@@ -116,9 +118,10 @@ if(FIREBASE_CPP_BUILD_TESTS OR FIREBASE_CPP_BUILD_STUB_TESTS)
116118
endif()
117119

118120
if (PLATFORM STREQUAL TVOS OR PLATFORM STREQUAL SIMULATOR_TVOS)
119-
# AdMob and FDL are not supported on tvOS.
121+
# AdMob, GMA and FDL are not supported on tvOS.
120122
set(FIREBASE_INCLUDE_ADMOB OFF)
121123
set(FIREBASE_INCLUDE_DYNAMIC_LINKS OFF)
124+
set(FIREBASE_INCLUDE_GMA OFF)
122125
endif()
123126

124127
# Occasionally ANDROID is not being set correctly when invoked by gradle, so
@@ -599,6 +602,9 @@ endif()
599602
if (FIREBASE_INCLUDE_FUNCTIONS)
600603
add_subdirectory(functions)
601604
endif()
605+
if (FIREBASE_INCLUDE_GMA)
606+
add_subdirectory(gma)
607+
endif()
602608
if (FIREBASE_INCLUDE_INSTALLATIONS)
603609
add_subdirectory(installations)
604610
endif()

admob/CMakeLists.txt

+8-10
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ target_include_directories(firebase_admob
8989
PRIVATE
9090
${FIREBASE_CPP_SDK_ROOT_DIR}
9191
)
92+
93+
if(IOS)
94+
target_include_directories(firebase_admob
95+
PRIVATE
96+
${CMAKE_CURRENT_LIST_DIR}/admob_resources/ios_headers
97+
)
98+
endif()
99+
92100
target_compile_definitions(firebase_admob
93101
PRIVATE
94102
-DINTERNAL_EXPERIMENTAL=1
@@ -110,16 +118,6 @@ elseif(IOS)
110118
target_link_libraries(firebase_admob
111119
PUBLIC "-fembed-bitcode")
112120

113-
setup_pod_headers(
114-
firebase_admob
115-
POD_NAMES
116-
Google-Mobile-Ads-SDK
117-
)
118-
119-
# AdMob expects the header files to be in a subfolder, so set up a symlink to
120-
# accomplish that.
121-
symlink_pod_headers(firebase_admob Google-Mobile-Ads-SDK GoogleMobileAds)
122-
123121
if (FIREBASE_XCODE_TARGET_FORMAT STREQUAL "frameworks")
124122
set_target_properties(firebase_admob PROPERTIES
125123
FRAMEWORK TRUE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2021 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+
# Don't inherit configurations from CPPLINT.cfg in parent directories.
16+
set noparent
17+
18+
# Don't attempt to lint headers that came straight of the original pod file
19+
exclude_files=GoogleMobileAds
20+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
//
2+
// DFPBannerView.h
3+
// Google Mobile Ads SDK
4+
//
5+
// Copyright 2012 Google LLC. All rights reserved.
6+
//
7+
8+
#import <GoogleMobileAds/GADAdLoader.h>
9+
#import <GoogleMobileAds/GADAdLoaderDelegate.h>
10+
#import <GoogleMobileAds/GADAppEventDelegate.h>
11+
#import <GoogleMobileAds/GADBannerView.h>
12+
#import <GoogleMobileAds/GADVideoController.h>
13+
14+
@class DFPBannerView;
15+
16+
/// The delegate of a GADAdLoader object must conform to this protocol to receive DFPBannerViews.
17+
@protocol DFPBannerAdLoaderDelegate <GADAdLoaderDelegate>
18+
19+
/// Asks the delegate which banner ad sizes should be requested.
20+
- (nonnull NSArray<NSValue *> *)validBannerSizesForAdLoader:(nonnull GADAdLoader *)adLoader;
21+
22+
/// Tells the delegate that a Google Ad Manager banner ad was received.
23+
- (void)adLoader:(nonnull GADAdLoader *)adLoader
24+
didReceiveDFPBannerView:(nonnull DFPBannerView *)bannerView;
25+
26+
@end
27+
28+
/// The view that displays Ad Manager banner ads.
29+
///
30+
/// To request this ad type using GADAdLoader, you need to pass kGADAdLoaderAdTypeDFPBanner (see
31+
/// GADAdLoaderAdTypes.h) to the |adTypes| parameter in GADAdLoader's initializer method. If you
32+
/// request this ad type, your delegate must conform to the DFPBannerAdLoaderDelegate protocol.
33+
@interface DFPBannerView : GADBannerView
34+
35+
/// Required value created on the Ad Manager website. Create a new ad unit for every unique
36+
/// placement of an ad in your application. Set this to the ID assigned for this placement. Ad units
37+
/// are important for targeting and statistics.
38+
///
39+
/// Example Ad Manager ad unit ID: @"/6499/example/banner"
40+
@property(nonatomic, copy, nullable) NSString *adUnitID;
41+
42+
/// Optional delegate that is notified when creatives send app events.
43+
@property(nonatomic, weak, nullable) IBOutlet id<GADAppEventDelegate> appEventDelegate;
44+
45+
/// Optional delegate that is notified when creatives cause the banner to change size.
46+
@property(nonatomic, weak, nullable) IBOutlet id<GADAdSizeDelegate> adSizeDelegate;
47+
48+
/// Optional array of NSValue encoded GADAdSize structs, specifying all valid sizes that are
49+
/// appropriate for this slot. Never create your own GADAdSize directly. Use one of the predefined
50+
/// standard ad sizes (such as kGADAdSizeBanner), or create one using the GADAdSizeFromCGSize
51+
/// method.
52+
///
53+
/// Example:
54+
///
55+
/// \code
56+
/// NSArray *validSizes = @[
57+
/// NSValueFromGADAdSize(kGADAdSizeBanner),
58+
/// NSValueFromGADAdSize(kGADAdSizeLargeBanner)
59+
/// ];
60+
///
61+
/// bannerView.validAdSizes = validSizes;
62+
/// \endcode
63+
@property(nonatomic, copy, nullable) NSArray<NSValue *> *validAdSizes;
64+
65+
/// Indicates that the publisher will record impressions manually when the ad becomes visible to the
66+
/// user.
67+
@property(nonatomic) BOOL enableManualImpressions;
68+
69+
/// Video controller for controlling video rendered by this ad view.
70+
@property(nonatomic, readonly, nonnull) GADVideoController *videoController;
71+
72+
/// If you've set enableManualImpressions to YES, call this method when the ad is visible.
73+
- (void)recordImpression;
74+
75+
/// Use this function to resize the banner view without launching a new ad request.
76+
- (void)resize:(GADAdSize)size;
77+
78+
/// Sets options that configure ad loading.
79+
///
80+
/// @param adOptions An array of GADAdLoaderOptions objects. The array is deep copied and option
81+
/// objects cannot be modified after calling this method.
82+
- (void)setAdOptions:(nonnull NSArray<GADAdLoaderOptions *> *)adOptions;
83+
84+
#pragma mark Deprecated
85+
86+
/// Deprecated. Use the validAdSizes property.
87+
/// Sets the receiver's valid ad sizes to the values pointed to by the provided NULL terminated list
88+
/// of GADAdSize pointers.
89+
- (void)setValidAdSizesWithSizes:(nullable GADAdSize *)firstSize, ... NS_REQUIRES_NIL_TERMINATION
90+
GAD_DEPRECATED_MSG_ATTRIBUTE("Use validAdSizes property.");
91+
92+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// DFPBannerViewOptions.h
3+
// Google Mobile Ads SDK
4+
//
5+
// Copyright 2016 Google LLC. All rights reserved.
6+
//
7+
8+
#import <GoogleMobileAds/GADAdLoader.h>
9+
#import <GoogleMobileAds/GADAdSize.h>
10+
#import <GoogleMobileAds/GADAdSizeDelegate.h>
11+
#import <GoogleMobileAds/GADAppEventDelegate.h>
12+
13+
/// Ad loader options for banner ads.
14+
@interface DFPBannerViewOptions : GADAdLoaderOptions
15+
16+
/// Optional delegate that is notified if the loaded banner sends app events.
17+
@property(nonatomic, weak, nullable) id<GADAppEventDelegate> appEventDelegate;
18+
19+
/// Optional delegate that is notified if the loaded banner changes size.
20+
@property(nonatomic, weak, nullable) id<GADAdSizeDelegate> adSizeDelegate;
21+
22+
/// Whether the publisher will record impressions manually when the ad becomes visible to the user.
23+
@property(nonatomic, assign) BOOL enableManualImpressions;
24+
25+
@end

0 commit comments

Comments
 (0)