Commit Graph
723 Commits
Author SHA1 Message Date
Gil 87dc1b95c8 Migrate libFuzzer from svn to git (#7245)
* Migrate libFuzzer from svn to git

Now that the llvm project has completed its migration to git, the svn
checkouts are now failing.

* Find protoc even if homebrew isn't in /usr/local
2021-01-05 11:26:56 -08:00
Sebastian Schmidt eb21690b80 Remove SimpleQueryEngine (#7038) 2020-11-26 09:49:25 -07:00
Morgan ChenandPaul Beusterien 90d3600c56 Implement unified emulator settings API proposal (#5916)
* Add header for API proposal

* Fix some bugs and add implmentation

* Fix header import

* Fix umbrella header

* Add ways to modify settings object

* Remove unnecessary nodoc

* Update with new API

* Add implementations for Firestore and RTDB

* Revert emulator settings class

* fix style

* Remove bad import and assertion on override

* Prevent database emu from being set after repo init

* Add unified emu to functions

* Add tests

* update header comment

* fix test failures

* remove unused variable

* fix database test

* cast NSInteger to long

* fix style

* Fix functions test in travis

* Remove valueForKeyPath in tests

* fix style

* update comments and remove explicit scheme

* save progress

* Implement reference validation for RTDB

* Add tests

* Add changelog entries

* Remove test logs

* Fix line lengths

* remove underlyingHost

* fix functions tests

* fix integration warnings in functions test

* fix functions test

* Fix infinite loop exposed in integration tests (#6912)

Co-authored-by: Paul Beusterien <paulbeusterien@google.com>
2020-11-06 10:37:06 -08:00
Brian Chen 1c1ca000c6 Allow null/NAN values in filters (#6871) 2020-11-02 12:52:30 -06:00
Gil ad2fed1485 Run integration tests against the emulator by default. (#6852)
Remove support for running against Hexa, which we haven't done in years. Integration tests will now assume a local emulator by default.

Once imported into google3, this will make it significantly easier to run integration tests against cls from third-parties because this will be able to use the emulator we're already running rather than requiring us to build hexa again.
2020-10-27 16:33:47 -07:00
Gil db6013c8f4 Prevent test build errors under Xcode 12.1 (#6760)
Xcode 12 changed the XCTest assertions to be macros that no longer implicitly depended on `self`. It seems as if Xcode 12.1 has made -Wunused-lambda-capture part of our default warnings and this breaks Objective-C++ code that lambda captures `self` only for its implicit use with the XCTest macros.

This isn't common, so just suppress the warning by forcing `self` to appear used regardless of whether XCTest assertions reference `self` or not.
2020-10-16 16:27:29 -07:00
Gil 885b07be6a Remove support for setting timestampsInSnapshotsEnabled (#6622)
Snapshots will now always include `FIRTimestamp` values. Use
`[FIRTimestamp dateValue]` to convert to `NSDate` if required.

`timestampsInSnapshotsEnabled` was deprecated in Firebase 5.16.0
(January 22, 2019) and has defaulted to true since then.

Projects that have not enabled `timestampsInSnapshotsEnabled` have
logged a warning since Firebase 4.12.0 (April 10, 2018).
2020-10-13 13:05:33 -07:00
Paul Beusterien 5d0a1c8ccb Merge remote-tracking branch 'origin/firebase7-main' into pb-merge-firebase7 2020-09-30 14:23:40 -07:00
Konstantin Varlamov 2311c36dbc Integrate Firestore with Firebase platform logging (#6507)
The sample user agent string I'm getting in XCode is `apple-platform/ios apple-sdk/17E8258 fire-fst/1.17.1 fire-ios/6.10.2 swift/true xcode/11E503a`.
2020-09-25 15:47:20 -04:00
Sebastian Schmidt 24a77d04c8 Import Spec tests (#6525)
* Import Spec tests

* Init

* Add recovery specs

* Update FSTSyncEngineTestDriver.mm
2020-09-22 18:48:04 -07:00
Paul Beusterien eea957561c Merge remote-tracking branch 'origin/master' into pb-f7-msg-update 2020-09-22 15:46:23 -07:00
Paul Beusterien a39b515f3a Update podspecs to min iOS 10 (#6517) 2020-09-22 15:11:35 -07:00
Brian Chen 21921e9851 Add != and notIn support (#6418) 2020-09-15 16:12:44 -05:00
Gil 73fcb194d8 Add conditional conformance to Hashable to Firestore property wrapper types (#6249)
* Remove the extension that makes NSDate ServerTimestampWrappable.

This turns out not to actually work because NSDate does not conform to
Codable. Users can supply their own extensions that make NSDate conform
to Codable and also supply an extension like this one to make NSDate
conform to ServerTimestampWrappable.

Add a test that verifies ServerTimestamps of Dates actually work. The
equivalent test for NSDate does not compile.

* Fix minimum Swift version for FirebaseFirestoreSwift

FirebaseFirestoreSwift was already using synthesized Equatable and
Hashable conformance which requires Swift 4.1.

* Add conditional conformance to Hashable to Firestore property wrapper types

Mark these types as conforming to Hashable if the underlying type itself
conforms to hashable. This implementation relies on synthesized
Equatable and Hashable conformance that shipped as a part of Swift 4.1.

* Fix lint/style

* Changelog
2020-08-12 10:26:57 -04:00
Paul Beusterien a22b425377 Firestore - new public header structure (#6197) 2020-08-04 06:50:55 -07:00
Denver Coneybeare 69c3e4b9e5 Add an integration test for callbacks on the main thread (#6054) 2020-07-16 15:06:22 -04:00
Denver Coneybeare ffe23884da Add #include for config.h to get the value for HAVE_LIBDISPATCH (#6041) 2020-07-14 15:38:18 -04:00
Gil 59c8c95501 Have ListenerRegistration::Remove block until callbacks are complete (#5961)
* Add the ability to await a single expectation

* Await individual expectations in test helpers

This prevents tests from accidentally awaiting unrelated expectations
when using the helpers.

* Fix tests that implicitly relied on test helpers to await all

* Add a test that verifies ListenerRegistration::Remove blocks

* Block ListenerRegistration::Remove when there are outstanding callbacks.

* Test that remove does not block when called from the callback.
2020-07-06 13:06:36 -07:00
Gil 6f12f3871b Make snapshots in sync listener registration removal idempotent (#5945) 2020-06-30 09:32:37 -07:00
Gil eb6d343677 Fix TSAN errors in FIRListenerRegistrationTests (#5943) 2020-06-30 08:20:27 -07:00
Gil 7ef9914ff9 Fix TSAN violations in FSTTransactionTests (#5922)
TSAN uncovered cases where we were reading values in the transaction
thread that were set on the main thread and were unprotected by lock. In
practice this is unlikely to cause an harm, but it's good to keep TSAN
clean for when there are real issues.
2020-06-25 17:28:24 -07:00
Paul Beusterien e03a8d91a0 Consolidate GDT and GDTCCT to a single pod (#5902) 2020-06-24 14:09:46 -07:00
Sebastian Schmidt 296a1ea1da Reset backoff when connectivity status changes (#5857) 2020-06-22 15:49:12 -07:00
Paul Beusterien e15724a436 Migrate from interop pods to source_files header access (#5760) 2020-06-09 06:09:27 -07:00
Paul Beusterien d4621a636f Use preserve_paths instead of CocoaPods private (#5758) 2020-06-09 05:21:28 -07:00
Gil e462d04ddb Make Executors have deterministic shutdown (#5547)
In particular:

  * All tasks are guaranteed to either run to completion or not run at all;
  * Executors can now be destroyed from the threads they own (if applicable); and
  * Many common concepts between the Executor implementations have been harmonized and shared.

Note:

  * This change does not yet implement `Executor::Dispose` or clean up any of the higher level componentry to take advantage of these changes.
  * The executors implement shutdown by canceling any tasks that haven't started yet. This diverges from the plan (which called for a separate `UserCallbackExecutor` to handle this), but in the end it turns out to be simpler to just cancel everything and make cancel handle tasks-in-progress in a reasonable way. LMK if you have grave objections to this, in which case I can rework this.

This is the foundation for addressing firebase/quickstart-unity#638.
2020-05-18 08:30:02 -07:00
Gil b57f8b2ce6 Add defer, a general facility for ad-hoc RAII. (#5554) 2020-05-13 10:29:58 -07:00
Denver Coneybeare df3679275c Add an integration test for calling clearPersistence() on a newly-created Firestore instance. (#5515) 2020-05-04 14:55:17 -04:00
Paul Beusterien 88f49a8bf6 Fix Firestore build broken by M70 version changes (#5498) 2020-04-28 16:49:53 -07:00
Paul Beusterien 68513286e3 Update nanopb to 0.3.9.5 (CocoaPods 1.30905.0) (#4264) 2020-04-27 17:09:59 -07:00
Gil e3f3a78aef Remove the Firestore_SwiftTests_iOS target (#5458)
The tests in this target are already covered by
Firestore_IntegrationTests_iOS and also run on the other platforms
through the other platform variants of this target.

Also remove an explicit override of CLANG_WARN_COMMA in the
Firestore_Example_macOS target. This should have been cleaned up earlier
--no other targets have this setting.
2020-04-26 15:01:42 -07:00
Gil 1df5574c4f Upgrade gRPC-C++ to 1.28.0 (#4312)
This unblocks nanopb changes proposed in #4264.

This upgrades everything in the gRPC constellation of dependencies to match gRPC at 1.28:

  * gRPC to 1.28.0 (note that gRPC 1.28.1, while released, is a fix for just the python binding and there's no gRPC-C++ CocoaPod at that version)
  * Abseil to 20200225 (as of gRPC 1.27 this is now a gRPC dependency too; there's a later patch but gRPC doesn't use it yet)
  * Protobuf C++ to 3.11.4 (only used for testing in Firestore)
  * C-Ares to 1.15.0
  * BoringSSL to match (no change between gRPC 1.27.0 and 1.28.0)

Also, this disables CFStream-based transport on Apple platforms. This works around b/133182964, wherein CFStream will occasionally fail to raise a has-bytes-available events, causing Firestore to appear to hang.
2020-04-22 14:03:34 -07:00
Gil 7a58eba2e5 Remove firebase/firestore from paths in Firestore/core (#5374)
* Manual Xcode project fixups

* Remove `firebase/firestore` from paths in Firestore/core

This renames all Firestore files under `Firestore/core` to remove the
interior `firebase/firestore` directory structure. This is motivated by
build failures under Windows where the filenames of intermediates were
too long.

Concretely:

  * `Firebase/core/src/firebase/firestore` becomes `Firebase/core/src`
  * `Firebase/core/test/firebase/firestore` becomes
    `Firebase/core/test/unit`

Moving the tests into a `unit` subdirectory aligns Firestore with the
directory structure in
[AddNewPod](https://github.com/firebase/firebase-ios-sdk/blob/master/AddNewPod.md),
modified for C++ (see discussion in #3224).
2020-04-20 14:57:34 -07:00
Gil 74f4ceb4c9 Fix unused variable warnings (#5389)
* Fix unused variable warnings

These are now exposed because libprotobuf is no longer polluting the
compiler command-line with -Wno-unused-parameter.

* Convert (void)var to __unused where possible
2020-04-20 14:23:36 -07:00
Gil 314f137bd5 Shorten CMake Objective-C targets (#5323)
* Shorten firebase_firestore_example_app

... and:
  * Migrate to firebase_ios_add_executable
  * Use globs for specifying sources

* Migrate Example/Tests/API to new CMake primitives

* Migrate Example/Tests/Integration to new CMake primitives

* Migrate Example/Tests/SpecTests to new CMake primitives

* Migrate Example/Tests/Util to new CMake primitives

Rename firebase_firestore_objc_test_util to firestore_objc_testing.

* Migrate fuzzing to new CMake primitives

Rewrite firebase_ios_cc_fuzz_test to match the other primitives.

* Add firebase_ios_add_objc_test

* Migrate Example/Benchmarks to new CMake primitives
2020-04-20 10:28:36 -07:00
Brian Chen 26430a9086 Check for error code matches in Transaction tests (#5391) 2020-04-16 09:12:42 -07:00
Brian Chen 0a352472a8 Fix flaky transaction tests (#5334) 2020-04-15 14:51:11 -07:00
Gil c873af8038 Shorten CMake test targets/begin firebase_core consolidation (#5321)
* Add new, simpler CMake helper functions

... making them more like built-in functions. This makes it possible to
combine other CMake functions in ways that weren't possible with the
original all-in-one approach.

This includes:
  * firebase_ios_add_executable
  * firebase_ios_add_test
  * firebase_ios_add_library

All of which can be combined with target_link_libraries, etc.

* Shorten CMake test targets, e.g. firebase_firestore_util_test => firestore_util_test

* Remove CMake file inclusion check

Now that we're committed to using globs for finding sources, this check
is incompatible and no longer useful.
2020-04-15 11:02:56 -07:00
Denver Coneybeare cd6d0f1c1d Implement limbo resolution listen throttling (#5310) 2020-04-15 12:01:09 -04:00
Gil 77f92cd2c6 Stop using built-in CMake Framework support (#5316)
* Fix previously unknown warnings

These become visible once flags are handled uniformly across all
Firestore targets in an upcoming build change.

* Stop using built-in CMake Framework support

CMake has built-in support for building Framework bundles (briefly:
bundles of libraries, associated headers, and resources) but this
doesn't work well for our needs.

1. In CMake 3.5.1 (our earliest supported CMake version) it doesn't copy
headers properly at build time.

2. Even up to CMake 3.15.5, CMake doesn't handle link-line multiplicity
correctly. CMake passes the static library location within the framework
and this seems to cause the linker to mishandle Objective-C metaclass
information resulting in duplicate symbols. Building with `-framework`
flags works correctly.

Previously we partially worked around the latter problem by building
some frameworks as shared instead of static frameworks, but this is
problematic because this mode of operation isn't actually intended and
is unsupported as far as the rest of Firebase is concerned. This turned
out to be fragile though and while refactoring libraries this workaround
broke.

Rather than piling on additional workarounds, this change converts the
frameworks to simple library targets and emulates framework imports
through include paths.

Additionally, this starts refactoring our cmake helper functions to make
them more like built-in functions. This makes it possible to freely use
different CMake features that were made difficult by trying to wrap
everything up in a single CMake command.

* style.sh generated changes

* Review feedback

* More review feedback
2020-04-14 08:40:33 -07:00
Denver Coneybeare b05e9eb68d Update spec tests from changes in the firebase-js-sdk respository (#5278) 2020-04-07 10:10:26 -04:00
Gil af7898c01e Merge remote_test_util and remote_testing libraries (#5254)
These two libraries duplicate each other in purpose:

  * firebase_firestore_remote_test_util
  * firebase_firestore_remote_testing

Additionally, several of the testing utilities in remote_test_util are
really only applicable to tests in the remote library anyway. These have
been put directly into firebase_firestore_remote_test.
2020-04-03 15:57:07 -07:00
Paul BeusterienandMarek Gilbert 4ea4340285 Upgrade clang-format (#5265)
Co-authored-by: Marek Gilbert <mcg@google.com>
2020-04-03 11:38:31 -07:00
Denver Coneybeare cb80ee63eb Log the total pass and skip count after running all spec tests (#5202) 2020-03-27 11:56:24 -04:00
Denver Coneybeare 4ae6f30c4d Add ability to selectively run spec tests via an environment variable. (#5203) 2020-03-27 08:24:14 -04:00
Gil 0bb454e12b Remove Firestore/Example/App/Testing submodule, accidentally added in #4046 (#5208) 2020-03-26 10:50:09 -07:00
Gil a568a96f7e Add iOS build support to the CMake build (#5052)
* Use early exit in objc_framework CMakeLists.txt

* Clean up objc_framework CMakeLists.txt

  * Use `version` consistently
  * Use `firebase_ios_version` for the repo-level version
  * Remove INCLUDE directories that are no longer needed
  * Sort dependencies

* Simplify Example/App/CMakeLists.txt

  * Add `OBJC_FLAGS` directly, avoiding a separate `sources` variable.
  * Add resources directly

* Rename test host app to firebase_firestore_example_app

* Add a firebase_ios prefix to functions and variables

This reduces the chance of collision with other projects.

* Simplify compiler_setup

Now that compiler_setup.cmake no longer has side-effects, fold
compiler_id.cmake and archive_options.cmake into it and move
the include of compiler_setup up to the top of the main build.

* Add support for building for iOS

* Make building benchmarks optional

* Disable protoc-based source generators when cross-compiling

* Make downloading googletest optional

* Add DISABLE_STRICT_WARNINGS mode to cc_rules

This makes it possible to build non-Firestore components in the CMake
build to a lower standard than that to which we hold ourselves without
sacrificing the utility of the various build rules that we have.
2020-03-13 08:22:11 -07:00
Gil e404054a9f Refactor and clean up the CMake build ahead of CMake/iOS support (#5051)
* Use early exit in objc_framework CMakeLists.txt

* Clean up objc_framework CMakeLists.txt

  * Use `version` consistently
  * Use `firebase_ios_version` for the repo-level version
  * Remove INCLUDE directories that are no longer needed
  * Sort dependencies

* Simplify Example/App/CMakeLists.txt

  * Add `OBJC_FLAGS` directly, avoiding a separate `sources` variable.
  * Add resources directly

* Rename test host app to firebase_firestore_example_app

* Add a firebase_ios prefix to functions and variables

This reduces the chance of collision with other projects.

* Simplify compiler_setup

Now that compiler_setup.cmake no longer has side-effects, fold
compiler_id.cmake and archive_options.cmake into it and move
the include of compiler_setup up to the top of the main build.
2020-03-10 20:50:13 -07:00
Gil d9b7a33f0c Use forward declarations instead of IWYU (#4868)
* Remove rarely used template argumnets from SortedMap/SortedSet

* Remove unused STATUS_CHECK_OK

* Rename QuerySnapshot::Listener to QuerySnapshotListener

This makes the type something that can be forward declared.

* Rename DocumentSnapshot::Listener to DocumentSnapshotListener

This makes the type something that can be forward declared.

* Rename ViewSnapshot::Listener to ViewSnapshotListener

This makes the type something that can be forward declared.

* Put most QueryListener implementation in .cc

* Actually use sync_engine_callback.h

* Add forward declaration headers for api, core, and model

These centralize forward declarations, including declarations for some
hard-to-forward-declare types.

* Move includes of hard_assert.h out of other headers

* Make testutil definitions out of line

* Move definitions out-of-line

* Move DocumentKey definitions out-of-line

* Move definitions out-of-line

* Shorten unnecessarily long namespace usages

* Use default destructors where possible

* Delete unused MutationBatch::kUnknown constant

* Use forward declarations instead of IWYU

* Misc fixups from Linux/GCC 9.2.1

* Fix testutil under VS 2017

Forward declarations of functions local to a function body end up
generating unresolved externals. Reduce most of these back to just
calling FieldValue::FromX methods.
2020-02-15 14:34:38 -08:00
Gil f321ad85a9 Decode documents in a background thread (#4857)
* Add Index-free benchmarks

* Add BackgroundQueue

Port of firebase/firebase-android-sdk#559

* Decode documents in background threads to improve performance

Run on (12 X 2900 MHz CPU s)
CPU Caches:
  L1 Data 32K (x6)
  L1 Instruction 32K (x6)
  L2 Unified 262K (x6)
  L3 Unified 12582K (x1)
Load Average: 2.24, 2.18, 1.96
----------------------------------------------------------------------------------
Benchmark                           Time             CPU   Iterations  Improvement
----------------------------------------------------------------------------------
BM_QueryMatching/0/1              132 us         12.7 us        53524        21.4%
BM_QueryMatching/1/1              150 us         18.1 us        37305        16.2%
BM_QueryMatching/1/10             371 us         27.6 us        10000        48.5%
BM_QueryMatching/10/10            429 us         64.3 us        11349        41.0%
BM_QueryMatching/1/100           2573 us         29.0 us         1000        51.7% (max)
BM_QueryMatching/100/100         3123 us          416 us         1000        45.5%
BM_QueryMatching/1/1000         26785 us         33.5 us          100        50.5%
BM_QueryMatching/10/1000        28389 us         74.5 us          100        48.0%
BM_QueryMatching/100/1000       27883 us          470 us          100        49.4%
BM_QueryMatching/1000/1000      32189 us         34.3 us          100        44.8%
BM_QueryAll/1                     151 us         15.2 us        45385       -49.5% (min)
BM_QueryAll/10                    444 us         60.7 us        12829        32.5%
BM_QueryAll/100                  3175 us          414 us         1000        45.1%
BM_QueryAll/1000                30222 us         18.8 us          100        49.7%
Mean                                                                         35.3%

* Insert into a vector to reduce contention

Run on (12 X 2900 MHz CPU s)
CPU Caches:
  L1 Data 32K (x6)
  L1 Instruction 32K (x6)
  L2 Unified 262K (x6)
  L3 Unified 12582K (x1)
Load Average: 1.43, 2.10, 1.98
----------------------------------------------------------------------------------
Benchmark                           Time             CPU   Iterations  Improvement
----------------------------------------------------------------------------------
BM_QueryMatching/0/1              127 us         12.2 us        56131         3.8%
BM_QueryMatching/1/1              142 us         16.6 us        39200         5.3%
BM_QueryMatching/1/10             369 us         26.6 us        10000         0.5%
BM_QueryMatching/10/10            425 us         59.2 us        12724         0.9%
BM_QueryMatching/1/100           2194 us         28.9 us        10000        14.7%
BM_QueryMatching/100/100         2765 us          405 us         1000        11.5%
BM_QueryMatching/1/1000         21095 us         32.8 us         1000        21.2%
BM_QueryMatching/10/1000        20797 us         66.4 us         1000        26.7% (max)
BM_QueryMatching/100/1000       21915 us          408 us         1000        21.4%
BM_QueryMatching/1000/1000      23700 us         30.9 us         1000        26.4%
BM_QueryAll/1                     136 us         14.3 us        44799         9.9%
BM_QueryAll/10                    443 us         57.3 us        10000         0.2% (min)
BM_QueryAll/100                  2607 us          389 us         1000        17.9%
BM_QueryAll/1000                23512 us         19.4 us         1000        22.2%
Mean                                                                         13.1%
2020-02-15 11:09:25 -08:00