* 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
* 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
* Rename transform_operation{s,}
* Convert TransformOperation to a polymorphic value class
* fixup! Convert TransformOperation to a polymorphic value class
* Remove ServerTimestampTransform::Get
* Add FieldValue::Reference
* Migrate FSTReferenceValue to FSTDelegateValue
* Build Objective-C components with CMake
Build only the things required for FSTFieldValue
... based on things learned porting Timestamps.
There's no good way to include conversions equivalent to toGeoPoint in
FIRTimestamp, so pull out separate conversion functions that match other
similar things.
* Rename nanopb::String to nanopb::ByteString
... and flesh it out.
* Remove const pb_bytes_array* constructor
* Use std:: prefixes
* Pull forward CopyVector
* Simplify nanopb::Reader/Writer construction
* Reuse ByteString construction in serializer
* Add nanopb_testing.h
* Make QueryData.resume_token a ByteString
* Use ByteString as FieldValue::blob_value
* Migrate FSTBlobValue to FSTDelegateValue
* Rework the ByteString API
* Make data(), begin(), and end() never return nullptr
* Make copies of pb_bytes_array_t* more obvious (also avoids ambiguity
with the private constructor).
* Remove constructors that duplicate absl::string_view
* Make ByteString::Copy just a constructor
* Remove EncodeBytes/DecodeBytes
These duplicate ByteString constructors
* Overhaul ByteString and users
* Remove most conversions from ByteString
* Put remaining conversions in nanopb_util as free functions
* Make ByteStringWriter accumulate in a pb_bytes_array_t*
* Have ProtobufSerialize use ByteStringWriter
* Avoid reserving/writing if we're not asked to append data
* Ensure ByteStringWriter initializes/frees
* Make copies explicit
* Make Reserve match std::vector::reserve
* Add comments, assertions, and tests
* Migrate FSTNullValue to FSTDelegateValue
* Migrate FSTIntegerValue to FSTDelegateValue
* Migrate FSTDoubleValue to FSTDelegateValue
* Migrate FSTGeoPointValue to FSTDelegateValue
* Remove stale references to DatabaseId
* Have Firestore take the DatabaseId directly
* Allow tests to default the database implicitly
* Have FSTSerializerBeta take DatabaseId by value
* Have FSTUserDataConverter take DatabaseId by value
* Make FIRFirestore.databaseID a const reference
* Make FSTFirestoreClient.databaseID a const reference
* Have FSTReferenceValue take DatabaseId by value
* Have DatabaseInfo take DatabaseId by value
* Have Serializer take DatabaseId by value
* Fix C++ ReferenceValue
* Take DatabaseId by value
* Reverse order to match Android
* Rename `reference` to `key`
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.
* Fix FSTFieldValue instanceof check to use FSTFieldValue.type
Missed in the previous PR because this gets the class via [value class]
rather than [value isKindOfClass].
* Add FSTDelegateValue which delegates to model::FieldValue
Also migrates FSTBooleanValue to FSTDelegateValue as a proof-of-concept.
Other FSTXValues still TODO.
Extract useful bits of FSTUserDataConverter for use in C++:
* Migrate FSTParsedSetData to core::ParsedSetData
* Migrate FSTParsedUpdateData to core::ParsedUpdateData
* Migrate FSTParseContext to core::ParseContext
* Split ParseAccumulator out of ParseContext to make ownership easier
Also:
* Remove dead code (handled in parseSentinelFieldValue)
* Flatten App/iOS/Supporting Files into the parent
This includes the new FIRFieldValue sentinels, the FSTUserDataConverter code to parse them into internal ArrayTransform operations for use in an FSTTransformMutation, and some sanity testing in FSTMutationTests.
I still need to implement FSTTransformMutation support for local application and serialization (and then integration tests).
* port FieldMask to C++
* address changes
* address changes
* fix test
* address change
* Port transform operations (FSTTransformOperation, FSTServerTimestampTransform) to C++
* address changes
* address changes
* address changes
* implement `FieldTransform` in C++
* port `FieldTransform`
* make `fieldTransforms` shared inside `context`
* Implement Precondition in C++ w/o test yet
* add unit test for `Precondition`
* port `Precondition`
* address changes
* address changes
* fix bugs for integration test
* address changes
* fix lint
* address changes
* address changes
* naively remove FSTPath import and source/test files.
* port FieldPath, part I
* port FieldPath, part II
* port ResourcePath, part I
* port ResourcePath, part II
* the grand commit to fix build errors
* use testutil:: helper instead of those from FSTHelpers
* fix test and lint
* use c_str in errmsg directly
* fix
* fix
* make code clean
* fix integration test I missed
* fix to avoid naming collision in preprocessor
* address changes
* address changes
* address changes
* fix: fieldMask are actually shared with different context.
* address changes
* address changes
- FSTTimestamp is now FIRTimestamp, under Firestore/Source/{Public,API}. This is a temporary solution; eventually, FIRTimestamp is supposed to live somewhere under Firebase;
- move most internal Timestamp methods to the public header (the only exception is ISOString).
* implement Firestore DatabaseInfo in C++
* temporary stash changes; blocking on the massive renaming of .m to .mm
* add database_info_test to project
* finish port DatabaseId and fix style, modular fixing DatabaseInfo
* port DatabaseInfo
* remove FSTDatabase{ID,Info} and their tests from project
* fix unit test
* use namespace alias
* use namespace alias, leftover
* address more changes
* refactoring to use raw pointer instead of value for property
* address changes
* remove self->
* fix style
* remove the name suffix Alloc
* fix a bug
* Move all Firestore files to Objective-C++
* Update project file references
* Don't use module imports from Objective-C++
* Use extern "C" for C-accessible globals
* Work around more stringent type checking in Objective-C++
* NSMutableDictionary ivars aren't implicitly casted to NSDictionary
* FSTMaybeDocument callback can't be passed a function that accepts
FSTDocument
* NSComparisonResult can't be multiplied by -1 without casting
* Add a #include <inttypes.h> where needed
* Avoid using C++ keywords as variables
* Remove #if __cplusplus guards