This is left-over from the migration completed in #5323 (as part of
b/152883646).
Briefly, we used have much more complex self-contained rules that tried
to manage sources, dependencies, and everything in a single rule like
firebase_ios_cc_library. The migration added functions like
firebase_ios_add_library that more closely matched builtin CMake
primitives. I should have sent this PR as the final one in that
sequence.
This option doesn't work with C++, and even though the clang compiler
ignores it, clangd does not, and this causes syntax highlighting
failures in CLion.
* update nanopb from 0.3.9.5 to 0.3.9.6
This fixes issues building firestore SDK with Python3.
Interestingly, latest version 0.4.2 still errors during the build
but 0.3.9.6 works. The git commit for this fix in nanopb
https://github.com/nanopb/nanopb/commit/63f8e5e4946a5f8f0211b454bd37187871c3d023
* Update generated sources
* updating just nanopb dependency version
nanopb updated from 0.3.9.5 to 0.3.9.6
(pod version 1.30905.0 to 1.30906.0)
* Add missing source specifier
* Generated files for protos using nanopb 0.3.9.6
* removed unnecessary whitespaces in files generated by protoc
* using more qualified relative paths for header includes
* Changelog
Co-authored-by: Marek Gilbert <mcg@google.com>
Co-authored-by: Paul Beusterien <paulbeusterien@google.com>
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.
* 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
* 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.
* Don't modify CMAKE_CXX_FLAGS
* Avoid conflict on RANDOM_FILE
* Only conditionally build tests
* Remove alias provided by the upstream build
* Set SOURCE_DIR and BINARY_DIR for each external library
* Compute repo root without git
This supports building Firestore from a source archive
* Make empty files C++
This makes it possible to compile with a single set of flags for every
cc_library.
* 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
* Upgrade gRPC to 1.24.3
* Upgrade C++ Protobuf to 3.9.2
Disable -Wunreachable-code in protobuf-generated code
* Regenerate C++ protos with protobuf 3.9.2
* Generate objc protos with Protobuf 3.9.2
* Require CMake 3.5.1
This is the version required by the latest versions of gRPC and Google
Benchmark. See discussion https://github.com/google/benchmark/pull/613.
Remove version check around find_package(XCTest)
Also, add a dependency on objc protos that was missing but somehow
implicitly being added before.
* Upgrade Google Benchmark to 1.5.0
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