diff --git a/.gitignore b/.gitignore index 35bed0accdaa274f5966ca5b4b7180106325449b..1c9730a5ad57cd70613c0692529bcb1ccf056d59 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ build/ .pydevproject Makefile .test_env/ + +*~ +bazel-* diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000000000000000000000000000000000000..06495690ab9d11140f1b60ec496f57e40f817d71 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,8 @@ +git_repository( + name = "org_pubref_rules_protobuf", + remote = "https://github.com/pubref/rules_protobuf", + tag = "v0.7.1", +) + +load("@org_pubref_rules_protobuf//cpp:rules.bzl", "cpp_proto_repositories") +cpp_proto_repositories() diff --git a/third_party/protobuf_test/BUILD b/third_party/protobuf_test/BUILD new file mode 100644 index 0000000000000000000000000000000000000000..7c5b1c69947a317c6d82a8c7a140248fb514985f --- /dev/null +++ b/third_party/protobuf_test/BUILD @@ -0,0 +1,17 @@ +licenses(["notice"]) # Apache 2.0 + +load("@org_pubref_rules_protobuf//cpp:rules.bzl", "cpp_proto_library") + +cpp_proto_library( + name = "example_proto", + protos = [ + "example.proto" + ], +) + +cc_library( + name = "example_lib", + srcs = ["example_lib.cc"], + hdrs = ["example_lib.h"], + deps = [":example_proto"], +) diff --git a/third_party/protobuf_test/README.md b/third_party/protobuf_test/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e8bdeee6fee66ef79d0b813b4d8dfa4c180754c6 --- /dev/null +++ b/third_party/protobuf_test/README.md @@ -0,0 +1 @@ +This package tests that Bazel can build protobuf related rules. diff --git a/third_party/protobuf_test/example.proto b/third_party/protobuf_test/example.proto new file mode 100644 index 0000000000000000000000000000000000000000..57c52d3521f345c9722e21a6ffaea76891c7dc13 --- /dev/null +++ b/third_party/protobuf_test/example.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +package protos; + +message Greeting { + string name = 1; +} diff --git a/third_party/protobuf_test/example_lib.cc b/third_party/protobuf_test/example_lib.cc new file mode 100644 index 0000000000000000000000000000000000000000..8d55ed66deae3ff05eb1d2f6e2564a65891a8c23 --- /dev/null +++ b/third_party/protobuf_test/example_lib.cc @@ -0,0 +1,6 @@ +#include "third_party/protobuf_test/example_lib.h" +#include + +std::string get_greet(const ::protos::Greeting& who) { + return "Hello " + who.name(); +} diff --git a/third_party/protobuf_test/example_lib.h b/third_party/protobuf_test/example_lib.h new file mode 100644 index 0000000000000000000000000000000000000000..eaf4dd4cea7e4b23ddf33ec7630dcd4db12be0de --- /dev/null +++ b/third_party/protobuf_test/example_lib.h @@ -0,0 +1,7 @@ +#pragma once + +#include "third_party/protobuf_test/example.pb.h" + +#include + +std::string get_greet(const ::protos::Greeting &who);