From 1071264d4edd8a1fc21c0029e3a2c1f2ec184a48 Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Fri, 5 Oct 2018 17:48:53 -0400 Subject: [PATCH] build: Bump rules_go and protobuf to pick up Windows fixes (#4556) - Bump rules_go to 1.15.3 (latest). This picks up some fixes so that rules_go works on Windows. The api go tests don't appear to build with go1.11, so pin to go1.10.4 - Bump google/protobuf to fa252ec2, which picks up a fix for handling Windows path separators Signed-off-by: Sam Smith --- WORKSPACE | 4 ++-- bazel/repositories.bzl | 17 +++++++++++++++++ bazel/repository_locations.bzl | 21 +++++++++++++++++---- ci/WORKSPACE | 4 ++-- ci/WORKSPACE.filter.example | 4 ++-- windows/tools/bazel.rc | 4 ++-- 6 files changed, 42 insertions(+), 12 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index ebdb050a79cf..32547b75780b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,6 +1,6 @@ workspace(name = "envoy") -load("//bazel:repositories.bzl", "envoy_dependencies") +load("//bazel:repositories.bzl", "envoy_dependencies", "GO_VERSION") load("//bazel:cc_configure.bzl", "cc_configure") envoy_dependencies() @@ -11,4 +11,4 @@ api_dependencies() load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains") go_rules_dependencies() -go_register_toolchains() +go_register_toolchains(go_version = GO_VERSION) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 450d5cfeb5a8..7f71c1f91cd2 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -17,6 +17,9 @@ load("@bazel_tools//tools/cpp:lib_cc_configure.bzl", "get_env_var") # dict of {build recipe name: longform extension name,} PPC_SKIP_TARGETS = {"luajit": "envoy.filters.http.lua"} +# go version for rules_go +GO_VERSION = "1.10.4" + def _repository_impl(name, **kwargs): # `existing_rule_keys` contains the names of repositories that have already # been defined in the Bazel workspace. By skipping repos with existing keys, @@ -212,7 +215,21 @@ def _go_deps(skip_targets): # Keep the skip_targets check around until Istio Proxy has stopped using # it to exclude the Go rules. if "io_bazel_rules_go" not in skip_targets: + _repository_impl( + name = "com_github_golang_protobuf", + # These patches are to add BUILD files to golang/protobuf. + # TODO(sesmith177): Remove this dependency when both: + # 1. There's a release of golang/protobuf that includes + # https://github.com/golang/protobuf/commit/31e0d063dd98c052257e5b69eeb006818133f45c + # 2. That release is included in rules_go + patches = [ + "@io_bazel_rules_go//third_party:com_github_golang_protobuf-gazelle.patch", + "@io_bazel_rules_go//third_party:com_github_golang_protobuf-extras.patch", + ], + patch_args = ["-p1"], + ) _repository_impl("io_bazel_rules_go") + _repository_impl("bazel_gazelle") def _envoy_api_deps(): # Treat the data plane API as an external repo, this simplifies exporting the API to diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index e4078aad7953..047f443a738e 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -1,4 +1,9 @@ REPOSITORY_LOCATIONS = dict( + bazel_gazelle = dict( + sha256 = "1b959bd6b6ce88fc3fdfc28946adf1eafb1d5e4d470d2e08a51774d09078d031", + strip_prefix = "bazel-gazelle-0.14.0", + urls = ["https://github.com/bazelbuild/bazel-gazelle/archive/0.14.0.tar.gz"], + ), boringssl = dict( # Use commits from branch "chromium-stable-with-bazel" commit = "ab36a84b91b3116bacc85973995504818748d8a9", # chromium-69.0.3497.81 @@ -129,17 +134,25 @@ REPOSITORY_LOCATIONS = dict( # that includes: # - https://github.com/google/protobuf/commit/f35669b8d3f46f7f1236bd21f14d744bba251e60 # - https://github.com/google/protobuf/commit/6a4fec616ec4b20f54d5fb530808b855cb664390 - commit = "6a4fec616ec4b20f54d5fb530808b855cb664390", + # - https://github.com/google/protobuf/commit/fa252ec2a54acb24ddc87d48fed1ecfd458445fd + commit = "fa252ec2a54acb24ddc87d48fed1ecfd458445fd", remote = "https://github.com/google/protobuf", ), grpc_httpjson_transcoding = dict( commit = "05a15e4ecd0244a981fdf0348a76658def62fa9c", # 2018-05-30 remote = "https://github.com/grpc-ecosystem/grpc-httpjson-transcoding", ), + com_github_golang_protobuf = dict( + # TODO(sesmith177): Remove this dependency when both: + # 1. There's a release of golang/protobuf that includes + # https://github.com/golang/protobuf/commit/31e0d063dd98c052257e5b69eeb006818133f45c + # 2. That release is included in rules_go + commit = "31e0d063dd98c052257e5b69eeb006818133f45c", # 2018-10-03 + remote = "https://github.com/golang/protobuf", + ), io_bazel_rules_go = dict( - sha256 = "5a89e9c1fe89d45c4a45132fae94bf130842ce3c77e3a735a68f6991d4e00a25", - strip_prefix = "rules_go-0.11.2", - urls = ["https://github.com/bazelbuild/rules_go/archive/0.11.2.tar.gz"], + commit = "3d966375ff7971d43b863f785f495c7dcd6923da", # 2018-10-02 + remote = "https://github.com/bazelbuild/rules_go", ), six_archive = dict( sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", diff --git a/ci/WORKSPACE b/ci/WORKSPACE index 33dad12a3f59..b22222ef37bd 100644 --- a/ci/WORKSPACE +++ b/ci/WORKSPACE @@ -1,6 +1,6 @@ workspace(name = "ci") -load("//bazel:repositories.bzl", "envoy_dependencies") +load("//bazel:repositories.bzl", "envoy_dependencies", "GO_VERSION") load("//bazel:cc_configure.bzl", "cc_configure") # We shouldn't need this, but it's a workaround for https://github.com/bazelbuild/bazel/issues/3580. @@ -20,4 +20,4 @@ api_dependencies() load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains") go_rules_dependencies() -go_register_toolchains() +go_register_toolchains(go_version = GO_VERSION) diff --git a/ci/WORKSPACE.filter.example b/ci/WORKSPACE.filter.example index 45a8e26ce727..632e35eac78d 100644 --- a/ci/WORKSPACE.filter.example +++ b/ci/WORKSPACE.filter.example @@ -5,7 +5,7 @@ local_repository( path = "/source", ) -load("//bazel:repositories.bzl", "envoy_dependencies") +load("//bazel:repositories.bzl", "envoy_dependencies", "GO_VERSION") load("//bazel:cc_configure.bzl", "cc_configure") envoy_dependencies( @@ -19,4 +19,4 @@ api_dependencies() load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains") go_rules_dependencies() -go_register_toolchains() +go_register_toolchains(go_version = GO_VERSION) diff --git a/windows/tools/bazel.rc b/windows/tools/bazel.rc index 234d5bc4a85a..9da9954a452c 100644 --- a/windows/tools/bazel.rc +++ b/windows/tools/bazel.rc @@ -1,7 +1,7 @@ # Windows/Envoy specific Bazel build/test options. -// TODO: remove experimental_shortened_obj_file_path for Bazel 0.16.0 -build --experimental_shortened_obj_file_path build --define signal_trace=disabled build --define hot_restart=disabled build --define tcmalloc=disabled +# Build GRPC without c-ares support -- otherwise it will not link +build --define grpc_no_ares=true