Skip to content

Commit

Permalink
test repo for issue rules-proto-grpc#25
Browse files Browse the repository at this point in the history
  • Loading branch information
toddlipcon committed Nov 21, 2019
1 parent 65b3876 commit ca22d03
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test_workspaces/common_cpp_library/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package(default_visibility = ["//visibility:private"])

load("@rules_proto_grpc//cpp:defs.bzl", "cpp_proto_library")

# Use the same base proto in two different trees. The rules should not tread
# on each other and try to write the same file.

proto_library(
name = "proto_lib_a",
srcs = ["common.proto"],
deps = ["@com_google_protobuf//:descriptor_proto"],
)

proto_library(
name = "proto_lib_b",
srcs = ["demo.proto"],
deps = [":proto_lib_a"],
)

cpp_proto_library(
name = "cpp_lib_a",
deps = ["proto_lib_a"],
)

cpp_proto_library(
name = "cpp_lib_b",
deps = ["proto_lib_b"],
)

cc_test(
name = "test",
srcs = ["test.cc"],
deps = [
# Depend on both -- this is typically due to a "diamond" pattern in
# some other transitive include graph, rather than "direct" redundant
# dependencies.
"cpp_lib_a",
"cpp_lib_b",
],
)
11 changes: 11 additions & 0 deletions test_workspaces/common_cpp_library/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
local_repository(
name = "rules_proto_grpc",
path = "../../",
)

load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_toolchains", "rules_proto_grpc_repos")
rules_proto_grpc_toolchains()
rules_proto_grpc_repos()

load("@rules_proto_grpc//cpp:repositories.bzl", "cpp_repos")
cpp_repos()
12 changes: 12 additions & 0 deletions test_workspaces/common_cpp_library/common.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";

import "google/protobuf/descriptor.proto";

extend google.protobuf.MethodOptions {
bool foo = 50001;
}

message CommonProto{
string field = 1;
}

7 changes: 7 additions & 0 deletions test_workspaces/common_cpp_library/demo.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
syntax = "proto3";

import "common.proto";

message demo {
CommonProto field = 1;
}
6 changes: 6 additions & 0 deletions test_workspaces/common_cpp_library/test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "demo.pb.h"

int main() {
demo x;
return x.ByteSize();
}

0 comments on commit ca22d03

Please sign in to comment.