Skip to content

Commit 93890f2

Browse files
authored
Merge pull request #251 from firebase/am-add-installations
Add Installations code and CMake logic
2 parents e227d5b + fa500d8 commit 93890f2

23 files changed

+1723
-2
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ option(FIREBASE_INCLUDE_FIRESTORE
4545
option(FIREBASE_INCLUDE_FUNCTIONS
4646
"Include the Cloud Functions for Firebase library."
4747
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
48+
option(FIREBASE_INCLUDE_INSTALLATIONS
49+
"Include the Firebase Installations library."
50+
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
4851
option(FIREBASE_INCLUDE_INSTANCE_ID
4952
"Include the Firebase Instance ID library."
5053
${FIREBASE_INCLUDE_LIBRARY_DEFAULT})
@@ -548,6 +551,9 @@ endif()
548551
if (FIREBASE_INCLUDE_FUNCTIONS)
549552
add_subdirectory(functions)
550553
endif()
554+
if (FIREBASE_INCLUDE_INSTALLATIONS)
555+
add_subdirectory(installations)
556+
endif()
551557
if (FIREBASE_INCLUDE_INSTANCE_ID)
552558
add_subdirectory(instance_id)
553559
endif()

build_scripts/packaging.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
# List of all Firebase products to include in the binary SDK package.
44
readonly -a product_list=(admob analytics app auth database
5-
dynamic_links firestore functions instance_id messaging remote_config
6-
storage)
5+
dynamic_links firestore functions installations instance_id messaging
6+
remote_config storage)

installations/CMakeLists.txt

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Copyright 2020 Google
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 the firebase_installations library
16+
17+
# Common source files used by all platforms
18+
set(common_SRCS
19+
src/installations.cc)
20+
21+
# Source files used by the Android implementation.
22+
set(android_SRCS
23+
src/android/installations_android.cc)
24+
25+
# Source files used by the iOS implementation.
26+
set(ios_SRCS
27+
src/ios/installations_ios.mm)
28+
29+
# Source files used by the desktop implementation.
30+
set(desktop_SRCS
31+
src/stub/installations_stub.cc)
32+
33+
if(ANDROID)
34+
set(installations_platform_SRCS
35+
"${android_SRCS}")
36+
elseif(IOS)
37+
set(installations_platform_SRCS
38+
"${ios_SRCS}")
39+
else()
40+
set(installations_platform_SRCS
41+
"${desktop_SRCS}")
42+
endif()
43+
44+
add_library(firebase_installations STATIC
45+
${common_SRCS}
46+
${installations_platform_SRCS})
47+
48+
set_property(TARGET firebase_installations PROPERTY FOLDER "Firebase Cpp")
49+
50+
# Set up the dependency on Firebase App.
51+
target_link_libraries(firebase_installations
52+
PUBLIC
53+
firebase_app
54+
)
55+
# Public headers all refer to each other relative to the src/include directory,
56+
# while private headers are relative to the entire C++ SDK directory.
57+
target_include_directories(firebase_installations
58+
PUBLIC
59+
${CMAKE_CURRENT_LIST_DIR}/src/include
60+
PRIVATE
61+
${FIREBASE_CPP_SDK_ROOT_DIR}
62+
)
63+
target_compile_definitions(firebase_installations
64+
PRIVATE
65+
-DINTERNAL_EXPERIMENTAL=1
66+
)
67+
# Automatically include headers that might not be declared.
68+
if(MSVC)
69+
add_definitions(/FI"assert.h" /FI"string.h" /FI"stdint.h")
70+
else()
71+
add_definitions(-include assert.h -include string.h)
72+
endif()
73+
74+
if(ANDROID)
75+
firebase_cpp_proguard_file(installations)
76+
elseif(IOS)
77+
# Enable Automatic Reference Counting (ARC).
78+
set_property(
79+
TARGET firebase_installations
80+
APPEND_STRING PROPERTY
81+
COMPILE_FLAGS "-fobjc-arc")
82+
83+
setup_pod_headers(
84+
firebase_installations
85+
POD_NAMES
86+
FirebaseCore
87+
FirebaseInstallations
88+
)
89+
endif()
90+
91+
if(FIREBASE_CPP_BUILD_TESTS)
92+
# Add the tests subdirectory
93+
add_subdirectory(tests)
94+
endif()
95+
96+
cpp_pack_library(firebase_installations "")
97+
cpp_pack_public_headers()

installations/build.gradle

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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+
buildscript {
16+
repositories {
17+
google()
18+
jcenter()
19+
}
20+
dependencies {
21+
classpath 'com.android.tools.build:gradle:3.2.1'
22+
}
23+
}
24+
allprojects {
25+
repositories {
26+
google()
27+
jcenter()
28+
}
29+
}
30+
31+
apply plugin: 'com.android.library'
32+
33+
android {
34+
compileSdkVersion 28
35+
buildToolsVersion '28.0.3'
36+
37+
sourceSets {
38+
main {
39+
manifest.srcFile '../android_build_files/AndroidManifest.xml'
40+
}
41+
}
42+
43+
externalNativeBuild {
44+
cmake {
45+
path '../CMakeLists.txt'
46+
}
47+
}
48+
49+
defaultConfig {
50+
// This is the platform API where NativeActivity was introduced.
51+
minSdkVersion 9
52+
targetSdkVersion 28
53+
versionCode 1
54+
versionName "1.0"
55+
56+
buildTypes {
57+
release {
58+
minifyEnabled false
59+
}
60+
}
61+
62+
externalNativeBuild {
63+
cmake {
64+
targets 'firebase_installations'
65+
// Args are: Re-use app library prebuilt by app gradle project.
66+
// Don't configure all the cmake subprojects.
67+
// Only include needed project.
68+
arguments '-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON',
69+
'-DFIREBASE_INCLUDE_LIBRARY_DEFAULT=OFF',
70+
'-DFIREBASE_INCLUDE_INSTALLATIONS=ON'
71+
}
72+
}
73+
}
74+
75+
lintOptions {
76+
abortOnError false
77+
}
78+
}
79+
80+
dependencies {
81+
implementation project(':app')
82+
}
83+
apply from: "$rootDir/android_build_files/generate_proguard.gradle"
84+
project.afterEvaluate {
85+
generateProguardFile('installations')
86+
}

0 commit comments

Comments
 (0)