* 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
* 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.
* 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
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.
* 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.
* 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.
* Don't bother searching for XCTest on non-Apple platforms
* Force working directory to be in the project root
This makes the spec tests work when cmake is invoked with a relative filename.
* Fix build error on Linux/GCC 7.4.0
This moves iOS and macOS user data from `NSDocumentDirectory` to `NSApplicationSupportDirectory`, adding a pre-open migration step that:
* Moves old data into the new location
* Cleans up any resulting empty directories in the old Documents folder
* Stops before removing the Documents folder itself (see tests)
Note that other platforms don't need a migration:
* tvOS was already storing documents in `NSCachesDirectory`
* Linux, Windows, and other UNIX haven't been publicly released or aren't changing.
See individual commits for details. Most notably this adds some additional filesystem manipulation routines to our (sadly) growing library.
Fixes#843.
This change does not yet change all the classes that use the filesystem
to take Filesystem as a dependency. Those changes will come in follow-up
PRs.
This change is motivated by feedback in #4609. There I had created a
complicated interface to LevelDbOpener just so that different migration
scenarios could be tested, when in reality, I just needed to be able to
plumb through different values for the result of AppDataDir and related
functions.
* Remove unused -[FIRFirestore isLoggingEnabled]
Use util::LogIsLoggable(util::kLogLevelDebug) directly.
* Remove objc_compatibility.h
* Remove/cleanup unused #if __OBJC__ blocks
* Remove dead code
* Remove MakeNSStringNoCopy
* Remove worthless include
* Tidy up FIRFirestore
* Remove dead code and use forward declarations in FSTHelpers
* Minor fixes for LevelDbTransaction:
* Make methods const where possible
* Make key() and value() return const std::string&, allowing callers
to create their own const references
* Remove Comparator<NSString*>
* [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.
* Change string parameters from absl::string_view to std::string
No abseil types can be used as parameters in this package.
This fixes an issue where Unity builds fail due to missing symbols.
The underlying issue is that Abseil in CocoaPods is an LTS release and
LTS releases contain an inline namespace, making types like
absl::string_view link as absl::lts_2019_08_08::string_view. When
compiling Firestore in google3 it uses the abseil in //third_party/absl,
which is not an LTS release and does not include the inline namespace.
This disagreement causes issues for the public C++ API which is compiled
in google3 and consumes code in the API package.
* Avoid absl::any in interfaces shared with public C++
* Make resource-related methods class members
This gives them access to private methods of friends of Serializer.
* Access control FieldPath/ResourcePath construction
* Access control Document construction
* Access control FieldValue construction
* Access control TransformOperation methods
* Remove DocumentSnapshot constructor that takes metadata pieces individually
* Restrict access to DocumentSnapshot from optional<Document>
* Add comments indicating how Abseil types are restricted
* Make DocumentKey::FromPathString take std::string
* 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