* 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.
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.
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.
* 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).
* 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
* 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
* 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
* 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.
* 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.
* [1/4] Split Query and Target, and make LocalStore/RemoteStore work with Target. (#4413)
* [2/4]LimitToLast: Make SyncEngine work with Target (#4491)
* [3/4] Implement LimitToLast (#4505)
* Fix use after move in LevelDbPersistenceForTesting
* Fix size-related errors when compiling in 32-bit mode
* Fix test-only memory leaks
* Fix test-only memory leaks
* Prevent spec tests from appearing to leak
The spec tests aren't actually leaking, but they accumulate enough
garbage without clearing the autorelease pool that Instruments
complains.
* Avoid temporaries in methods that @throw
ARC does not release temporaries when an Objective-C exception is
thrown. Use C++ equivalents directly to avoid leaks as detected by
Instruments.
* Fix memory leak in acknowledge mutation
Any previous value must be freed before the next one is assigned.
* Manually implement assignment operators in ByteString
The single by-value implementation wasn't preventing the compiler
generated standard versions from being generated which was causing
leaks.
* Prevent leaking GrpcCompletions that complete after Shutdown
After shutdown, the AsyncQueue silently drops Enqueue requests which
prevents these blocks from being deleted.
* Avoid racing with enqueued operations
It's possible for the Executor to immediately execute the given block,
at which point the block might observe the async queue in a
not-shutting-down state.
* Add Objective-C API tests to the CMake build
* Fix signedness warnings under the CMake build
* Get the remainder of Objective-C tests running under CMake
Also:
* Add a Path::HasExtension check
* Change spec tests to pick up json without NSBundle
* Add Executor::CreateSerial
... a standard way to create an Executor for most cases where we don't
care about the implementation.
* Add ExecutorForTesting/AsyncQueueForTesting
Uses Executor::CreateSerial to do the heavy lifting.
* Use AsyncQueueForTesting
* Avoid direct references to ExecutorLibdispatch in prod code
* Rewrite time_testing in terms of absl::Time
* Migrate async_test_util's now to time_testing
* Fix AddressSanitizer stack-buffer-underflow error
This was reading random data off the stack until it hit a negative
integer's worth of data. The test passed because this was generating the
input and expected values, which were much longer than expected given
the input.