diff --git a/BUILD b/BUILD index e69de29b..a72161b1 100644 --- a/BUILD +++ b/BUILD @@ -0,0 +1,3 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_prefix") + +go_prefix("github.com/envoyproxy/data-plane-api") diff --git a/WORKSPACE b/WORKSPACE index 11dc3946..6e03ec7d 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -36,3 +36,13 @@ new_http_archive( url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55", ) +git_repository( + name = "io_bazel_rules_go", + remote = "https://github.com/bazelbuild/rules_go.git", + commit = "4374be38e9a75ff5957c3922adb155d32086fe14", +) +load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains") +go_rules_dependencies() +go_register_toolchains() +load("@io_bazel_rules_go//proto:def.bzl", "proto_register_toolchains") +proto_register_toolchains() diff --git a/api/BUILD b/api/BUILD index 61da7013..38262fc0 100644 --- a/api/BUILD +++ b/api/BUILD @@ -1,7 +1,54 @@ load("//bazel:api_build_system.bzl", "api_proto_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_grpc_library") licenses(["notice"]) # Apache 2 +# Go proto library dislikes proto libraries with no sources and only deps +proto_library( + name = "go_protos", + srcs = [ + "accesslog.proto", + "address.proto", + "base.proto", + "bootstrap.proto", + "cds.proto", + "discovery.proto", + "eds.proto", + "hds.proto", + "health_check.proto", + "lds.proto", + "protocol.proto", + "rds.proto", + "rls.proto", + "sds.proto", + ], + visibility = ["//visibility:public"], + deps = [ + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:descriptor_proto", + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:struct_proto", + "@com_google_protobuf//:timestamp_proto", + "@com_google_protobuf//:wrappers_proto", + "@googleapis//:http_api_protos_lib", + ], +) + +go_grpc_library( + name = "go_default_library", + importpath = "api", + proto = ":go_protos", + visibility = ["//visibility:public"], + deps = [ + "@com_github_golang_protobuf//ptypes/any:go_default_library", + "@com_github_golang_protobuf//ptypes/duration:go_default_library", + "@com_github_golang_protobuf//ptypes/struct:go_default_library", + "@com_github_golang_protobuf//ptypes/timestamp:go_default_library", + "@com_github_golang_protobuf//ptypes/wrappers:go_default_library", + "@org_golang_google_genproto//googleapis/api/annotations:go_default_library", + ], +) + api_proto_library( name = "address", srcs = ["address.proto"], @@ -124,7 +171,7 @@ proto_library( deps = [ ":cds", ":eds", - ":rds", ":lds", + ":rds", ], ) diff --git a/api/base.proto b/api/base.proto index 68320049..a277a041 100644 --- a/api/base.proto +++ b/api/base.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package envoy.api.v2; +option go_package = "api"; import "api/address.proto"; diff --git a/api/filter/BUILD b/api/filter/BUILD index de3473b4..1b82e00d 100644 --- a/api/filter/BUILD +++ b/api/filter/BUILD @@ -1,7 +1,30 @@ load("//bazel:api_build_system.bzl", "api_proto_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") licenses(["notice"]) # Apache 2 +# Go proto library dislikes proto libraries with no sources and only deps +proto_library( + name = "go_protos", + srcs = [ + "fault.proto", + ], + visibility = ["//visibility:public"], + deps = [ + "@com_google_protobuf//:duration_proto", + ], +) + +go_proto_library( + name = "go_default_library", + importpath = "api/filter", + proto = ":go_protos", + visibility = ["//visibility:public"], + deps = [ + "@com_github_golang_protobuf//ptypes/duration:go_default_library", + ], +) + api_proto_library( name = "fault", srcs = ["fault.proto"], diff --git a/api/filter/fault.proto b/api/filter/fault.proto index a796d8a3..f5614357 100644 --- a/api/filter/fault.proto +++ b/api/filter/fault.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package envoy.api.v2.filter; +option go_package = "filter"; import "google/protobuf/duration.proto"; diff --git a/api/filter/http/BUILD b/api/filter/http/BUILD index 6e9d7445..d3baf67f 100644 --- a/api/filter/http/BUILD +++ b/api/filter/http/BUILD @@ -1,7 +1,52 @@ load("//bazel:api_build_system.bzl", "api_proto_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") licenses(["notice"]) # Apache 2 +# Go proto library dislikes proto libraries with no sources and only deps +proto_library( + name = "go_protos", + srcs = [ + "buffer.proto", + "fault.proto", + "health_check.proto", + "http_connection_manager.proto", + "ip_tagging.proto", + "rate_limit.proto", + "router.proto", + "transcoder.proto", + ], + visibility = ["//visibility:public"], + deps = [ + "//api:go_protos", + "//api/filter:go_protos", + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:descriptor_proto", + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:struct_proto", + "@com_google_protobuf//:timestamp_proto", + "@com_google_protobuf//:wrappers_proto", + "@googleapis//:http_api_protos_lib", + ], +) + +go_proto_library( + name = "go_default_library", + importpath = "api/filter/http", + proto = ":go_protos", + visibility = ["//visibility:public"], + deps = [ + "//api:go_default_library", + "//api/filter:go_default_library", + "@com_github_golang_protobuf//ptypes/any:go_default_library", + "@com_github_golang_protobuf//ptypes/duration:go_default_library", + "@com_github_golang_protobuf//ptypes/struct:go_default_library", + "@com_github_golang_protobuf//ptypes/timestamp:go_default_library", + "@com_github_golang_protobuf//ptypes/wrappers:go_default_library", + "@org_golang_google_genproto//googleapis/api/annotations:go_default_library", + ], +) + api_proto_library( name = "http_connection_manager", srcs = ["http_connection_manager.proto"], diff --git a/api/filter/http/http_connection_manager.proto b/api/filter/http/http_connection_manager.proto index cc829572..0dda6d3a 100644 --- a/api/filter/http/http_connection_manager.proto +++ b/api/filter/http/http_connection_manager.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package envoy.api.v2.filter.http; +option go_package = "http"; import "api/base.proto"; import "api/protocol.proto"; diff --git a/api/filter/network/BUILD b/api/filter/network/BUILD index 8b285f29..75b35f12 100644 --- a/api/filter/network/BUILD +++ b/api/filter/network/BUILD @@ -1,7 +1,49 @@ load("//bazel:api_build_system.bzl", "api_proto_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") licenses(["notice"]) # Apache 2 +# Go proto library dislikes proto libraries with no sources and only deps +proto_library( + name = "go_protos", + srcs = [ + "client_ssl_auth.proto", + "mongo_proxy.proto", + "rate_limit.proto", + "redis_proxy.proto", + "tcp_proxy.proto", + ], + visibility = ["//visibility:public"], + deps = [ + "//api:go_protos", + "//api/filter:go_protos", + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:descriptor_proto", + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:struct_proto", + "@com_google_protobuf//:timestamp_proto", + "@com_google_protobuf//:wrappers_proto", + "@googleapis//:http_api_protos_lib", + ], +) + +go_proto_library( + name = "go_default_library", + importpath = "api/filter/network", + proto = ":go_protos", + visibility = ["//visibility:public"], + deps = [ + "//api:go_default_library", + "//api/filter:go_default_library", + "@com_github_golang_protobuf//ptypes/any:go_default_library", + "@com_github_golang_protobuf//ptypes/duration:go_default_library", + "@com_github_golang_protobuf//ptypes/struct:go_default_library", + "@com_github_golang_protobuf//ptypes/timestamp:go_default_library", + "@com_github_golang_protobuf//ptypes/wrappers:go_default_library", + "@org_golang_google_genproto//googleapis/api/annotations:go_default_library", + ], +) + api_proto_library( name = "mongo_proxy", srcs = ["mongo_proxy.proto"], diff --git a/api/filter/network/tcp_proxy.proto b/api/filter/network/tcp_proxy.proto index 66329464..439a01e1 100644 --- a/api/filter/network/tcp_proxy.proto +++ b/api/filter/network/tcp_proxy.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package envoy.api.v2.filter.network; +option go_package = "network"; import "google/protobuf/duration.proto"; diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index f6c82344..8d979079 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -1,9 +1,10 @@ +GOOGLEAPIS_SHA = "5c6df0cd18c6a429eab739fb711c27f6e1393366" # May 14, 2017 + def api_dependencies(): - native.new_git_repository( + native.new_http_archive( name = "googleapis", - # Head of master at 5/14. - commit = "5c6df0cd18c6a429eab739fb711c27f6e1393366", - remote = "https://github.com/googleapis/googleapis.git", + strip_prefix = "googleapis-" + GOOGLEAPIS_SHA, + url = "https://github.com/googleapis/googleapis/archive/" + GOOGLEAPIS_SHA + ".tar.gz", build_file_content = """ load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")