* Add support for compatible_with and restricted_to
These attributes have been available in Bazel for years. Pass them
through so the flatbuffer rules can be used with them. They let you
constrain which target platform is used.
While we are here, fix gen_reflections to work with bazel.
* Add docs
* Stop building for Windows until the build passes
ERROR: D:/b/bk-windows-java8-bd0z/bazel/flatbuffers/BUILD:123:1: Couldn't build file _objs/flatbuffers_test/test.obj: undeclared inclusion(s) in rule '//:flatbuffers_test':
this rule is missing dependency declarations for the following files included by 'tests/test.cpp':
'tests/monster_test_generated.h'
'tests/monster_extra_generated.h'
The files in tests are being found instead of the generated files since
Windows doesn't have any sandboxing. For now, let's disable the rules
and come back to it.
* Fix buildifier warnings
Clean up docstrings and add a module docstring.
In flatbuffers, build_defs.bzl has been updated to have the
bazel rule `flatbuffer_cc_library` defined. Therefore, it should
be possible to build another application and using `flatbuffer_cc_library`
directly (by `load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")`)
However, when I tried to do the above, I saw the following errors in bazel:
```
ERROR: /root/.cache/bazel/_bazel_root/c27e9809996ce9a9c0ed8dd79ef0897b/external/arrow/BUILD.bazel:12:1: in deps attribute of cc_library rule @arrow//:arrow_format: target '@arrow//:runtime_cc' does not exist. Since this rule was created by the macro 'flatbuffer_cc_library', the error might have been caused by the macro implementation in /root/.cache/bazel/_bazel_root/c27e9809996ce9a9c0ed8dd79ef0897b/external/com_github_google_flatbuffers/build_defs.bzl:216:16
```
The reason for the bazel error was that `//:runtime_cc` and `//:flatc` does not have
the repo name prefixed.
By prefix `` the above bazel build error could be resolved.
This fix should help other programs to use flatbuffers directly through bazel.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Add flatbuffer_cc library support
* Update flags so all the tests pass
Tests now all pass!
* Modify the tests to use the generated code
This should be a simple serialize/deserialize test of the new generated
code to make sure the bazel rules are doing something sane.
* Use generated monster_test.fb in testing/test.cpp
cmake drops it's generated code in tests/monster_test_generated.h
Instead of checking that in, let's generate it with bazel.
* Make grpc tests depend on monster_test_generated.h
* Remove redundant cmake dependency
This should address @aardappel's feedback.
* Run flatc for Android as well
This will fix the last travis.ci failure
* Add generated output folder and fix flags
* Move flatbuffers_header_build_rules to the library that uses it
* Use --cpp-ptr-type to fix android
Android was the only target using the STL emulation layer. It needed
the --cpp-ptr-type flatbuffers::unique_ptr flag to work. Add it!
* Roll back changes to use autogenerated monster_test_generated.
Flip tests/test.cpp to use the autogenerated file as well.