The as-of-yet-unreleased Clang 10 adds some new warnings which make the CMake build fail (due to `-Werror`):
* BoringSSL build now fails because some of its C code contains fallthroughs in switch statements that aren't properly annotated. This wasn't an issue before because previous versions of Clang ignored `-Wimplicit-fallthrough` in C mode;
* serializer test contains an expression that produces the following warning:
```
/src/firebase-ios-sdk/Firestore/core/test/firebase/firestore/remote/serializer_test.cc:446:29:
error: implicit conversion from 'std::__1::numeric_limits<long>::type' (aka 'long') to 'double'
changes value from 9223372036854775807 to 9223372036854775808 [-Werror,
-Wimplicit-int-float-conversion]
```
Fixes:
* upgrade the version of BoringSSL used to the latest master. There's no particular reason to choose this commit, other than it happens to be the latest. The actual fixes we need are [this](https://github.com/google/boringssl/commit/05cd93068b0a553afc48f69acbceae10c6a17593) and [this](https://github.com/google/boringssl/commit/fbebe833b180a1a0685803c59bba38916826dd2b);
* apply `static_cast` to the serializer test. Also, because the cast produces a different value, add a couple of additional values to test.
The breakage was discovered thanks to the fuzz build (which already uses Clang 10 from trunk).
* Avoid unconditionally setting C++ flags
These were already handled via CMAKE_C_FLAGS and CMAKE_CXX_FLAGS and
this breaks when compiling plain C under GCC, which considers unknown
options an error when compiling with -Werror.
* Fix compilation in Linux/GCC and also Windows/MSVC
GCC and MSVC aren't happy about `using Query = testutil::Query;` when
there's already `class Query` in scope.
* Fix objc_class.h in Windows
* Fix warnings that have crept in on Windows
* Add sed scripts that find the versions of podspecs
... without fully loading those via Pod::Spec, which is slow.
* Avoid compiling with different visibility settings
... in different translation units. This removes warnings about linking
googletest causing weak symbols becoming strong.
* Add CMake objc_framework
* Define FirebaseCore via objc_framework
* Define FIRCoreDiagnosticsInterop via objc_framework
* Define GoogleUtilities with objc_framework
* Define FirebaseCoreDiagnosticsInterop via objc_framework
* Define FirebaseAuthInterop via objc_framework
* Don't duplicate Core's dependency information everywhere
* Remove podspec_framework
* Fix compilation error with -Wstrict-prototyes
gRPC packages 0.3.7-dev from 2016 in its own third_party directory and
builds it into libraries produced by CMake. Firestore depends on 0.3.9.2
via external dependency.
Firestore checks in its nanopb-generated sources for compatibility with
CocoaPods, where running the generator at build time on remote users'
machines is perilous. This means that Firestore's generated code must
match the version of nanopb available in CocoaPods.
Unfortunately, generated code from 0.3.7-dev and 0.3.9.2 are not
compatible with each other so we can't just downgrade the Firestore
CMake build to match gRPC and use its copy.
This change excludes gRPC's copy of nanopb until we get this fixed
upstream.
* Fix a few things that should have been splatted but weren't
* Define PODS_TARGET_SRCROOT in CMake for compatibility with CocoaPods
* Compile pods we depend upon with looser settings
* Rename the nanopb dependency to match what CMake actually has
* Make #include <nanopb/pb.h> work
Remove the old way of #include <pb.h> once we change the Firestore
nanopb generator to match.
* 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
* 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
* cc_binaries should not be tests
This will keep more involved benchmarks from extending test time
unreasonably.
* Fix target_link_libraries conformance with CMP0023
Avoid mixing keyword and non-keyword forms of target_link_libraries.
* Set target_include_directories to PRIVATE for cc_binary and cc_test
* Set add_sources to private
Fixes a warning about policy CMP0076, which wants to make sources
relative if they're public.
* Enable @rpath by default
This silences warnings about policy CMP0042, which we don't care much
about since we don't have install targets.
* Disable griping about undeclared byproducts
... when using the Ninja generator. In our case the undeclared outputs
come from dependencies and we'd need to fix them before we can adopt the
new policy here.
* Move the util::objc namespace to just objc
This removes all the namespace objc = firebase::firestore::util::objc
gunk to make it seem as if this was really the arrangement.
This is motivated by wanting to put additional things in this namespace
and use them in headers without having to use util::objc::Foo
* Add CMake support for header-only cc_library targets
* Have the linter allow #include <objc/objc.h>, a C header
* Add objc::EqualTo and objc::Hash
These make it possible to use std::unordered_map with Objective-C object
keys.
* Use std::unordered_map in MemoryQueryCache
* Fix objective-C library detection
This ensures that .mm files are compiled with -fobjc-arc (among other
things).
* Remove BOOL in FSTDocument to eliminate static_cast<bool>
* Revert "Revert "gRPC: replace Objective-C implementation with the new C++ implementation (#1968)" (#2030)"
This reverts commit ea567dca47.
* gRPC: fix bugs found during testing (#2039)
All in `GrpcStream`:
* make sure there are no pending completions when "finish" operation is enqueued;
* always finish gRPC calls;
* when connectivity changes, reset not just the calls, but the underlying channel as well.
* Revert "Partially revert "Update CHANGELOG for Firestore v0.14.0 (#2025)" (#2031)"
This reverts commit b2437b80f6.
* Update changelog for v0.15.0.
* gRPC: add gRPC wrapper classes to CMake build (#2015)
* add a C++ equivalent of `FIRFirestoreVersionString`. This eliminates the only Objective-C dependency of `grpc_connection.mm` and allows making it a pure C++ file;
* open-source `binary_to_array.py` script and use it in the build to embed `roots.pem` certificate file from gRPC into the Firestore binary. The embedded char array is then used to load certificate at runtime.
* Revert local change -- do not enable sanitizers by default
Several minor changes related to `Datastore`:
* `WatchStream` and `WriteStream` now use `GrpcConnection` instead of `Datastore` to create the underlying `GrpcStream`. This is in line with consolidating management of gRPC objects into `GrpcConnection` and removes dependence of streams on `Datastore`;
* Add `CreateWatchStream`/`CreateWriteStream` functions to `Datastore`;
* For functions creating gRPC wrappers (`GrpcStream`), pass token as `auth::Token` instead of `string_view`. This prevents confusing the argument order between the token and the RPC name, and allows moving the logic for retrieving a token for an unauthenticated user into `GrpcConnection`.
* Most significantly, move conversion from `grpc::Status` to `util::Status` from `Datastore` into the `util::Status` class itself. The main motivation is to avoid any dependence of `GrpcStream`, a pure C++ class, on `Datastore`, an Objective-C++ class. The downside is diverging from `FSTDatastore`. I think it's fine, because a) other platforms don't have an equivalent of `Datastore::ConvertStatus`; b) this is in line with how Windows/Apple Foundation/POSIX errors are handled by `util::Status` already;
* in CMake build, bump the used version of gRPC to 1.14.2. This is to be able to include gRPC headers using `grpcpp` path, not deprecated `grpc++`.
* Rename nanopb/.../*.pb.c to nanopb/.../*.nanopb.c
This ensures that all generated nanopb files use the same (sub)
extension of nanopb. This matches up with nanopb's --extension
parameter (which will be enabled later in this PR.)
* Remove references to NANOPB_PROTOC_BIN
Which wasn't being used, and wasn't pointing to a valid protoc.
* Add ability to generate protos from cmake build.
Currently, it's an entirely manual process via 'generate_protos' target.
This target is not automatically run during a build.
See Firestore/Protos/build-protos.sh for expected usage.
* cleanup/update license in build-protos.sh
* Build grpc proto sources (objc only)
* Use 32bit nanopb fields (instead of 16)
To match xcode build, but also to allow google/api/annotations.proto to
compile. (A recent change to nanopb now enforces this.) This isn't
strictly necessary, since we don't make use of that proto, so we
could've simply removed it instead (and in fact, the objc protos do
exactly that) but matching the xcode build certainly seems worthwhile.
* Rebuild all proto sources
* Skip whitespace checks on protoc generated files
* Use bundler only when .bundle exists
This makes the build compatible with Travis which needs bundler and
local installs of cocoapods.
* Update gitignore
* Update CMake instructions
* Created `cc_fuzz_test` build rule that automatically:
- Searches for `Fuzzer` package (libFuzzer or whatever is provided by
OSS Fuzz).
- Adds dependency of `Fuzzer`.
- Copies the dictionary file and corpus directory to the target binary
destination directory with the appropriate name.
* Modified fuzzing targets to use `cc_fuzz_test` rule.
* Detect OSS Fuzz thorough `LIB_FUZZING_ENGINE` env var.
* Avoid building libFuzzer if not fuzzing.
* Load the fuzzing library either from the library provided by OSS Fuzz or from libFuzzer.a that was manually built from sources.
* Remove no-longer relevant comment
Nanopb headers now have distinct names so search order no longer
matters.
* cc_* rules now automatically filter out objc sources
* Combine executor and async queue into a single library
* Add cc_select
Adds a mechanism similar to blaze/bazel's select() for choosing an
implementation of a library.
This also makes the platform-neutral generic name for the library a
proper CMake library, which removes the need to keep libraries in
dependency order within CMakeLists.txt.
* Alphabetize rules
* Added `cc_binary` rule to allow executables.
* Added `libFuzzer` as an external project that Firestore depends on.
* LibFuzzer is checked out from its SVN repository.
* LibFuzzer is built using its `build.sh` script to produce the library `libFuzzer.a`.
* Added a `FindLibFuzzer.cmake` script that looks for `libFuzzer.a`.
* Added a new cmake option `FUZZING` to enable fuzzing and adding the appropriate compiler flags.
* Added `fuzzing_options.cmake` rules to check for compiler type and add the fuzzing flags accordingly.
* Added a `firebase_firestore_fuzzing_serializer` target that depends on `libFuzzer` and `firebase_firestore_remote` to fuzz test the serializer.
* Add UTF-8 to wide character conversions for Windows pathnames.
* Explicitly mark UTF-8 string literals
Without this, string literals are encoded in the host's encoding, which
can be anything including CP-1252 on Windows, which will generate
invalid UTF-8 data when fed through our serializer.
* Add compiler flags for MSVC on VS2017
* Force gtest to use the dynamic runtime on Windows.
* Avoid setting flags that MSVC does not understand
* Add compiler_id: cheap shortcuts for conditional features on a compiler
* Fix googletest build under VS2017
* Force disable Abseil's tests, which don't compile under VS2017.
* Make Firestore CMake a self-contained build
Now shell out to a sub-CMake to prepare depenencies without needing an
explciit superbuild structure. This makes the Visual Studio and CLion
projects driven from the CMake configuration actually usable.
* Make LevelDB an optional dependency.
* Move third-party dependencies to the top-level
* Make Firestore CMake a self-contained build
Now shell out to a sub-CMake to prepare depenencies without needing an
explciit superbuild structure. This makes the Visual Studio and CLion
projects driven from the CMake configuration actually usable.
* Move third-party dependencies to the top-level
* Rename utils.cmake to cc_rules.cmake
This makes it less of a dumping ground
* Fix sign mismatch in FIRApp
* Implement a podspec_framework CMake function
... that generates a CMake framework library target from a podspec.
* Remove manual CMake scripts for xcodebuild
* Build zlib with grpc's add_subdirectory
* Build grpc and its children with add_subdirectory.
* Build c-ares with grpc's add_subdirectory
* Convert protobuf to a download-only ExternalProject
* Temporarily break protobuf within grpc
This works because libgrpc has no actual dependency on protobuf
* Update boringssl to master@{2018-07-10}
* Add a download-only boringssl ExternalProject
Match boringssl version to grpc submodule version
Note: not yet in use
* Split grpc into separate download and build tasks
This allows other external targets to download into the gRPC source tree
before grpc is actually built.
* Convert grpc to an http download
* Build googletest with add_subdirectory
Also:
* Revert library-name modifications in the abseil-cpp build
* Move abseil-cpp add_subdirectory build into place
* Build nanopb with add_subdirectory
* Force nanopb first to work around ODR violations
This is a temporary work-around for b/111328563.
* Add a download-only boringssl ExternalProject
Match boringssl version to grpc submodule version
* Split grpc into separate download and build tasks
This allows other external targets to download into the gRPC source tree
before grpc is actually built.
* Convert grpc to an http download
* Pull out sanitizer options into a separate file
* Reorder packages
* Remove the extra "external/$target" directory from PREFIX
Instead of BINARY_DIR/external/foo/src/foo the contents will be in
BINARY_DIR/src/foo.
* Make libprotobuf-nanopb targets line up with nanopb's CMakeLists.txt
* Fix CMake style
* Add cmake dependencies where required
... instead of relying on a topological sort in the top-level
CMakeLists.txt.
* Add early exits to external project builds
* Add an external build for c-ares
* Use installed c-ares package configuration
* Adjust protobuf configuration to use the standard Protobuf_DIR variable.
* Have grpc depend on c-ares
* Drop UPDATE_COMMAND where it doesn't matter
* Install protobuf
* Use the built-in FindProtobuf.cmake
* Add additional build configuration flags
* Preserve generator configuration in the protobuf sub-build
Without this, the build fails on Win64 because the default
configuration builds a Win32 libprotobuf and the Win64 build rejects
it.
* Wire the installed protobuf into the gRPC build.
* Install nanopb
* Ignore vim backup files
* Prepare for installed subprojects
This adds FIREBASE_BINARY_DIR to point to the out-of-source build
directory (which previously was passed around as FIREBASE_INSTALL_DIR).
This repurposes FIREBASE_INSTALL_DIR to point to
${FIREBASE_BINARY_DIR}/opt, and installation root for subprojects that
have an install step.
* Allow download directory to be specified