diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 00000000..c0c0c51f --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,59 @@ +cc_library( + name = "lightstep_tracer", + srcs = glob([ + "src/*.cpp", + "src/*.h", + ]), + hdrs = glob(["include/lightstep/*.h"]) + [ + ":include/lightstep/config.h", + ":include/lightstep/version.h", + ], + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = [ + "@com_lightstep_tracer_common//:lightstep_protos", + ":3rd_party_base64", + ":3rd_party_catch", + # https://github.com/opentracing/opentracing-cpp + "@io_opentracing_cpp//:opentracing", + ], +) + +genrule( + name = "generate_version_h", + srcs = glob([ + "*", + "cmake/**/*", + "example/**/*", + "src/*", + "3rd_party/**/*", + ]), + outs = [ + "include/lightstep/config.h", + "include/lightstep/version.h", + ], + cmd = """ + cmake \\ + -DBUILD_TESTING=OFF \\ + -DWITH_GRPC=OFF \\ + -DOPENTRACING_INCLUDE_DIR="" \\ + -DOPENTRACING_LIBRARY="" \\ + -L \\ + $$(dirname $(location :CMakeLists.txt)) + mv include/lightstep/config.h $(location :include/lightstep/config.h) + mv include/lightstep/version.h $(location :include/lightstep/version.h) + """, +) + +cc_library( + name = "3rd_party_base64", + srcs = glob(["3rd_party/base64/src/*.cpp"]), + hdrs = glob(["3rd_party/base64/include/**/*.h"]), + strip_include_prefix = "3rd_party/base64/include", +) + +cc_library( + name = "3rd_party_catch", + hdrs = glob(["3rd_party/catch/include/**/*.hpp"]), + strip_include_prefix = "3rd_party/catch/include", +) diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 00000000..4c186ea6 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,11 @@ +workspace(name = "com_lightstep_tracer_cpp") + +local_repository( + name = "com_lightstep_tracer_common", + path = "lightstep-tracer-common", +) + +local_repository( + name = "lightstep_vendored_googleapis", + path = "lightstep-tracer-common/third_party/googleapis", +) diff --git a/lightstep-tracer-common/BUILD b/lightstep-tracer-common/BUILD new file mode 100644 index 00000000..de38c123 --- /dev/null +++ b/lightstep-tracer-common/BUILD @@ -0,0 +1,37 @@ +proto_library( + name = "collector_proto", + srcs = ["collector.proto"], + deps = [ + "@lightstep_vendored_googleapis//:googleapis_proto", + "@com_google_protobuf//:timestamp_proto", + ], + visibility = ["//visibility:public"], +) + +cc_proto_library( + name = "collector_proto_cc", + deps = [":collector_proto"], +) + +proto_library( + name = "lightstep_carrier_proto", + srcs = ["lightstep_carrier.proto"], + visibility = ["//visibility:public"], +) + +cc_proto_library( + name = "lightstep_carrier_proto_cc", + deps = [":lightstep_carrier_proto"], +) + +# FIXME: this rule allows `#include ` to work, but it +# would be nicer to have properly prefixed include paths instead. +cc_library( + name = "lightstep_protos", + deps = [ + ":collector_proto_cc", + ":lightstep_carrier_proto_cc", + ], + visibility = ["//visibility:public"], + includes = ["."] +) diff --git a/lightstep-tracer-common/WORKSPACE b/lightstep-tracer-common/WORKSPACE new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/lightstep-tracer-common/WORKSPACE @@ -0,0 +1 @@ + diff --git a/lightstep-tracer-common/third_party/googleapis/BUILD b/lightstep-tracer-common/third_party/googleapis/BUILD new file mode 100644 index 00000000..2adec340 --- /dev/null +++ b/lightstep-tracer-common/third_party/googleapis/BUILD @@ -0,0 +1,11 @@ +proto_library( + name = "googleapis_proto", + srcs = [ + "google/api/annotations.proto", + "google/api/http.proto", + ], + deps = [ + "@com_google_protobuf//:descriptor_proto", + ], + visibility = ["//visibility:public"], +) diff --git a/lightstep-tracer-common/third_party/googleapis/WORKSPACE b/lightstep-tracer-common/third_party/googleapis/WORKSPACE new file mode 100644 index 00000000..e69de29b