Skip to content

Comments

Add initial Bazel WORKSPACE and BUILD#4608

Merged
aardappel merged 1 commit intogoogle:masterfrom
jschaf:bazelify
Feb 5, 2018
Merged

Add initial Bazel WORKSPACE and BUILD#4608
aardappel merged 1 commit intogoogle:masterfrom
jschaf:bazelify

Conversation

@jschaf
Copy link
Contributor

@jschaf jschaf commented Jan 26, 2018

For #4574.

bazel test --verbose_failures //:flatbuffers_test
tests/test.cpp:19:37: fatal error: flatbuffers/minireflect.h: No such file or directory
 #include "flatbuffers/minireflect.h"

@jschaf jschaf mentioned this pull request Jan 26, 2018
BUILD Outdated
])

FLATBUFFERS_COPTS = [
"-fexceptions",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using exceptions anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

BUILD Outdated
"LICENSE",
"build_defs",
"reflection/reflection.fbs",
"samples/monster.fbs",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is any of the tests and samples stuff exported?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so you can reference the files for codelabs. Normall, bazel doesn't let you reference files from other packages unless you export the files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not needed for this case, so I'll remove.

BUILD Outdated

FLATBUFFERS_COPTS_FOR_TESTING = FLATBUFFERS_COPTS + [
"-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
"-DFLATBUFFERS_TEST_PATH_PREFIX=third_party/flatbuffers/",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the need for this path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

BUILD Outdated
# Library shared between destkop and mobile targets to test flatbuffers.
# This is seperate from :flatbuffers and :flatc_library as it uses different
# preprocessor symbols to configure the build for testing.
cc_library(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need a library for the tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -0,0 +1,2 @@
workspace(name = "com_github_google_flatbuffers")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this file strictly needed? always looking for ways to not clutter the root dir :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, Bazel requires a WORKSPACE file at the root directory:
https://docs.bazel.build/versions/master/tutorial/cpp.html#build-with-bazel

@aardappel
Copy link
Collaborator

@smiles can you have a look?

@aardappel
Copy link
Collaborator

As for the error you're getting, flatbuffers/minireflect.h does not appear in the public headers, adding it should fix it?

For google#4574.

To test:

    bazel test --verbose_failures //:flatbuffers_test
@aardappel
Copy link
Collaborator

@smiles can you give this a final review?

Copy link
Contributor

@stewartmiles stewartmiles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me.

@aardappel aardappel merged commit c696422 into google:master Feb 5, 2018
@jschaf jschaf deleted the bazelify branch February 5, 2018 21:20
zchee pushed a commit to zchee/flatbuffers that referenced this pull request Feb 14, 2019
For google#4574.

To test:

    bazel test --verbose_failures //:flatbuffers_test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants