Skip to content

Add Firestore to open source #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ option(FIREBASE_INCLUDE_DYNAMIC_LINKS
"Include the Firebase Dynamic Links library." ON)
option(FIREBASE_INCLUDE_INSTALLATIONS
"Include the Firebase Installations library." ON)
option(FIREBASE_INCLUDE_FIRESTORE
"Include the Firebase Firestore library." ON)
option(FIREBASE_INCLUDE_FUNCTIONS
"Include the Cloud Functions for Firebase library." ON)
option(FIREBASE_INCLUDE_MESSAGING
Expand Down Expand Up @@ -254,6 +256,10 @@ if (FIREBASE_INCLUDE_INSTALLATIONS)
add_subdirectory(installations)
list(APPEND TARGET_LINK_LIB_NAMES "firebase_installations" "firebase_installations_swig")
list(APPEND PROJECT_LIST_HEADER " X(Installations)")
if (FIREBASE_INCLUDE_FIRESTORE)
add_subdirectory(firestore)
list(APPEND TARGET_LINK_LIB_NAMES "firebase_firestore" "firebase_firestore_swig")
list(APPEND PROJECT_LIST_HEADER " X(Firestore)")
endif()
if (FIREBASE_INCLUDE_FUNCTIONS)
add_subdirectory(functions)
Expand Down
49 changes: 49 additions & 0 deletions docs/firestore/FirestoreReadme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Get Started with Cloud Firestore for Firebase
=============================================

Thank you for installing the Unity Cloud Firestore for Firebase SDK. The
[Firestore guide](https://firebase.google.com/products/firestore/)
provides instructions to configure a Unity project.

# Overview

You can use
[Cloud Firestore](https://firebase.google.com/docs/firestore/quickstart)
to store and sync data for client- and server-side development.

Cloud Firestore is a flexible, scalable database for mobile, web, and
server development from Firebase and Google Cloud Platform. Like Firebase
Realtime Database, it keeps your data in sync across client apps through
realtime listeners and offers offline support for mobile and web so you can
build responsive apps that work regardless of network latency or Internet
connectivity. Cloud Firestore also offers seamless integration with other
Firebase and Google Cloud Platform products, including Cloud Functions.

# Using the Sample

This SDK is distributed with a sample project under the
`Assets/Firebase/Sample/Firestore` directory. To configure and run the sample,
follow the instructions in `Assets/Firebase/Sample/Firestore/readme.md`.

# Demos

[Mecha Hamster](https://github.com/google/mechahamster) is provided as a demo
which showcases the integration of multiple Firebase features within a single
game. The source is available on
[GitHub](https://github.com/google/mechahamster), and the live application
is available for iOS on the
[App Store](https://itunes.apple.com/us/app/mechahamster/id1286046770?mt=8&ign-mpt=uo%3D4)
and for Android on the
(Google Play Store)[https://play.google.com/store/apps/details?id=com.google.fpl.mechahamster&hl=en].

# Links

* [Homepage](https://firebase.google.com/games/)
* [Contact](https://firebase.google.com/support/contact/)
* [Unity Quickstart Samples](https://github.com/firebase/quickstart-unity)

# Discussion

* [Stack overflow](https://stackoverflow.com/questions/tagged/firebase)
* [Slack community](https://firebase-community.slack.com/)
* [Google groups](https://groups.google.com/forum/#!forum/firebase-talk)
Binary file added docs/firestore/Firestore_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/firestore/Firestore_large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/firestore/Firestore_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions dynamic_links/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
http://goto/firebase-dynamic-links-cpp
165 changes: 165 additions & 0 deletions firestore/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Copyright 2021 Google
#
# Licensed under the Apache License Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing software
# distributed under the License is distributed on an AS IS BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# CMake file for the firebase firestore library

include(build_shared)

# Firebase firestore Swig input files
set(firebase_firestore_swig
src/swig/firestore.i
)

# Firebase Firestore CSharp files
set(firebase_firestore_src
src/Converters/AnonymousTypeConverter.cs
src/Converters/ArrayConverter.cs
src/Converters/AttributedIdAssigner.cs
src/Converters/AttributedTypeConverter.cs
src/Converters/ConverterBase.cs
src/Converters/ConverterCache.cs
src/Converters/CustomConverter.cs
src/Converters/DictionaryConverter.cs
src/Converters/EnumConverter.cs
src/Converters/EnumerableConverter.cs
src/Converters/EnumerableConverterBase.cs
src/Converters/IFirestoreInternalConverter.cs
src/Converters/MapConverterBase.cs
src/Converters/SimpleConverters.cs
src/internal/AssertFailedException.cs
src/internal/EnvironmentVersion.cs
src/internal/Hash.cs
src/internal/Preconditions.cs
src/internal/Util.cs
src/Blob.cs
src/BuildStubs.cs
src/CollectionReference.cs
src/ConverterRegistry.cs
src/DeserializationContext.cs
src/DocumentChange.cs
src/DocumentReference.cs
src/DocumentSnapshot.cs
src/FieldPath.cs
src/FieldValue.cs
src/FirebaseFirestore.cs
src/FirebaseFirestoreSettings.cs
src/FirestoreConverter.cs
src/FirestoreDataAttribute.cs
src/FirestoreDocumentIdAttribute.cs
src/FirestoreEnumNameConverter.cs
src/FirestoreException.cs
src/FirestorePropertyAttribute.cs
src/GeoPoint.cs
src/ListenerRegistration.cs
src/ListenerRegistrationMap.cs
src/LoadBundleTaskProgress.cs
src/MonoPInvokeCallbackAttribute.cs
src/Query.cs
src/QuerySnapshot.cs
src/SerializationContext.cs
src/ServerTimestampAttribute.cs
src/ServerTimestampBehavior.cs
src/SetOptions.cs
src/SnapshotMetadata.cs
src/Timestamp.cs
src/Transaction.cs
src/TransactionManager.cs
src/UnknownPropertyHandling.cs
src/ValueDeserializer.cs
src/ValueSerializer.cs
src/WriteBatch.cs
)

add_subdirectory(src/swig)

firebase_swig_add_library(firebase_firestore_swig
NAMESPACE
Firebase.Firestore
MODULE
FirebaseCppFirestore
SOURCES
${firebase_firestore_swig}
DEPENDS
firebase_firestore
firebase_firestore_swig_cpp
absl_variant
)

set(FIRESTORE_SOURCE_DIR ${FIREBASE_CPP_SDK_DIR}/build/external/src/firestore)

# Additional public headers come from the Firestore core
if(IOS)
target_include_directories(firebase_firestore_swig
PUBLIC
# The Firestore core on iOS comes via the FirebaseFirestore CocoaPod, and
# public headers should come from there.
${FIREBASE_POD_DIR}/Pods/FirebaseFirestore/Firestore/core/include
${FIREBASE_POD_DIR}/Pods/FirebaseFirestore/Firestore/Protos/nanopb
PRIVATE
# Additionally, the core C++ API is not declared publicly within the
# FirebaseFirestore pod, so depend on headers available in the source
# distribution.
${FIREBASE_POD_DIR}/Pods/FirebaseFirestore
)
else()
# Desktop and Android get their public headers from the CMake build in
# firebase-ios-sdk.
target_include_directories(firebase_firestore_swig
PUBLIC
${FIRESTORE_SOURCE_DIR}/Firestore/core/include
${FIRESTORE_SOURCE_DIR}/Firestore/Protos/nanopb
PRIVATE
${FIRESTORE_SOURCE_DIR}
)
endif()

mono_add_library(firebase_firestore_cs
MODULE
Firebase.Firestore
SOURCES
${firebase_firestore_src}
${firebase_firestore_swig_gen_src}
REFERENCES
google_minijson_cs
unity_compat_cs
unity_tasks_cs
${FIREBASE_PLATFORM_REF}
DEPENDS
firebase_firestore_swig
)

build_firebase_shared(
firestore
firestore
FirebaseCppFirestore
)

unity_pack_native(firebase_firestore_swig)
unity_pack_cs(firebase_firestore_cs)

if (FIREBASE_INCLUDE_UNITY)
generate_dependencies_xml(Firestore
IOS_DEPS
"Firebase/Firestore"
ANDROID_DEPS
${FIREBASE_DATABASE_ANDROID_DEPS}
ANDROID_SPEC
"firestore"
)
endif()

set_property(TARGET firebase_firestore_cs
PROPERTY FOLDER
"Firebase ${FIREBASE_PLATFORM_NAME}"
)
Empty file added firestore/empty.cc
Empty file.
Loading