-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support protobuf generation for proto files that are located within
subdirectories of the proto_library rule that consumed it. - Adds _get_relative_dirname utility method. - Adds test case.
- Loading branch information
Showing
5 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
load("//cpp:rules.bzl", "cc_proto_library") | ||
|
||
cc_test( | ||
name = "test", | ||
size = "small", | ||
srcs = ["qux_test.cc"], | ||
copts = ["-Iexternal/gtest/include"], | ||
deps = [ | ||
":protolib", | ||
"@gtest//:gtest", | ||
], | ||
) | ||
|
||
cc_proto_library( | ||
name = "protolib", | ||
protos = [ | ||
"foo/bar/baz.proto", | ||
], | ||
verbose = 3, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
syntax = "proto3"; | ||
|
||
package foo.bar.baz; | ||
|
||
message Qux { | ||
bool verbose = 1; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "gtest/gtest.h" | ||
|
||
#include "tests/proto_file_in_subdirectory/foo/bar/baz.pb.h" | ||
|
||
TEST(QuxTest, CanCreateMessage) { | ||
GOOGLE_PROTOBUF_VERIFY_VERSION; | ||
foo::bar::baz::Qux msg = foo::bar::baz::Qux(); | ||
msg.set_verbose(1); | ||
EXPECT_EQ(1, msg.verbose()); | ||
} | ||
|
||
int main(int ac, char* av[]) { | ||
testing::InitGoogleTest(&ac, av); | ||
return RUN_ALL_TESTS(); | ||
} |