* 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 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
* 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.
* 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
* [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.
* Rationalize input validation exceptions and assertions
... under a single ThrowHandler concept. This makes it possible to set
an alternative ThrowHandler in our C# bindings that properly translates
input validation exceptions to the correct .NET exception types.
* Rename api/input_validation.h to util/exception.h
* Reimplement util/hard_assert.h in terms of util/exception.h
* Rewrite Document-related classes as a polymorphic value type
* Pass ObjectValue without rvalue references
* Rename HasLocalMutations
* Port C++ users to new Documents
* Port FSTDocumentTests to C++
* Port FSTDocumentSetTests to C++
* Migrate DocumentMap and DocumentSet to C++ Document
* Migrate test helpers
* Delete FSTDocumentSetTests
* Delete FSTDocumentTests
* Mechanical changes to use C++ Document
* Updates to the project file
* Nontrivial test updates
* Remove FSTTestDeletedDoc
* Remove FSTTestUnknownDoc
* Remove FSTDocument
* Convert usage of FSTDocument to C++ Document
* Fix Serializer usage of Documents
* Port FSTSortOrder to C++ OrderBy
* Finish port of C++ Direction from Android
* Reimplement FSTSortOrder with C++ OrderBy
* Migrate FSTSortOrder to C++ OrderBy
* Remove FSTSortOrder
* Compare OrderBy equality in C++ Query
* Add FieldValue::Reference
* Migrate FSTReferenceValue to FSTDelegateValue
* Build Objective-C components with CMake
Build only the things required for FSTFieldValue
This is safer and better matches our design (and the other platforms), since
classes like api::DocumentReference will have references to api::Firsetore but
the lifetime is controlled by the developer, not us.
use namespace aliases instead.
This makes the Objective-C code much more like what it's going to end up
being like when translated to C++: headers will include classes declared
in a namespace relative to firebase::firestore so everything else will
be named relative to firebase::firestore.
Meanwhile the using statements in the headers were causing us to miss
adding using statements in source files which was moving us away from
where we wanted to be.
Note:
* This includes a partial port of array-contains for Filters because
this silenced a warning about an unhandled case
* There's some sensitivity to the order of the cases that I didn't
bother to figure out; instead I just made it match what came before.
* Fix a couple small issues I tripped over today.
1. Fix primeBackend so it uses an isolated FIRFirestore* instance. I ran into
an issue where tests that try to change .settings would fail if they were the
very first test run, since primeBackend had already configured the client and
so settings could no longer be changed.
2. Remove FIRFirestore.client and make api::Firestore.client() assert client is configured.
Previously, we checked for FSTFieldValue subtypes via:
`[value isKindOfClass:[FSTStringValue class]]`
Now, we check via a new type parameter on FSTFieldValue, i.e.:
`value.type == firebase::firestore::model::FieldValue::Type::String`
Or with the appropriate using declaration:
`value.type == FieldValue::Type::String`
This should enable easier transition to C++.
* Test that shows a leak.
* Add EventListener to match Android.
* Use AsyncEventListener in FSTQueryListenerTests
* Remove FSTAsyncQueryListener
* Use EventListener throughout
Without this, it still fails, but:
a) not until serializing the query, and
b) the error is an internal error, and
c) the error message is quite cryptic and has nothing to do with the problem.
Port of https://github.com/firebase/firebase-android-sdk/pull/138
Rather than previously inlining it in the calling code. This is to unify
filter creation across platforms.
(This change involves altering FSTFilter from a protocol to an abstract
class.)
FSTDispatchQueue enforces serial execution, which is inappropriate for
user queue, because a user may configure usage of a concurrent queue in
settings, breaking FSTDispatchQueue invariants. Instead, use C++
ExecutorLibdispatch directly.