Commit Graph

2 Commits

Author SHA1 Message Date
Yong Tang 155c55900f Add repository name to build_defs.bzl (#5104)
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>
2019-01-07 09:55:55 -08:00
Austin Schuh d56a4055da Add flatbuffer_cc library support (#5061)
* 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.
2018-12-10 12:23:40 -08:00