Commit Graph
217 Commits
Author SHA1 Message Date
wu-hui 2f53582530 Various minor fixes to make SDK compile on Linux (#4185) 2019-11-04 14:39:44 -05:00
Gil 3ea7197090 Port FSTQueryCacheTests to C++ (#4160)
* Move FSTQueryCacheTests files to Firestore/core

* Rewrite QueryCache tests in C++

* Fix test flake in local store tests

This doesn't affect production because we always set the additional
references pointer there, but it's technically optional and some tests
don't do this.
2019-11-02 09:09:25 -05:00
Konstantin Varlamov 8b23a3266d Remove Objective-C serializers and make local/ and remote/ (almost) fully C++ (#4151)
There are more sources that can be `.cc` now (e.g., in API); these are left for a follow-up PR.

The dependency on Objective-C proto library cannot be removed just yet due to current lack of pretty-printing support for Nanopb.
2019-10-23 20:56:44 -04:00
Gil 6fd815a5ed Port FSTRemoteDocumentCacheTests to C++ (#4136) 2019-10-23 12:28:16 -07:00
Gil 3f1fbe7e9a Migrate FSTPersistenceTestHelpers to C++ (#4122)
* Move FSTPersistenceHelpers to core/test/.../local

* Rewrite persistence_testing in C++

* Migrate from FSTPersistenceTestHelpers to C++ persistence_testing

* Rename .mm to .cc where possible in IndexManager tests

* Remove Objective-C gunk from index_manager_test.h
2019-10-21 20:12:46 -07:00
Konstantin Varlamov 0f2a0bfeef Use C++ serializer for communicating with the backend (#4013)
Replace all uses of `FSTSerializerBeta` in `remote_objc_bridge.{h,mm}` with the C++ `Serializer`. Also, make most of `remote/` sources pure C++ and remove no-longer-used methods in `FSTSerializerBeta`. All integration tests pass, under Address Sanitizer as well.

Unfortunately, pretty-printing is still delegated to Objective-C, so that `remote_objc_bridge.mm` still has to be an Objective-C++ source (and which prevents inlining `remote_objc_bridge` into the streams).

#no-changelog Will add a changelog entry when local serializer is ported, too.
2019-10-18 17:58:14 -04:00
Paul Beusterien d8e3a11bb1 Restore Firebase pod to closed source location (#4112) 2019-10-17 09:45:04 -07:00
Gil f32cc12ce0 Build Firestore with Xcode 11 (#4005)
* Drop dependency on OCMock

* Move Firestore onto Xcode 11 in Travis

* Special case simulators based on Xcode version, not product

This allows Firestore's build with Xcode 8.3.3 to continue to work.

* Make the Firestore Podfile install only one platform at a time

Use the PLATFORM environment variable to limit which targets are
modified. This makes the selected platform work but leaves the other
platforms in a broken state in the Xcode UI.

* Fix code signing errors on macOS builds
2019-10-07 08:46:06 -07:00
Gil 11de159e8e Migrate FSTRemoteEventTests to C++ (#3965)
* move (unchanged) into Firestore/core

* split out TestTargetMetadataProvider

... also rename to not start with "test".

* rewrite in C++
2019-10-04 11:55:20 -07:00
Gil 1a004119fa Project updates for recently added/moved files (#3994)
Occasionally Xcode will save these out--I can't predict when.
2019-10-03 16:02:14 -07:00
Sebastian Schmidt 41c411e8f4 Add QueryData.with() helpers (#3991) 2019-10-03 14:52:12 -07:00
Gil b37ab3b433 Migrate FSTViewSnapshotTests to C++ (#3919)
* view_snapshot_test: move (unchanged) from FSTViewSnapshotTest.mm

* view_snapshot_test: automated changes

* view_snapshot_test: sync_project.rb generated changes

* view_snapshot_test: manual fixes

* view_snapshot_test: shorten DocumentViewChange::Type
2019-09-30 19:55:03 -07:00
Gil 7d06d34e05 Migrate tests written as C++ into the C++ tree (#3917)
* field_transform_test: move into Firestore/core

* field_transform_test: project changes

* transform_operation_test: move into Firestore/core

* transform_operation_test: project changes
2019-09-30 18:07:59 -07:00
Gil 62c4fa30d2 Migrate FSTQueryListenerTests to C++ (#3901) 2019-09-30 13:17:53 -07:00
Gil 9ec602efcb Migrate FSTViewTests to C++ (#3900)
* Add view testing utilities

* Copy FSTViewTests.mm to view_test.cc unchanged

* Migrate FSTViewTests to C++
2019-09-30 11:26:42 -07:00
Gil 3185ff61d5 Add Expectations and Async/Await for testing (#3899)
* Add Expectations and Async/Await for testing

* Migrate async tests to Expectations and Async/Await
2019-09-27 12:25:34 -07:00
Gil 971445ce35 Add cross-platform support for creating Executors (#3897)
* 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.
2019-09-26 10:41:36 -07:00
wu-hui 1ce982de85 Port FSTSyncEngine to C++ SyncEngine 2/2 (#3741) 2019-09-05 18:40:58 -04:00
Konstantin Varlamov 5da6b69a7d Fix accessing a destroyed object (#3721)
This was caused by running under Asan with XCode 11. Apparently, previous versions of XCode cannot catch it (which is why Travis is passing, apparently).

Also:
* enable "Detect use of stack after return" option for Asan. AFAIU, it can only be enabled in the scheme. It's already enabled for unit tests, this PR additionally enables it for integration tests;
* make Asan failures fail Travis build. They were originally not considered blocking due to some sporadic failures. I haven't seen those for some time, and worst case scenario, we can revert this change.
2019-08-29 14:14:09 -04:00
Gil 83b4e7cb57 Change many Firestore/core .mm files to .cc (#3591)
Rename .mm files .cc where all Objective-C has been removed
2019-08-19 10:44:57 -07:00
Gil aefd4323a2 Remove Objective-C immutable sets and maps (#3590)
* Remove Firestore/third_party/Immutable

* Update podspec and sync_project

* Project updates
2019-08-19 09:09:20 -07:00
Gil dd7fbf885e Migrate FSTMutationTests to C++ (#3571)
* Tidy up mutation_test.cc ahead of filling it out

* Move FSTUserDataConverter tests out of FSTMutationTests

* Add operator<< for Document

The compiler won't apply the one for MaybeDocument.

* Port FSTMutationTests to C++

* Delete FSTMutationTests
2019-08-19 08:21:43 -07:00
Gil 0c23f38397 Migrate Objective-C document types to C++ (#3531)
* 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
2019-08-13 13:59:00 -07:00
Gil 5c19bc26a5 Migrate FSTQueryTests to C++ / remove FSTQuery (#3485)
* Use C++ Documents in FSTQueryTests

* Fix FieldPath::kDocumentKeyPath definition

* Add missing operator<< to Document and DocumentKey

* Migrate FSTQueryTests.mm to C++ query_test.cc

* Remove FSTQueryTests

* Remove FSTQuery
2019-08-02 13:23:58 -07:00
Gil 2700b6101e Add AppendOnlyList (#3457)
* Add AppendOnlyList

* Avoid iterator invalidation
2019-08-01 10:21:29 -07:00
Gil 2acc073636 Remove vector_of_ptr (#3458) 2019-07-30 07:10:28 -07:00
Gil 05e734b2b7 Refactor Filters (#3359)
* Rename relation_filter.{h,cc} to field_filter.{h,cc}

* Rename RelationFilter to FieldFilter

* Move Filter::Create to FieldFilter

* Port api::Query::ValidateNewFilter

* Add ArrayContainsFilter

* Add KeyFieldFilter

* Make FieldFilter constructor protected

* Port FieldFilter refactor from the JS SDK

https://github.com/firebase/firebase-js-sdk/pull/1894

* Add spec test from firebase/firebase-js-sdk#1913

* Accept array-contains as a synonym for array_contains
2019-07-20 14:02:52 -07:00
Gil 96724cdc28 Finish porting FSTFilter classes to C++ Filter classes (#3352)
* Implement RelationFilter::CanonicalId()

* Add NanFilter

* Add NullFilter

* Implement Filter equality

* Add ToString() to Filters

* Add IsInequality() to Filters

* Port the rest of RelationFilter's matching

* Implement Filter::Hash
2019-07-14 16:57:13 -07:00
Gil 2e2208bcdc Start reimplementing FSTQuery with C++ query (#3346) 2019-07-13 13:53:15 -07:00
Gil 0de0a54650 Enable incremental pod installs and fix incremental builds (#3345)
* Enable incremental CocoaPods installation

* Disable input/output path checking for generated frameworks

... to make incremental builds work properly. Without this, changes to
the framework may not be picked up in between test runs.

This does make incremental builds slightly slower, but not by much.

* Standardize on DWARF debug symbols for Debug builds

Configure this once at the project level and remove customizations.

This speeds up link times because it avoids needing to separately
generate dSYM bundles for our executables.
2019-07-13 08:24:05 -07:00
Gil 37affc1eb4 Have Firestore integration tests run all tests (#3342)
* Rename FIRQueryTests to FIRQueryUnitTests

* Make IntegrationTests targets run everything

The incremental cost of running all tests is an extra two seconds of run
time, but not starting the simulator three times during a build cuts
build times by ~25%.

* sync_project.rb generated changes

* sync_project.rb generated changes

* Remove AllTests_iOS aggregate target

* Add unit test deps to Firestore_IntegrationTests_*

* Fix BasicCompileTests on macOS and tvOS

* Run Firestore IntegrationTests only on Travis

This cuts build time for the job by about 25%, primarily due to not
having to start/deploy to the simulator repeatedly.
2019-07-12 15:57:03 -07:00
Gil 6ea0fbd950 Manage resources with sync_project.rb (#3340)
* Sync resources

Apply ignored files to target contents too.

* Clean up macOS host app

resources/roots.pem does not exist
2019-07-12 10:17:33 -07:00
Gil 79627a22cc Add Swift integration tests to macOS and tvOS builds (#3336)
* Add deployment_targets for macOS and tvOS in FirebaseFirestoreSwift

* Add FirebaseFirestoreSwift as a dependency to all integration tests

* Add swift integration tests to sync_project.rb
2019-07-11 18:25:52 -07:00
Gil 3d0c97ecf5 Manage configuration for benchmarks and fuzz tests and fix them (#3335)
* Fix leveldb benchmarks

... which apparently haven't been built in a while

* Manage configuration for Benchmarks and FuzzTests

* Suppress warnings in LibFuzzer

* Add a Firestore_Benchmarks_iOS scheme

* xcodeproj: Remove manual configuration for Fuzzer and Benchmarks

* Update LibFuzzer build for recent clangs

Builds are currently failing with this on standard out:

    -fsanitize-coverage=trace-pc-guard is no longer supported by
    libFuzzer.  Please either migrate to a compiler that supports
    -fsanitize=fuzzer or use an older version of libFuzzer
2019-07-11 15:58:30 -07:00
Gil 072047ccfc Manage search paths with sync_project.rb (#3326)
* xcodeproj: Remove needless FRAMEWORK_SEARCH_PATHS

* xcodeproj: Remove manually specified language standards

* Manage swift versions and bridging headers

* xcodeproj: Remove manually specified swift settings

* Manage header search paths

* xcodeproj: Remove manually specified search paths

* Manage language standards based on the podspec
2019-07-11 08:08:01 -07:00
Gil 6de3382e89 Add an -all_load linker flag to all example apps (#3315)
* Add an -all_load linker flag to all example apps

This fixes macOS and tvOS builds such that they no longer need to
explicitly link against the built FirebaseFirestore framework, which is
good because this wasn't working right: changes to the framework would
take two builds to get tests to actually see them.

The mechanism here is to amend the .xcconfig files that CocoaPods plugs
into the project, just after it generates them. This avoids the need to
actually modify the project.xcodeproj file, which reduces the potential
for conflicts.

Going forward all manual modifications to the project's configuration
will be handled this way to avoid needing special project configuration.

This also moves us incrementally closer to be being able to use test
specs and cocoapods-generate. There's too much custom configuration yet
(and several other blockers) but figuring out what's required to build
will make it such that we can eventually transition.

* xcodeproj: Remove -all_load and -framework flags

-all_load is now being supplied by sync_project.rb.

Remove manually specified -framework flags from the project file. The
-framework flags are actually coming from CocoaPods, but we copied the
others when manually linking against FirebaseFirestore. Now that that's
no longer required these can go away.

* Add a test-only mode to sync_project.rb

* Re-add CodableIntegrationTests.swift

A previous commit merged this incorrectly.
2019-07-09 14:48:04 -05:00
Gil c7f11450d0 Fix and rewrite sync_project.rb (#3296)
* Fix and rewrite sync_project.rb

Ever since we added multiple platforms, removing a file has been broken.
This fixes that issue.

Also, rewrite target synchronization to make more sense. Essentially now
there's one diff between the filesystem and the groups and then an
explicit diff is done between project files and target contents.

* Run sync_project.rb on post-install
2019-07-08 12:30:13 -05:00
Sebastian Schmidt 6db6cc7909 Store the coerced base value in the BaseMutation (#3292) 2019-07-03 08:45:31 -07:00
Gil 6910d82e68 Use a consistent set of dependencies on all platforms (#3289)
* Use a consistent set of dependencies on all platforms

* pod install for uniform dependencies
2019-07-02 14:10:20 -07:00
Hui-Wu 13671fda27 Allow firestore api to work with Codable objects + ExplicitNull + Integration tests (#3261)
* Convinience api for codables

* Integration Tests

* ExplicitNull implementation
2019-06-28 15:07:52 -04:00
Gil ddd3f171f6 Add a vector of pointers type (#3249) 2019-06-25 20:41:00 -07:00
Hui-Wu d723fc49f2 FieldValue and DocumentReference codable support. (#3231)
* working serverTimestamp

* working FieldValue. Still need: document ref and ability to Eq of FieldValue

* DocumentReference implemented and testing works

* clean up header search path

* improving FieldValue enum comments

* run through formatting

* addressing comments

* formatted with swiftformat 0.35.7

* add missing bool->BOOL change

* undo unintended swift version change

* remove unwanted proj file change
2019-06-24 16:18:30 -04:00
Gil ffdc328732 Migrate FSTDocumentState to C++ DocumentState (#3225) 2019-06-20 09:39:19 -07:00
Hui-Wu 1de21a845f Firestore swift Codable support (#3198)
FirestoreEncoder/Decoder and Timestamp/GeoPoint codable support.
2019-06-19 10:00:17 -04:00
Gil 0c11224789 Delete FSTDocumentKey (#3203) 2019-06-18 17:27:24 -07:00
Gil 10752cd68c Finish migration of FSTFieldValue to C++ FieldValue (#3178)
* Split transform_operations

* Revert "Make ServerTimestamp use FSTFieldValue for previous value"

* Finish FieldValue migration

* Delete FSTFieldValue
2019-06-18 16:21:17 -07:00
Gil 9892903266 Prep for FIRTimestampValue migration to C++ (#3155)
* Clean up GeoPoint port to C++

... 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.

* Extract MakeTimePoint into time_testing.h

... for reuse elsewhere

* Add TimestampInternal Hash/Truncate

* Use a method similar to NSDate to get current time on apple platforms
2019-06-11 09:03:01 -07:00
Gil 04d1d41a16 Migrate FSTBlobValue to FSTDelegateValue (#3130)
* 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
2019-06-07 11:29:30 -07:00
Gil e2630d5b38 Fix builds with GCC/Linux (#3141)
* Remove _Nullable in plain C++
  * Avoid adding -framework Foundation multiplatform targets on
    non-Apple platforms
  * Fix ordered_code_benchmark to be in a .cc file
2019-06-05 07:19:43 -07:00
Gil 220589d9bc Port FIRCollectionReference to C++ (#3126)
Also fix up DocumentReference to use it.
2019-06-04 18:10:17 -07:00