From e2ab992117f901d88188da43e3986f35012f1f64 Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Tue, 3 Jul 2018 13:38:09 -0400 Subject: [PATCH 01/10] Bazel / build file changes to build on Windows This commit just contains the build changes required to build envoy on Windows. As is, it will not compile without code changes. We expect to add the code changes in an upcoming PR Signed-off-by: Sam Smith Signed-off-by: Amin Jamali --- .gitignore | 1 + api/bazel/api_build_system.bzl | 7 ++ api/bazel/repositories.bzl | 15 ++- bazel/BUILD | 29 ++++++ bazel/envoy_build_system.bzl | 80 ++++++++++++--- bazel/external/libcircllhist.BUILD | 4 + bazel/repositories.bat | 4 + bazel/repositories.bzl | 30 +++++- bazel/repository_locations.bzl | 2 +- ci/build_container/build_recipes/benchmark.sh | 18 +++- ci/build_container/build_recipes/cares.sh | 22 ++++- .../build_recipes/gperftools.sh | 3 + ci/build_container/build_recipes/libevent.sh | 31 +++++- ci/build_container/build_recipes/luajit.sh | 18 +++- ci/build_container/build_recipes/nghttp2.sh | 48 ++++++++- ci/build_container/build_recipes/yaml-cpp.sh | 25 ++++- ci/build_container/build_recipes/zlib.sh | 14 ++- ci/build_setup.ps1 | 22 +++++ ci/do_ci.ps1 | 20 ++++ ci/prebuilt/BUILD | 35 +++++-- include/envoy/common/BUILD | 2 + include/envoy/common/socket_fd.h | 2 + include/envoy/common/ssize.h | 2 + include/envoy/grpc/BUILD | 6 +- include/envoy/local_info/BUILD | 4 +- include/envoy/network/BUILD | 4 +- include/envoy/router/BUILD | 8 +- include/envoy/secret/BUILD | 4 +- include/envoy/server/BUILD | 8 +- include/envoy/upstream/BUILD | 14 ++- source/common/access_log/BUILD | 4 +- source/common/common/BUILD | 8 +- source/common/config/BUILD | 98 ++++++++++++------- source/common/event/BUILD | 10 +- source/common/filesystem/BUILD | 9 +- source/common/http/BUILD | 16 ++- source/common/network/BUILD | 32 ++++-- source/common/network/errormap.h | 2 + source/common/protobuf/BUILD | 6 +- source/common/ratelimit/BUILD | 8 +- source/common/router/BUILD | 20 ++-- source/common/secret/BUILD | 4 +- source/common/ssl/BUILD | 8 +- source/common/stats/BUILD | 4 +- source/common/tcp_proxy/BUILD | 4 +- source/common/upstream/BUILD | 60 ++++++++---- source/exe/BUILD | 6 +- source/extensions/access_loggers/file/BUILD | 4 +- .../extensions/access_loggers/http_grpc/BUILD | 8 +- source/extensions/all_extensions.bzl | 16 ++- source/extensions/extensions_build_config.bzl | 95 +++++++++++++++++- .../extensions/filters/common/ext_authz/BUILD | 8 +- source/extensions/filters/common/rbac/BUILD | 12 ++- source/extensions/filters/http/buffer/BUILD | 4 +- .../extensions/filters/http/ext_authz/BUILD | 4 +- source/extensions/filters/http/fault/BUILD | 4 +- .../filters/http/grpc_json_transcoder/BUILD | 11 ++- source/extensions/filters/http/gzip/BUILD | 4 +- .../filters/http/header_to_metadata/BUILD | 4 +- .../filters/http/health_check/BUILD | 4 +- .../extensions/filters/http/ip_tagging/BUILD | 4 +- .../extensions/filters/http/jwt_authn/BUILD | 8 +- .../extensions/filters/http/ratelimit/BUILD | 4 +- source/extensions/filters/http/rbac/BUILD | 4 +- source/extensions/filters/http/squash/BUILD | 4 +- .../filters/network/client_ssl_auth/BUILD | 4 +- .../filters/network/ext_authz/BUILD | 8 +- .../filters/network/mongo_proxy/BUILD | 4 +- .../filters/network/ratelimit/BUILD | 4 +- .../filters/network/redis_proxy/BUILD | 8 +- .../filters/network/thrift_proxy/BUILD | 4 +- .../file_based_metadata/BUILD | 4 +- source/extensions/health_checkers/redis/BUILD | 8 +- source/extensions/stat_sinks/dog_statsd/BUILD | 4 +- source/extensions/stat_sinks/hystrix/BUILD | 4 +- .../stat_sinks/metrics_service/BUILD | 10 +- source/extensions/stat_sinks/statsd/BUILD | 4 +- .../transport_sockets/capture/BUILD | 10 +- source/server/BUILD | 34 ++++--- source/server/config_validation/BUILD | 4 +- source/server/http/BUILD | 6 +- windows/bazel/get_workspace_status | 49 ++++++++++ windows/bazel/get_workspace_status.bat | 3 + windows/setup/workstation_setup.ps1 | 54 ++++++++++ windows/tools/bazel.rc | 7 ++ 85 files changed, 997 insertions(+), 219 deletions(-) create mode 100644 bazel/repositories.bat create mode 100755 ci/build_setup.ps1 create mode 100755 ci/do_ci.ps1 create mode 100644 include/envoy/common/socket_fd.h create mode 100644 include/envoy/common/ssize.h create mode 100644 source/common/network/errormap.h create mode 100755 windows/bazel/get_workspace_status create mode 100644 windows/bazel/get_workspace_status.bat create mode 100644 windows/setup/workstation_setup.ps1 create mode 100644 windows/tools/bazel.rc diff --git a/.gitignore b/.gitignore index db2be52a8b12..7f4c28b37948 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ SOURCE_VERSION .cache .vimrc .vscode +.vs diff --git a/api/bazel/api_build_system.bzl b/api/bazel/api_build_system.bzl index 8099e9f025aa..7536aa18388b 100644 --- a/api/bazel/api_build_system.bzl +++ b/api/bazel/api_build_system.bzl @@ -131,6 +131,13 @@ def api_proto_library(name, visibility = ["//visibility:private"], srcs = [], de ], visibility = ["//visibility:public"], ) + + native.cc_proto_library( + name = _Suffix(name, _CC_SUFFIX) + "_native", + deps = [name], + visibility = ["//visibility:public"], + ) + if (require_py == 1): api_py_proto_library(name, srcs, deps, has_services) diff --git a/api/bazel/repositories.bzl b/api/bazel/repositories.bzl index b1550bf7851a..338722313618 100644 --- a/api/bazel/repositories.bzl +++ b/api/bazel/repositories.bzl @@ -18,7 +18,7 @@ def api_dependencies(): 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", "cc_proto_library", "py_proto_library") +load("@com_google_protobuf//:protobuf.bzl", "py_proto_library", pb_cc_proto_library="cc_proto_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") filegroup( @@ -45,6 +45,12 @@ proto_library( ) cc_proto_library( + name = "http_api_protos_native", + deps = [":http_api_protos_proto"], + visibility = ["//visibility:public"], +) + +pb_cc_proto_library( name = "http_api_protos", srcs = [ "google/api/annotations.proto", @@ -93,7 +99,8 @@ proto_library( deps = ["@com_google_protobuf//:any_proto"], visibility = ["//visibility:public"], ) -cc_proto_library( + +pb_cc_proto_library( name = "rpc_status_protos", srcs = ["google/rpc/status.proto"], default_runtime = "@com_google_protobuf//:protobuf", @@ -133,7 +140,7 @@ py_proto_library( strip_prefix = "protobuf-" + GOGOPROTO_SHA, url = "https://github.com/gogo/protobuf/archive/" + GOGOPROTO_SHA + ".tar.gz", build_file_content = """ -load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library", "py_proto_library") +load("@com_google_protobuf//:protobuf.bzl", "py_proto_library", pb_cc_proto_library="cc_proto_library") load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") proto_library( @@ -154,7 +161,7 @@ go_proto_library( visibility = ["//visibility:public"], ) -cc_proto_library( +pb_cc_proto_library( name = "gogo_proto_cc", srcs = [ "gogoproto/gogo.proto", diff --git a/bazel/BUILD b/bazel/BUILD index 6a5258d5440b..223d2d0b7ee1 100644 --- a/bazel/BUILD +++ b/bazel/BUILD @@ -35,6 +35,35 @@ genrule( stamp = 1, ) +config_setting( + name = "windows_x86_64", + values = {"cpu": "x64_windows"}, +) + +config_setting( + name = "windows_opt_build", + values = { + "cpu": "x64_windows", + "compilation_mode": "opt", + }, +) + +config_setting( + name = "windows_dbg_build", + values = { + "cpu": "x64_windows", + "compilation_mode": "dbg", + }, +) + +config_setting( + name = "windows_fastbuild_build", + values = { + "cpu": "x64_windows", + "compilation_mode": "fastbuild", + }, +) + config_setting( name = "opt_build", values = {"compilation_mode": "opt"}, diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl index bf7885cc7d6c..3313c481a355 100644 --- a/bazel/envoy_build_system.bzl +++ b/bazel/envoy_build_system.bzl @@ -5,19 +5,40 @@ def envoy_package(): # Compute the final copts based on various options. def envoy_copts(repository, test = False): - return [ - "-Wall", - "-Wextra", - "-Werror", - "-Wnon-virtual-dtor", - "-Woverloaded-virtual", - "-Wold-style-cast", - "-std=c++14", - ] + select({ + posix_options = [ + "-Wall", + "-Wextra", + "-Werror", + "-Wnon-virtual-dtor", + "-Woverloaded-virtual", + "-Wold-style-cast", + "-std=c++14", + ] + + msvc_options = [ + "-WX", + "-DWIN32", + "-DDISABLE_PROTO_VALIDATE", + "-DWIN32_LEAN_AND_MEAN", + # need win8 for ntohll + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx + "-D_WIN32_WINNT=0x0602", + "-DNTDDI_VERSION=0x06020000", + "-DCARES_STATICLIB", + "-DNGHTTP2_STATICLIB", + ] + + return select({ + "//bazel:windows_x86_64": msvc_options, + "//conditions:default": posix_options, + }) + select({ # Bazel adds an implicit -DNDEBUG for opt. repository + "//bazel:opt_build": [] if test else ["-ggdb3"], repository + "//bazel:fastbuild_build": [], repository + "//bazel:dbg_build": ["-ggdb3"], + repository + "//bazel:windows_opt_build": [], + repository + "//bazel:windows_fastbuild_build": [], + repository + "//bazel:windows_dbg_build": [], }) + select({ repository + "//bazel:disable_tcmalloc": ["-DABSL_MALLOC_HOOK_MMAP_DISABLE"], "//conditions:default": ["-DTCMALLOC"], @@ -44,6 +65,9 @@ def envoy_linkopts(): # See note here: http://luajit.org/install.html "-pagezero_size 10000", "-image_base 100000000", ], + "//bazel:windows_x86_64": [ + "-DEFAULTLIB:advapi32.lib", + ], "//conditions:default": [ "-pthread", "-lrt", @@ -66,6 +90,8 @@ def _envoy_stamped_linkopts(): "-sectcreate __TEXT __build_id", "$(location @envoy//bazel:raw_build_id.ldscript)" ], + "//bazel:windows_x86_64": [], + # Note: assumes GNU GCC (or compatible) handling of `--build-id` flag. "//conditions:default": [ "-Wl,@$(location @envoy//bazel:gnu_build_id.ldscript)", @@ -115,6 +141,16 @@ def tcmalloc_external_deps(repository): "//conditions:default": [envoy_external_dep_path("tcmalloc_and_profiler")], }) +# Dependencies on libevent should be wrapped with this function. +def libevent_external_deps(repository): + return [envoy_external_dep_path("event")] + select({ + repository + "//bazel:windows_x86_64": [], + "//conditions:default": [envoy_external_dep_path("event_pthreads")], + }) + +def http_api_protos_external_deps(repository): + return envoy_protobuf_cc_select(repository, [envoy_external_dep_path("http_api_protos")]) + # Transform the package path (e.g. include/envoy/common) into a path for # exporting the package headers at (e.g. envoy/common). Source files can then # include using this path scheme (e.g. #include "envoy/common/time.h"). @@ -130,14 +166,27 @@ def envoy_include_prefix(path): def envoy_basic_cc_library(name, **kargs): native.cc_library(name = name, **kargs) +def envoy_windows_protobuf_cc_dep_path(dep): + return dep + "_native" + +def envoy_protobuf_cc_select(repository, deps = []): + windows_deps = [envoy_windows_protobuf_cc_dep_path(dep) for dep in deps] + return select({ + repository + "//bazel:windows_x86_64": windows_deps, + "//conditions:default": deps, + }) + # Envoy C++ library targets should be specified with this function. def envoy_cc_library(name, srcs = [], hdrs = [], copts = [], visibility = None, + protobuf_cc_deps = [], external_deps = [], tcmalloc_dep = None, + libevent_dep = None, + http_api_protos_dep = None, repository = "", linkstamp = None, tags = [], @@ -145,6 +194,11 @@ def envoy_cc_library(name, strip_include_prefix = None): if tcmalloc_dep: deps += tcmalloc_external_deps(repository) + if libevent_dep: + deps += libevent_external_deps(repository) + if http_api_protos_dep: + deps += http_api_protos_external_deps(repository) + native.cc_library( name = name, srcs = srcs, @@ -158,11 +212,14 @@ def envoy_cc_library(name, envoy_external_dep_path('abseil_strings'), envoy_external_dep_path('spdlog'), envoy_external_dep_path('fmtlib'), - ], + ] + envoy_protobuf_cc_select(repository, protobuf_cc_deps), include_prefix = envoy_include_prefix(PACKAGE_NAME), alwayslink = 1, linkstatic = 1, - linkstamp = linkstamp, + linkstamp = select({ + repository + "//bazel:windows_x86_64": None, + "//conditions:default": linkstamp, + }), strip_include_prefix = strip_include_prefix, ) @@ -458,5 +515,6 @@ def envoy_select_force_libcpp(if_libcpp, default = None): return select({ "@envoy//bazel:force_libcpp": if_libcpp, "@bazel_tools//tools/osx:darwin": [], + "//bazel:windows_x86_64": [], "//conditions:default": default or [], }) diff --git a/bazel/external/libcircllhist.BUILD b/bazel/external/libcircllhist.BUILD index 4e109f0b38d4..a937b65a382c 100644 --- a/bazel/external/libcircllhist.BUILD +++ b/bazel/external/libcircllhist.BUILD @@ -6,4 +6,8 @@ cc_library( ], includes = ["src"], visibility = ["//visibility:public"], + copts = select({ + "@envoy//bazel:windows_x86_64": ["-DWIN32"], + "//conditions:default": [], + }), ) diff --git a/bazel/repositories.bat b/bazel/repositories.bat new file mode 100644 index 000000000000..20bfb7245399 --- /dev/null +++ b/bazel/repositories.bat @@ -0,0 +1,4 @@ +echo "Start" +@ECHO OFF +bash -c "./repositories.sh %*" +exit %ERRORLEVEL% diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 6440a3a55c16..58bbbd115ef4 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -7,6 +7,11 @@ load(":genrule_repository.bzl", "genrule_repository") load(":patched_http_archive.bzl", "patched_http_archive") load(":repository_locations.bzl", "REPOSITORY_LOCATIONS") load(":target_recipes.bzl", "TARGET_RECIPES") +load("@bazel_tools//tools/cpp:windows_cc_configure.bzl", + "find_vc_path", + "setup_vc_env_vars", +) +load("@bazel_tools//tools/cpp:lib_cc_configure.bzl", "get_env_var") def _repository_impl(name, **kwargs): # `existing_rule_keys` contains the names of repositories that have already @@ -62,6 +67,7 @@ def _repository_impl(name, **kwargs): def _build_recipe_repository_impl(ctxt): # Setup the build directory with links to the relevant files. ctxt.symlink(Label("//bazel:repositories.sh"), "repositories.sh") + ctxt.symlink(Label("//bazel:repositories.bat"), "repositories.bat") ctxt.symlink(Label("//ci/build_container:build_and_install_deps.sh"), "build_and_install_deps.sh") ctxt.symlink(Label("//ci/build_container:recipe_wrapper.sh"), "recipe_wrapper.sh") @@ -72,11 +78,25 @@ def _build_recipe_repository_impl(ctxt): ctxt.symlink(Label("//ci/prebuilt:BUILD"), "BUILD") # Run the build script. - environment = {} + command = [] + env = {} + if ctxt.os.name.upper().startswith("WINDOWS"): + vc_path = find_vc_path(ctxt) + current_path = get_env_var(ctxt, "PATH", None, False) + env = setup_vc_env_vars(ctxt, vc_path) + env["PATH"]+=(";%s" % current_path) + env["CC"]="cl" + env["CXX"]="cl" + env["CXXFLAGS"] = "-DNDEBUG" + env["CFLAGS"] = "-DNDEBUG" + command = ["./repositories.bat"] + ctxt.attr.recipes + else: + command = ["./repositories.sh"] + ctxt.attr.recipes + print("Fetching external dependencies...") result = ctxt.execute( - ["./repositories.sh"] + ctxt.attr.recipes, - environment = environment, + command, + environment = env, quiet = False, ) print(result.stdout) @@ -186,6 +206,10 @@ def _envoy_api_deps(): name = "http_api_protos", actual = "@googleapis//:http_api_protos", ) + native.bind( + name = "http_api_protos_native", + actual = "@googleapis//:http_api_protos_native", + ) _repository_impl( name = "six_archive", build_file = "@com_google_protobuf//:six.BUILD", diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 25f45c35b5a3..d9a2f2d417d5 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -18,7 +18,7 @@ REPOSITORY_LOCATIONS = dict( remote = "https://github.com/bombela/backward-cpp", ), com_github_circonus_labs_libcircllhist = dict( - commit = "476687ac9cc636fc92ac3070246d757ae6854547", # 2018-05-08 + commit = "050da53a44dede7bda136b93a9aeef47bd91fa12", # 2018-07-02 remote = "https://github.com/circonus-labs/libcircllhist", ), com_github_cyan4973_xxhash = dict( diff --git a/ci/build_container/build_recipes/benchmark.sh b/ci/build_container/build_recipes/benchmark.sh index 5e8f2f41ab2c..2a4369a5fd29 100644 --- a/ci/build_container/build_recipes/benchmark.sh +++ b/ci/build_container/build_recipes/benchmark.sh @@ -6,13 +6,23 @@ export COMMIT="e1c3a83b8197cf02e794f61228461c27d4e78cfb" # benchmark @ Jan 11, git clone https://github.com/google/benchmark.git (cd benchmark; git reset --hard "$COMMIT") mkdir build - cd build -cmake -G "Unix Makefiles" ../benchmark \ + +cmake_generator="Unix Makefiles" +make_cmd=make +benchmark_lib="libbenchmark.a" + +if [[ "${OS}" == "Windows_NT" ]]; then + cmake_generator="Ninja" + make_cmd=ninja + benchmark_lib="benchmark.lib" +fi + +cmake -G "$cmake_generator" ../benchmark \ -DCMAKE_BUILD_TYPE=RELEASE \ -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -make -cp src/libbenchmark.a "$THIRDPARTY_BUILD"/lib +$make_cmd +cp "src/$benchmark_lib" "$THIRDPARTY_BUILD"/lib cd ../benchmark INCLUDE_DIR="$THIRDPARTY_BUILD/include/testing/base/public" diff --git a/ci/build_container/build_recipes/cares.sh b/ci/build_container/build_recipes/cares.sh index b3797f432e99..376cb03ae9d3 100755 --- a/ci/build_container/build_recipes/cares.sh +++ b/ci/build_container/build_recipes/cares.sh @@ -13,7 +13,21 @@ CFLAGS="$(for f in $CXXFLAGS; do if [[ ! $f =~ -D.* ]]; then echo $f; fi; done | wget -O c-ares-"$VERSION".tar.gz https://github.com/c-ares/c-ares/archive/"$VERSION".tar.gz tar xf c-ares-"$VERSION".tar.gz cd c-ares-"$VERSION" -./buildconf -./configure --prefix="$THIRDPARTY_BUILD" --enable-shared=no --enable-lib-only \ - --enable-debug --enable-optimize -make V=1 install + +if [[ "${OS}" == "Windows_NT" ]]; then + mkdir build + cd build + cmake -G "Ninja" -DCMAKE_INSTALL_PREFIX="$THIRDPARTY_BUILD" \ + -DCARES_SHARED=no \ + -DCARES_STATIC=on \ + -DCMAKE_BUILD_TYPE=Debug \ + .. + ninja + ninja install + cp "CMakeFiles/c-ares.dir/c-ares.pdb" "$THIRDPARTY_BUILD/lib/c-ares.pdb" +else + ./buildconf + ./configure --prefix="$THIRDPARTY_BUILD" --enable-shared=no --enable-lib-only \ + --enable-debug --enable-optimize + make V=1 install +fi diff --git a/ci/build_container/build_recipes/gperftools.sh b/ci/build_container/build_recipes/gperftools.sh index 7c0c72d9c6e6..f94c542c01ed 100755 --- a/ci/build_container/build_recipes/gperftools.sh +++ b/ci/build_container/build_recipes/gperftools.sh @@ -3,6 +3,9 @@ set -e VERSION=2.7 +if [[ "${OS}" == "Windows_NT" ]]; then + exit 0 +fi wget -O gperftools-"$VERSION".tar.gz https://github.com/gperftools/gperftools/releases/download/gperftools-"$VERSION"/gperftools-"$VERSION".tar.gz tar xf gperftools-"$VERSION".tar.gz diff --git a/ci/build_container/build_recipes/libevent.sh b/ci/build_container/build_recipes/libevent.sh index c88d5bb3a2ed..245f74a057f4 100755 --- a/ci/build_container/build_recipes/libevent.sh +++ b/ci/build_container/build_recipes/libevent.sh @@ -4,8 +4,29 @@ set -e VERSION=2.1.8-stable -wget -O libevent-"$VERSION".tar.gz https://github.com/libevent/libevent/releases/download/release-"$VERSION"/libevent-"$VERSION".tar.gz -tar xf libevent-"$VERSION".tar.gz -cd libevent-"$VERSION" -./configure --prefix="$THIRDPARTY_BUILD" --enable-shared=no --disable-libevent-regress --disable-openssl -make V=1 install +if [[ "${OS}" == "Windows_NT" ]]; then + wget -O libevent-"$VERSION".tar.gz https://github.com/libevent/libevent/archive/release-"$VERSION".tar.gz + tar xf libevent-"$VERSION".tar.gz + + cd libevent-release-"$VERSION" + + mkdir build + cd build + cmake -G "Ninja" \ + -DCMAKE_INSTALL_PREFIX="$THIRDPARTY_BUILD" \ + -DEVENT__DISABLE_OPENSSL:BOOL=on \ + -DEVENT__DISABLE_REGRESS:BOOL=on \ + -DCMAKE_BUILD_TYPE=Debug \ + .. + ninja + ninja install + cp "CMakeFiles/event.dir/event.pdb" "$THIRDPARTY_BUILD/lib/event.pdb" +else + wget -O libevent-"$VERSION".tar.gz https://github.com/libevent/libevent/releases/download/release-"$VERSION"/libevent-"$VERSION".tar.gz + tar xf libevent-"$VERSION".tar.gz + + cd libevent-"$VERSION" + + ./configure --prefix="$THIRDPARTY_BUILD" --enable-shared=no --disable-libevent-regress --disable-openssl + make V=1 install +fi diff --git a/ci/build_container/build_recipes/luajit.sh b/ci/build_container/build_recipes/luajit.sh index 4deba13a51d4..70c96c5b1770 100644 --- a/ci/build_container/build_recipes/luajit.sh +++ b/ci/build_container/build_recipes/luajit.sh @@ -46,15 +46,25 @@ index f7f81a4..e698517 100644 # Disable the JIT compiler, i.e. turn LuaJIT into a pure interpreter. #XCFLAGS+= -DLUAJIT_DISABLE_JIT @@ -564,7 +564,7 @@ endif - + Q= @ E= @echo -#Q= +Q= #E= @: - + ############################################################################## EOF -patch -p1 < ../luajit_make.diff -DEFAULT_CC=${CC} TARGET_CFLAGS=${CFLAGS} TARGET_LDFLAGS=${CFLAGS} CFLAGS="" make V=1 PREFIX="$THIRDPARTY_BUILD" install +if [[ "${OS}" == "Windows_NT" ]]; then + cd src + ./msvcbuild.bat debug + + mkdir -p "$THIRDPARTY_BUILD/include/luajit-2.0" + cp *.h* "$THIRDPARTY_BUILD/include/luajit-2.0" + cp luajit.lib "$THIRDPARTY_BUILD/lib" + cp *.pdb "$THIRDPARTY_BUILD/lib" +else + patch -p1 < ../luajit_make.diff + DEFAULT_CC=${CC} TARGET_CFLAGS=${CFLAGS} TARGET_LDFLAGS=${CFLAGS} CFLAGS="" make V=1 PREFIX="$THIRDPARTY_BUILD" install +fi diff --git a/ci/build_container/build_recipes/nghttp2.sh b/ci/build_container/build_recipes/nghttp2.sh index 1b380f3856d2..1693cfc8d824 100755 --- a/ci/build_container/build_recipes/nghttp2.sh +++ b/ci/build_container/build_recipes/nghttp2.sh @@ -7,5 +7,49 @@ VERSION=1.32.0 wget -O nghttp2-"$VERSION".tar.gz https://github.com/nghttp2/nghttp2/releases/download/v"$VERSION"/nghttp2-"$VERSION".tar.gz tar xf nghttp2-"$VERSION".tar.gz cd nghttp2-"$VERSION" -./configure --prefix="$THIRDPARTY_BUILD" --enable-shared=no --enable-lib-only -make V=1 install + +# Allow nghttp2 to build as static lib on Windows +cat > nghttp2_cmakelists.diff << 'EOF' +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 17e422b..b2e7a6e 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -37,8 +37,8 @@ if(WIN32) + set(NGHTTP2_RES ${CMAKE_CURRENT_BINARY_DIR}/version.rc) + endif() + +-# Public shared library +-add_library(nghttp2 SHARED ${NGHTTP2_SOURCES} ${NGHTTP2_RES}) ++# Public library ++add_library(nghttp2 ${NGHTTP2_SOURCES} ${NGHTTP2_RES}) + set_target_properties(nghttp2 PROPERTIES + COMPILE_FLAGS "${WARNCFLAGS}" + VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION} +@@ -49,6 +49,10 @@ target_include_directories(nghttp2 INTERFACE + "${CMAKE_CURRENT_SOURCE_DIR}/includes" + ) + ++if(NOT BUILD_SHARED_LIBS) ++ target_compile_definitions(nghttp2 PUBLIC "-DNGHTTP2_STATICLIB") ++endif() ++ + if(HAVE_CUNIT OR ENABLE_STATIC_LIB) + # Static library (for unittests because of symbol visibility) + add_library(nghttp2_static STATIC ${NGHTTP2_SOURCES}) +EOF + +if [[ "${OS}" == "Windows_NT" ]]; then + git apply nghttp2_cmakelists.diff + mkdir build + cd build + cmake -G "Ninja" -DCMAKE_INSTALL_PREFIX="$THIRDPARTY_BUILD" \ + -DENABLE_STATIC_LIB=on \ + -DENABLE_LIB_ONLY=on \ + .. + ninja + ninja install + cp "lib/CMakeFiles/nghttp2.dir/nghttp2.pdb" "$THIRDPARTY_BUILD/lib/nghttp2.pdb" +else + ./configure --prefix="$THIRDPARTY_BUILD" --enable-shared=no --enable-lib-only + make V=1 install +fi diff --git a/ci/build_container/build_recipes/yaml-cpp.sh b/ci/build_container/build_recipes/yaml-cpp.sh index db63dcb3a11e..7e760bdf09b8 100755 --- a/ci/build_container/build_recipes/yaml-cpp.sh +++ b/ci/build_container/build_recipes/yaml-cpp.sh @@ -7,8 +7,23 @@ VERSION=0.6.2 wget -O yaml-cpp-"$VERSION".tar.gz https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-"$VERSION".tar.gz tar xf yaml-cpp-"$VERSION".tar.gz cd yaml-cpp-yaml-cpp-"$VERSION" -cmake -DCMAKE_INSTALL_PREFIX:PATH="$THIRDPARTY_BUILD" \ - -DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS} ${CPPFLAGS}" \ - -DCMAKE_C_FLAGS:STRING="${CFLAGS} ${CPPFLAGS}" \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo . -make VERBOSE=1 install + +mkdir build +cd build + +if [[ "${OS}" == "Windows_NT" ]]; then + cmake -G"Ninja" -DCMAKE_INSTALL_PREFIX:PATH="$THIRDPARTY_BUILD" \ + -DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS} ${CPPFLAGS}" \ + -DCMAKE_C_FLAGS:STRING="${CFLAGS} ${CPPFLAGS}" \ + -DYAML_CPP_BUILD_TESTS=off \ + -DCMAKE_BUILD_TYPE=Debug .. + ninja + ninja install + cp "CMakeFiles/yaml-cpp.dir/yaml-cpp.pdb" "$THIRDPARTY_BUILD/lib/yaml-cpp.pdb" +else + cmake -DCMAKE_INSTALL_PREFIX:PATH="$THIRDPARTY_BUILD" \ + -DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS} ${CPPFLAGS}" \ + -DCMAKE_C_FLAGS:STRING="${CFLAGS} ${CPPFLAGS}" \ + -DCMAKE_BUILD_TYPE=RelWithDebugInfo .. + make VERBOSE=1 install +fi diff --git a/ci/build_container/build_recipes/zlib.sh b/ci/build_container/build_recipes/zlib.sh index fd22ea67f0af..8d1506d39f01 100644 --- a/ci/build_container/build_recipes/zlib.sh +++ b/ci/build_container/build_recipes/zlib.sh @@ -7,5 +7,15 @@ VERSION=1.2.11 wget -O zlib-"$VERSION".tar.gz https://github.com/madler/zlib/archive/v"$VERSION".tar.gz tar xf zlib-"$VERSION".tar.gz cd zlib-"$VERSION" -./configure --prefix="$THIRDPARTY_BUILD" -make V=1 install + +if [[ "${OS}" == "Windows_NT" ]]; then + mkdir build + cd build + cmake -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="$THIRDPARTY_BUILD" .. + ninja + ninja install + cp "CMakeFiles/zlibstatic.dir/zlibstatic.pdb" "$THIRDPARTY_BUILD/lib/zlibstatic.pdb" +else + ./configure --prefix="$THIRDPARTY_BUILD" + make V=1 install +fi diff --git a/ci/build_setup.ps1 b/ci/build_setup.ps1 new file mode 100755 index 000000000000..5ec926493754 --- /dev/null +++ b/ci/build_setup.ps1 @@ -0,0 +1,22 @@ +$ErrorActionPreference = "Stop"; +trap { $host.SetShouldExit(1) } + +if ("$env:NUM_CPUS" -eq "") { + $env:NUM_CPUS = (Get-WmiObject -class Win32_computersystem).NumberOfLogicalProcessors +} + +if ("$env:ENVOY_BAZEL_ROOT" -eq "") { + Write-Host "ENVOY_BAZEL_ROOT must be set!" + throw +} + +mkdir -force "$env:ENVOY_BAZEL_ROOT" > $nul + +$env:ENVOY_SRCDIR = [System.IO.Path]::GetFullPath("$PSScriptRoot\..") + +echo "ENVOY_BAZEL_ROOT: $env:ENVOY_BAZEL_ROOT" +echo "ENVOY_SRCDIR: $env:ENVOY_SRCDIR" + +$env:BAZEL_BASE_OPTIONS="--output_base=$env:ENVOY_BAZEL_ROOT --bazelrc=$env:ENVOY_SRCDIR\windows\tools\bazel.rc --batch" +$env:BAZEL_BUILD_OPTIONS="--strategy=Genrule=standalone --spawn_strategy=standalone --verbose_failures --action_env=HOME --action_env=PYTHONUSERBASE --jobs=$env:NUM_CPUS --show_task_finish $env:BAZEL_BUILD_EXTRA_OPTIONS" +$env:BAZEL_TEST_OPTIONS="$env:BAZEL_BUILD_OPTIONS --test_env=HOME --test_env=PYTHONUSERBASE --test_env=UBSAN_OPTIONS=print_stacktrace=1 --cache_test_results=no --test_output=all $env:BAZEL_EXTRA_TEST_OPTIONS" diff --git a/ci/do_ci.ps1 b/ci/do_ci.ps1 new file mode 100755 index 000000000000..fa0aa691c1a7 --- /dev/null +++ b/ci/do_ci.ps1 @@ -0,0 +1,20 @@ +$ErrorActionPreference = "Stop"; +trap { $host.SetShouldExit(1) } + +. "$PSScriptRoot\build_setup.ps1" +Write-Host "building using $env:NUM_CPUS CPUs" + +function bazel_debug_binary_build() { + echo "Building..." + pushd "$env:ENVOY_SRCDIR" + bazel $env:BAZEL_BASE_OPTIONS.Split(" ") build $env:BAZEL_BUILD_OPTIONS.Split(" ") -c dbg "//source/exe:envoy-static" + $exit = $LASTEXITCODE + if ($exit -ne 0) { + popd + exit $exit + } + popd +} + +echo "bazel debug build..." +bazel_debug_binary_build diff --git a/ci/prebuilt/BUILD b/ci/prebuilt/BUILD index 691644568905..37a16486298b 100644 --- a/ci/prebuilt/BUILD +++ b/ci/prebuilt/BUILD @@ -4,21 +4,30 @@ package(default_visibility = ["//visibility:public"]) cc_library( name = "ares", - srcs = ["thirdparty_build/lib/libcares.a"], + srcs = glob([ + "thirdparty_build/lib/libcares.a", + "thirdparty_build/lib/cares.lib", + ]), hdrs = glob(["thirdparty_build/include/ares*.h"]), includes = ["thirdparty_build/include"], ) cc_library( name = "benchmark", - srcs = ["thirdparty_build/lib/libbenchmark.a"], + srcs = glob([ + "thirdparty_build/lib/libbenchmark.a", + "thirdparty_build/lib/benchmark.lib", + ]), hdrs = ["thirdparty_build/include/testing/base/public/benchmark.h"], includes = ["thirdparty_build/include"], ) cc_library( name = "event", - srcs = ["thirdparty_build/lib/libevent.a"], + srcs = glob([ + "thirdparty_build/lib/libevent.a", + "thirdparty_build/lib/event.lib", + ]), hdrs = glob(["thirdparty_build/include/event2/**/*.h"]), includes = ["thirdparty_build/include"], ) @@ -31,7 +40,10 @@ cc_library( cc_library( name = "luajit", - srcs = ["thirdparty_build/lib/libluajit-5.1.a"], + srcs = glob([ + "thirdparty_build/lib/libluajit-5.1.a", + "thirdparty_build/lib/luajit.lib", + ]), hdrs = glob(["thirdparty_build/include/luajit-2.0/*"]), includes = ["thirdparty_build/include"], # TODO(mattklein123): We should strip luajit-2.0 here for consumers. However, if we do that @@ -40,7 +52,10 @@ cc_library( cc_library( name = "nghttp2", - srcs = ["thirdparty_build/lib/libnghttp2.a"], + srcs = glob([ + "thirdparty_build/lib/libnghttp2.a", + "thirdparty_build/lib/nghttp2.lib", + ]), hdrs = glob(["thirdparty_build/include/nghttp2/**/*.h"]), includes = ["thirdparty_build/include"], ) @@ -54,14 +69,20 @@ cc_library( cc_library( name = "yaml_cpp", - srcs = ["thirdparty_build/lib/libyaml-cpp.a"], + srcs = glob([ + "thirdparty_build/lib/libyaml-cpp.a", + "thirdparty_build/lib/libyaml-cpp*.lib", + ]), hdrs = glob(["thirdparty_build/include/yaml-cpp/**/*.h"]), includes = ["thirdparty_build/include"], ) cc_library( name = "zlib", - srcs = ["thirdparty_build/lib/libz.a"], + srcs = glob([ + "thirdparty_build/lib/libz.a", + "thirdparty_build/lib/zlibstaticd.lib", + ]), hdrs = [ "thirdparty_build/include/zconf.h", "thirdparty_build/include/zlib.h", diff --git a/include/envoy/common/BUILD b/include/envoy/common/BUILD index dee9f10b4479..c9cc604ef68e 100644 --- a/include/envoy/common/BUILD +++ b/include/envoy/common/BUILD @@ -14,6 +14,8 @@ envoy_basic_cc_library( hdrs = [ "exception.h", "pure.h", + "socket_fd.h", + "ssize.h", ], include_prefix = "envoy/common", ) diff --git a/include/envoy/common/socket_fd.h b/include/envoy/common/socket_fd.h new file mode 100644 index 000000000000..d1c95f0c2580 --- /dev/null +++ b/include/envoy/common/socket_fd.h @@ -0,0 +1,2 @@ +// empty header file so Bazel doesn't complain +// NOLINT(namespace-envoy) diff --git a/include/envoy/common/ssize.h b/include/envoy/common/ssize.h new file mode 100644 index 000000000000..d1c95f0c2580 --- /dev/null +++ b/include/envoy/common/ssize.h @@ -0,0 +1,2 @@ +// empty header file so Bazel doesn't complain +// NOLINT(namespace-envoy) diff --git a/include/envoy/grpc/BUILD b/include/envoy/grpc/BUILD index e908c917d928..5435486cd45f 100644 --- a/include/envoy/grpc/BUILD +++ b/include/envoy/grpc/BUILD @@ -23,17 +23,19 @@ envoy_cc_library( envoy_cc_library( name = "async_client_manager_interface", hdrs = ["async_client_manager.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:grpc_service_cc", + ], deps = [ ":async_client_interface", "//include/envoy/stats:stats_interface", - "@envoy_api//envoy/api/v2/core:grpc_service_cc", ], ) envoy_cc_library( name = "google_grpc_creds_interface", hdrs = ["google_grpc_creds.h"], - deps = [ + protobuf_cc_deps = [ "@envoy_api//envoy/api/v2/core:grpc_service_cc", ], ) diff --git a/include/envoy/local_info/BUILD b/include/envoy/local_info/BUILD index 103028e273f5..0ffdfc105bd7 100644 --- a/include/envoy/local_info/BUILD +++ b/include/envoy/local_info/BUILD @@ -11,8 +11,10 @@ envoy_package() envoy_cc_library( name = "local_info_interface", hdrs = ["local_info.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ "//include/envoy/network:address_interface", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) diff --git a/include/envoy/network/BUILD b/include/envoy/network/BUILD index 31781824fa09..38ef8981b33b 100644 --- a/include/envoy/network/BUILD +++ b/include/envoy/network/BUILD @@ -62,9 +62,11 @@ envoy_cc_library( envoy_cc_library( name = "listen_socket_interface", hdrs = ["listen_socket.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ "//include/envoy/network:address_interface", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) diff --git a/include/envoy/router/BUILD b/include/envoy/router/BUILD index 290010fe8c4c..170d48c4923e 100644 --- a/include/envoy/router/BUILD +++ b/include/envoy/router/BUILD @@ -17,6 +17,9 @@ envoy_cc_library( envoy_cc_library( name = "route_config_provider_manager_interface", hdrs = ["route_config_provider_manager.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/network/http_connection_manager/v2:http_connection_manager_cc", + ], deps = [ ":rds_interface", "//include/envoy/event:dispatcher_interface", @@ -28,7 +31,6 @@ envoy_cc_library( "//include/envoy/stats:stats_interface", "//include/envoy/thread_local:thread_local_interface", "//include/envoy/upstream:cluster_manager_interface", - "@envoy_api//envoy/config/filter/network/http_connection_manager/v2:http_connection_manager_cc", ], ) @@ -36,6 +38,9 @@ envoy_cc_library( name = "router_interface", hdrs = ["router.h"], external_deps = ["abseil_optional"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:rds_cc", + ], deps = [ "//include/envoy/access_log:access_log_interface", "//include/envoy/http:codec_interface", @@ -46,7 +51,6 @@ envoy_cc_library( "//include/envoy/upstream:resource_manager_interface", "//source/common/protobuf", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/api/v2:rds_cc", ], ) diff --git a/include/envoy/secret/BUILD b/include/envoy/secret/BUILD index c4dcf8404fd6..5a88fea67617 100644 --- a/include/envoy/secret/BUILD +++ b/include/envoy/secret/BUILD @@ -11,8 +11,10 @@ envoy_package() envoy_cc_library( name = "secret_manager_interface", hdrs = ["secret_manager.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/auth:cert_cc", + ], deps = [ "//include/envoy/ssl:tls_certificate_config_interface", - "@envoy_api//envoy/api/v2/auth:cert_cc", ], ) diff --git a/include/envoy/server/BUILD b/include/envoy/server/BUILD index fae78b50ab2a..ab6298ca2603 100644 --- a/include/envoy/server/BUILD +++ b/include/envoy/server/BUILD @@ -134,6 +134,9 @@ envoy_cc_library( envoy_cc_library( name = "filter_config_interface", hdrs = ["filter_config.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ ":admin_interface", "//include/envoy/access_log:access_log_interface", @@ -151,13 +154,15 @@ envoy_cc_library( "//source/common/common:assert_lib", "//source/common/common:macros", "//source/common/protobuf", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) envoy_cc_library( name = "listener_manager_interface", hdrs = ["listener_manager.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/listener:listener_cc", + ], deps = [ ":drain_manager_interface", ":filter_config_interface", @@ -166,7 +171,6 @@ envoy_cc_library( "//include/envoy/network:listen_socket_interface", "//include/envoy/ssl:context_interface", "//source/common/protobuf", - "@envoy_api//envoy/api/v2/listener:listener_cc", ], ) diff --git a/include/envoy/upstream/BUILD b/include/envoy/upstream/BUILD index 60f3c7ba4bdc..6a45a62154cb 100644 --- a/include/envoy/upstream/BUILD +++ b/include/envoy/upstream/BUILD @@ -11,6 +11,10 @@ envoy_package() envoy_cc_library( name = "cluster_manager_interface", hdrs = ["cluster_manager.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:cds_cc", + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", + ], deps = [ ":load_balancer_interface", ":thread_local_cluster_interface", @@ -24,8 +28,6 @@ envoy_cc_library( "//include/envoy/runtime:runtime_interface", "//include/envoy/secret:secret_manager_interface", "//include/envoy/server:admin_interface", - "@envoy_api//envoy/api/v2:cds_cc", - "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", ], ) @@ -43,12 +45,14 @@ envoy_cc_library( envoy_cc_library( name = "host_description_interface", hdrs = ["host_description.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ ":health_check_host_monitor_interface", ":outlier_detection_interface", "//include/envoy/network:address_interface", "//include/envoy/stats:stats_macros", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) @@ -64,9 +68,11 @@ envoy_cc_library( envoy_cc_library( name = "load_balancer_type_interface", hdrs = ["load_balancer_type.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:cds_cc", + ], deps = [ "//source/common/protobuf", - "@envoy_api//envoy/api/v2:cds_cc", ], ) diff --git a/source/common/access_log/BUILD b/source/common/access_log/BUILD index afbca0e51e2c..d29456a6b07e 100644 --- a/source/common/access_log/BUILD +++ b/source/common/access_log/BUILD @@ -37,6 +37,9 @@ envoy_cc_library( name = "access_log_lib", srcs = ["access_log_impl.cc"], hdrs = ["access_log_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/accesslog/v2:accesslog_cc", + ], deps = [ "//include/envoy/access_log:access_log_interface", "//include/envoy/filesystem:filesystem_interface", @@ -55,6 +58,5 @@ envoy_cc_library( "//source/common/request_info:request_info_lib", "//source/common/runtime:uuid_util_lib", "//source/common/tracing:http_tracer_lib", - "@envoy_api//envoy/config/filter/accesslog/v2:accesslog_cc", ], ) diff --git a/source/common/common/BUILD b/source/common/common/BUILD index 9d070f59939b..373761367359 100644 --- a/source/common/common/BUILD +++ b/source/common/common/BUILD @@ -118,13 +118,15 @@ envoy_cc_library( srcs = ["matchers.cc"], hdrs = ["matchers.h"], external_deps = ["abseil_optional"], + protobuf_cc_deps = [ + "@envoy_api//envoy/type/matcher:metadata_cc", + "@envoy_api//envoy/type/matcher:number_cc", + "@envoy_api//envoy/type/matcher:string_cc", + ], deps = [ ":utility_lib", "//source/common/config:metadata_lib", "//source/common/protobuf", - "@envoy_api//envoy/type/matcher:metadata_cc", - "@envoy_api//envoy/type/matcher:number_cc", - "@envoy_api//envoy/type/matcher:string_cc", ], ) diff --git a/source/common/config/BUILD b/source/common/config/BUILD index 83067aa8806e..65c562500896 100644 --- a/source/common/config/BUILD +++ b/source/common/config/BUILD @@ -12,12 +12,14 @@ envoy_cc_library( name = "address_json_lib", srcs = ["address_json.cc"], hdrs = ["address_json.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:address_cc", + ], deps = [ "//include/envoy/json:json_object_interface", "//source/common/common:assert_lib", "//source/common/network:cidr_range_lib", "//source/common/network:utility_lib", - "@envoy_api//envoy/api/v2/core:address_cc", ], ) @@ -25,6 +27,9 @@ envoy_cc_library( name = "bootstrap_json_lib", srcs = ["bootstrap_json.cc"], hdrs = ["bootstrap_json.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", + ], deps = [ ":address_json_lib", ":cds_json_lib", @@ -36,7 +41,6 @@ envoy_cc_library( "//source/common/json:config_schemas_lib", "//source/common/protobuf:utility_lib", "//source/extensions/stat_sinks:well_known_names", - "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", ], ) @@ -44,9 +48,11 @@ envoy_cc_library( name = "base_json_lib", srcs = ["base_json.cc"], hdrs = ["base_json.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ "//include/envoy/json:json_object_interface", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) @@ -55,6 +61,10 @@ envoy_cc_library( srcs = ["cds_json.cc"], hdrs = ["cds_json.h"], external_deps = ["abseil_optional"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:cds_cc", + "@envoy_api//envoy/api/v2/cluster:circuit_breaker_cc", + ], deps = [ ":address_json_lib", ":json_utility_lib", @@ -66,8 +76,6 @@ envoy_cc_library( "//source/common/common:assert_lib", "//source/common/json:config_schemas_lib", "//source/common/network:utility_lib", - "@envoy_api//envoy/api/v2:cds_cc", - "@envoy_api//envoy/api/v2/cluster:circuit_breaker_cc", ], ) @@ -89,9 +97,11 @@ envoy_cc_library( name = "datasource_lib", srcs = ["datasource.cc"], hdrs = ["datasource.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ "//source/common/filesystem:filesystem_lib", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) @@ -99,20 +109,7 @@ envoy_cc_library( name = "filter_json_lib", srcs = ["filter_json.cc"], hdrs = ["filter_json.h"], - deps = [ - ":address_json_lib", - ":json_utility_lib", - ":protocol_json_lib", - ":rds_json_lib", - ":utility_lib", - "//include/envoy/json:json_object_interface", - "//source/common/common:assert_lib", - "//source/common/common:utility_lib", - "//source/common/json:config_schemas_lib", - "//source/common/protobuf", - "//source/common/protobuf:utility_lib", - "//source/extensions/access_loggers:well_known_names", - "//source/extensions/filters/http:well_known_names", + protobuf_cc_deps = [ "@envoy_api//envoy/config/accesslog/v2:file_cc", "@envoy_api//envoy/config/filter/http/buffer/v2:buffer_cc", "@envoy_api//envoy/config/filter/http/fault/v2:fault_cc", @@ -130,6 +127,21 @@ envoy_cc_library( "@envoy_api//envoy/config/filter/network/redis_proxy/v2:redis_proxy_cc", "@envoy_api//envoy/config/filter/network/tcp_proxy/v2:tcp_proxy_cc", ], + deps = [ + ":address_json_lib", + ":json_utility_lib", + ":protocol_json_lib", + ":rds_json_lib", + ":utility_lib", + "//include/envoy/json:json_object_interface", + "//source/common/common:assert_lib", + "//source/common/common:utility_lib", + "//source/common/json:config_schemas_lib", + "//source/common/protobuf", + "//source/common/protobuf:utility_lib", + "//source/extensions/access_loggers:well_known_names", + "//source/extensions/filters/http:well_known_names", + ], ) envoy_cc_library( @@ -151,6 +163,9 @@ envoy_cc_library( envoy_cc_library( name = "grpc_mux_subscription_lib", hdrs = ["grpc_mux_subscription_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:discovery_cc", + ], deps = [ "//include/envoy/config:grpc_mux_interface", "//include/envoy/config:subscription_interface", @@ -158,28 +173,30 @@ envoy_cc_library( "//source/common/common:minimal_logger_lib", "//source/common/grpc:common_lib", "//source/common/protobuf", - "@envoy_api//envoy/api/v2:discovery_cc", ], ) envoy_cc_library( name = "grpc_subscription_lib", hdrs = ["grpc_subscription_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ ":grpc_mux_lib", ":grpc_mux_subscription_lib", "//include/envoy/config:subscription_interface", "//include/envoy/event:dispatcher_interface", "//include/envoy/grpc:async_client_interface", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) envoy_cc_library( name = "http_subscription_lib", hdrs = ["http_subscription_impl.h"], - external_deps = [ - "http_api_protos", + http_api_protos_dep = True, + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", ], deps = [ "//include/envoy/config:subscription_interface", @@ -190,7 +207,6 @@ envoy_cc_library( "//source/common/http:rest_api_fetcher_lib", "//source/common/protobuf", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) @@ -208,6 +224,9 @@ envoy_cc_library( name = "lds_json_lib", srcs = ["lds_json.cc"], hdrs = ["lds_json.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:lds_cc", + ], deps = [ ":address_json_lib", ":json_utility_lib", @@ -218,7 +237,6 @@ envoy_cc_library( "//source/common/json:config_schemas_lib", "//source/common/network:utility_lib", "//source/extensions/filters/network:well_known_names", - "@envoy_api//envoy/api/v2:lds_cc", ], ) @@ -226,16 +244,18 @@ envoy_cc_library( name = "metadata_lib", srcs = ["metadata.cc"], hdrs = ["metadata.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ "//source/common/protobuf", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) envoy_cc_library( name = "protobuf_link_hacks", hdrs = ["protobuf_link_hacks.h"], - deps = [ + protobuf_cc_deps = [ "@envoy_api//envoy/service/discovery/v2:ads_cc", "@envoy_api//envoy/service/ratelimit/v2:rls_cc", ], @@ -245,10 +265,12 @@ envoy_cc_library( name = "protocol_json_lib", srcs = ["protocol_json.cc"], hdrs = ["protocol_json.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:protocol_cc", + ], deps = [ ":json_utility_lib", "//include/envoy/json:json_object_interface", - "@envoy_api//envoy/api/v2/core:protocol_cc", ], ) @@ -262,6 +284,9 @@ envoy_cc_library( name = "rds_json_lib", srcs = ["rds_json.cc"], hdrs = ["rds_json.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:rds_cc", + ], deps = [ ":base_json_lib", ":json_utility_lib", @@ -271,13 +296,15 @@ envoy_cc_library( "//source/common/config:utility_lib", "//source/common/json:config_schemas_lib", "//source/extensions/filters/http:well_known_names", - "@envoy_api//envoy/api/v2:rds_cc", ], ) envoy_cc_library( name = "subscription_factory_lib", hdrs = ["subscription_factory.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ ":filesystem_subscription_lib", ":grpc_mux_subscription_lib", @@ -288,7 +315,6 @@ envoy_cc_library( "//include/envoy/upstream:cluster_manager_interface", "//source/common/filesystem:filesystem_lib", "//source/common/protobuf", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) @@ -296,11 +322,13 @@ envoy_cc_library( name = "tls_context_json_lib", srcs = ["tls_context_json.cc"], hdrs = ["tls_context_json.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/auth:cert_cc", + ], deps = [ ":json_utility_lib", "//include/envoy/json:json_object_interface", "//source/common/common:utility_lib", - "@envoy_api//envoy/api/v2/auth:cert_cc", ], ) @@ -308,6 +336,10 @@ envoy_cc_library( name = "utility_lib", srcs = ["utility.cc"], hdrs = ["utility.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + "@envoy_api//envoy/config/filter/network/http_connection_manager/v2:http_connection_manager_cc", + ], deps = [ ":json_utility_lib", ":resources_lib", @@ -326,8 +358,6 @@ envoy_cc_library( "//source/common/protobuf:utility_lib", "//source/common/singleton:const_singleton", "//source/common/stats:stats_lib", - "@envoy_api//envoy/api/v2/core:base_cc", - "@envoy_api//envoy/config/filter/network/http_connection_manager/v2:http_connection_manager_cc", ], ) diff --git a/source/common/event/BUILD b/source/common/event/BUILD index 68420b3312b5..85c0bc7d7327 100644 --- a/source/common/event/BUILD +++ b/source/common/event/BUILD @@ -57,10 +57,7 @@ envoy_cc_library( name = "libevent_lib", srcs = ["libevent.cc"], hdrs = ["libevent.h"], - external_deps = [ - "event", - "event_pthreads", - ], + libevent_dep = 1, deps = [ "//source/common/common:assert_lib", "//source/common/common:c_smart_ptr_lib", @@ -71,10 +68,7 @@ envoy_cc_library( name = "dispatched_thread_lib", srcs = ["dispatched_thread.cc"], hdrs = ["dispatched_thread.h"], - external_deps = [ - "event", - "event_pthreads", - ], + libevent_dep = 1, deps = [ ":dispatcher_lib", "//include/envoy/event:dispatcher_interface", diff --git a/source/common/filesystem/BUILD b/source/common/filesystem/BUILD index b548a0321326..689cbc326898 100644 --- a/source/common/filesystem/BUILD +++ b/source/common/filesystem/BUILD @@ -25,6 +25,9 @@ envoy_cc_library( envoy_cc_library( name = "watcher_lib", srcs = select({ + "//bazel:windows_x86_64": [ + "win32/watcher_impl.cc", + ], "@bazel_tools//tools/osx:darwin": [ "kqueue/watcher_impl.cc", ], @@ -33,6 +36,9 @@ envoy_cc_library( ], }), hdrs = select({ + "//bazel:windows_x86_64": [ + "win32/watcher_impl.h", + ], "@bazel_tools//tools/osx:darwin": [ "kqueue/watcher_impl.h", ], @@ -40,8 +46,9 @@ envoy_cc_library( "inotify/watcher_impl.h", ], }), - external_deps = ["event"], + libevent_dep = 1, strip_include_prefix = select({ + "//bazel:windows_x86_64": "win32", "@bazel_tools//tools/osx:darwin": "kqueue", "//conditions:default": "inotify", }), diff --git a/source/common/http/BUILD b/source/common/http/BUILD index 002c311e35bd..b374ceafc9e9 100644 --- a/source/common/http/BUILD +++ b/source/common/http/BUILD @@ -72,6 +72,9 @@ envoy_cc_library( name = "codes_lib", srcs = ["codes.cc"], hdrs = ["codes.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/type:http_status_cc", + ], deps = [ ":headers_lib", ":utility_lib", @@ -80,7 +83,6 @@ envoy_cc_library( "//include/envoy/stats:stats_interface", "//source/common/common:enum_to_int", "//source/common/common:utility_lib", - "@envoy_api//envoy/type:http_status_cc", ], ) @@ -236,6 +238,10 @@ envoy_cc_library( name = "utility_lib", srcs = ["utility.cc"], hdrs = ["utility.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:http_uri_cc", + "@envoy_api//envoy/api/v2/core:protocol_cc", + ], deps = [ ":exception_lib", ":header_map_lib", @@ -254,8 +260,6 @@ envoy_cc_library( "//source/common/json:json_loader_lib", "//source/common/network:utility_lib", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/api/v2/core:http_uri_cc", - "@envoy_api//envoy/api/v2/core:protocol_cc", ], ) @@ -273,13 +277,15 @@ envoy_cc_library( name = "header_utility_lib", srcs = ["header_utility.cc"], hdrs = ["header_utility.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/route:route_cc", + "@envoy_api//envoy/type:range_cc", + ], deps = [ "//include/envoy/http:header_map_interface", "//include/envoy/json:json_object_interface", "//source/common/common:utility_lib", "//source/common/config:rds_json_lib", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/api/v2/route:route_cc", - "@envoy_api//envoy/type:range_cc", ], ) diff --git a/source/common/network/BUILD b/source/common/network/BUILD index 1ae34e6438b1..34ddade671bd 100644 --- a/source/common/network/BUILD +++ b/source/common/network/BUILD @@ -14,6 +14,7 @@ envoy_cc_library( srcs = ["address_impl.cc"], hdrs = ["address_impl.h"], deps = [ + ":errormap_lib", "//include/envoy/network:address_interface", "//source/common/common:assert_lib", "//source/common/common:utility_lib", @@ -24,6 +25,9 @@ envoy_cc_library( name = "cidr_range_lib", srcs = ["cidr_range.cc"], hdrs = ["cidr_range.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:address_cc", + ], deps = [ ":address_lib", ":utility_lib", @@ -31,7 +35,6 @@ envoy_cc_library( "//include/envoy/network:address_interface", "//source/common/common:assert_lib", "//source/common/common:utility_lib", - "@envoy_api//envoy/api/v2/core:address_cc", ], ) @@ -42,6 +45,7 @@ envoy_cc_library( external_deps = ["abseil_optional"], deps = [ ":address_lib", + ":errormap_lib", ":filter_manager_lib", ":raw_buffer_socket_lib", ":utility_lib", @@ -82,6 +86,11 @@ envoy_cc_library( hdrs = ["filter_impl.h"], ) +envoy_cc_library( + name = "errormap_lib", + hdrs = ["errormap.h"], +) + envoy_cc_library( name = "filter_manager_lib", srcs = ["filter_manager_impl.cc"], @@ -113,6 +122,7 @@ envoy_cc_library( hdrs = ["listen_socket_impl.h"], deps = [ ":address_lib", + ":errormap_lib", ":utility_lib", "//include/envoy/network:listen_socket_interface", "//source/common/common:assert_lib", @@ -130,6 +140,7 @@ envoy_cc_library( ], deps = [ ":address_lib", + ":errormap_lib", ":listen_socket_lib", "//include/envoy/event:dispatcher_interface", "//include/envoy/event:file_event_interface", @@ -148,14 +159,17 @@ envoy_cc_library( name = "raw_buffer_socket_lib", srcs = ["raw_buffer_socket.cc"], hdrs = ["raw_buffer_socket.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ + ":errormap_lib", ":utility_lib", "//include/envoy/network:connection_interface", "//include/envoy/network:transport_socket_interface", "//source/common/buffer:buffer_lib", "//source/common/common:empty_string", "//source/common/http:headers_lib", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) @@ -163,6 +177,9 @@ envoy_cc_library( name = "resolver_lib", srcs = ["resolver_impl.cc"], hdrs = ["resolver_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ ":utility_lib", "//include/envoy/network:address_interface", @@ -171,7 +188,6 @@ envoy_cc_library( "//source/common/config:well_known_names", "//source/common/network:address_lib", "//source/common/protobuf", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) @@ -209,13 +225,15 @@ envoy_cc_library( srcs = ["socket_option_factory.cc"], hdrs = ["socket_option_factory.h"], external_deps = ["abseil_optional"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:address_cc", + ], deps = [ ":addr_family_aware_socket_option_lib", ":address_lib", ":socket_option_lib", "//include/envoy/network:listen_socket_interface", "//source/common/common:logger_lib", - "@envoy_api//envoy/api/v2/core:address_cc", ], ) @@ -223,6 +241,10 @@ envoy_cc_library( name = "utility_lib", srcs = ["utility.cc"], hdrs = ["utility.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:address_cc", + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ ":address_lib", "//include/envoy/network:connection_interface", @@ -230,7 +252,5 @@ envoy_cc_library( "//source/common/common:assert_lib", "//source/common/common:utility_lib", "//source/common/protobuf", - "@envoy_api//envoy/api/v2/core:address_cc", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) diff --git a/source/common/network/errormap.h b/source/common/network/errormap.h new file mode 100644 index 000000000000..d1c95f0c2580 --- /dev/null +++ b/source/common/network/errormap.h @@ -0,0 +1,2 @@ +// empty header file so Bazel doesn't complain +// NOLINT(namespace-envoy) diff --git a/source/common/protobuf/BUILD b/source/common/protobuf/BUILD index bb7d80348019..ef4e6755bf71 100644 --- a/source/common/protobuf/BUILD +++ b/source/common/protobuf/BUILD @@ -13,8 +13,10 @@ proto_library( deps = [ "@com_google_protobuf//:any_proto", "@com_google_protobuf//:descriptor_proto", + "@com_google_protobuf//:duration_proto", "@com_google_protobuf//:empty_proto", "@com_google_protobuf//:struct_proto", + "@com_google_protobuf//:timestamp_proto", "@com_google_protobuf//:wrappers_proto", ], ) @@ -38,6 +40,9 @@ envoy_cc_library( srcs = ["utility.cc"], hdrs = ["utility.h"], external_deps = ["protobuf"], + protobuf_cc_deps = [ + "@envoy_api//envoy/type:percent_cc", + ], deps = [ ":protobuf", "//source/common/common:assert_lib", @@ -45,6 +50,5 @@ envoy_cc_library( "//source/common/common:utility_lib", "//source/common/filesystem:filesystem_lib", "//source/common/json:json_loader_lib", - "@envoy_api//envoy/type:percent_cc", ], ) diff --git a/source/common/ratelimit/BUILD b/source/common/ratelimit/BUILD index 60ea694e3a06..0af99b530b0b 100644 --- a/source/common/ratelimit/BUILD +++ b/source/common/ratelimit/BUILD @@ -13,6 +13,11 @@ envoy_cc_library( name = "ratelimit_lib", srcs = ["ratelimit_impl.cc"], hdrs = ["ratelimit_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/ratelimit:ratelimit_cc", + "@envoy_api//envoy/config/ratelimit/v2:rls_cc", + "@envoy_api//envoy/service/ratelimit/v2:rls_cc", + ], deps = [ ":ratelimit_proto", "//include/envoy/grpc:async_client_interface", @@ -23,9 +28,6 @@ envoy_cc_library( "//source/common/common:minimal_logger_lib", "//source/common/http:headers_lib", "//source/common/tracing:http_tracer_lib", - "@envoy_api//envoy/api/v2/ratelimit:ratelimit_cc", - "@envoy_api//envoy/config/ratelimit/v2:rls_cc", - "@envoy_api//envoy/service/ratelimit/v2:rls_cc", ], ) diff --git a/source/common/router/BUILD b/source/common/router/BUILD index 1960b0c117c6..dc3d685e753d 100644 --- a/source/common/router/BUILD +++ b/source/common/router/BUILD @@ -53,6 +53,9 @@ envoy_cc_library( name = "config_utility_lib", srcs = ["config_utility.cc"], hdrs = ["config_utility.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:rds_cc", + ], deps = [ "//include/envoy/http:codes_interface", "//include/envoy/upstream:resource_manager_interface", @@ -62,7 +65,6 @@ envoy_cc_library( "//source/common/filesystem:filesystem_lib", "//source/common/http:headers_lib", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/api/v2:rds_cc", ], ) @@ -70,6 +72,11 @@ envoy_cc_library( name = "rds_lib", srcs = ["rds_impl.cc"], hdrs = ["rds_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/admin/v2alpha:config_dump_cc", + "@envoy_api//envoy/api/v2:rds_cc", + "@envoy_api//envoy/config/filter/network/http_connection_manager/v2:http_connection_manager_cc", + ], deps = [ ":config_lib", ":rds_subscription_lib", @@ -88,9 +95,6 @@ envoy_cc_library( "//source/common/config:subscription_factory_lib", "//source/common/config:utility_lib", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/admin/v2alpha:config_dump_cc", - "@envoy_api//envoy/api/v2:rds_cc", - "@envoy_api//envoy/config/filter/network/http_connection_manager/v2:http_connection_manager_cc", ], ) @@ -98,6 +102,9 @@ envoy_cc_library( name = "rds_subscription_lib", srcs = ["rds_subscription.cc"], hdrs = ["rds_subscription.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/network/http_connection_manager/v2:http_connection_manager_cc", + ], deps = [ "//include/envoy/config:subscription_interface", "//source/common/common:assert_lib", @@ -106,7 +113,6 @@ envoy_cc_library( "//source/common/http:headers_lib", "//source/common/http:rest_api_fetcher_lib", "//source/common/json:json_loader_lib", - "@envoy_api//envoy/config/filter/network/http_connection_manager/v2:http_connection_manager_cc", ], ) @@ -135,6 +141,9 @@ envoy_cc_library( name = "router_lib", srcs = ["router.cc"], hdrs = ["router.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/router/v2:router_cc", + ], deps = [ ":config_lib", ":header_parser_lib", @@ -172,7 +181,6 @@ envoy_cc_library( "//source/common/http:utility_lib", "//source/common/request_info:request_info_lib", "//source/common/tracing:http_tracer_lib", - "@envoy_api//envoy/config/filter/http/router/v2:router_cc", ], ) diff --git a/source/common/secret/BUILD b/source/common/secret/BUILD index 4f1eff746d6d..952dcda0d858 100644 --- a/source/common/secret/BUILD +++ b/source/common/secret/BUILD @@ -12,10 +12,12 @@ envoy_cc_library( name = "secret_manager_impl_lib", srcs = ["secret_manager_impl.cc"], hdrs = ["secret_manager_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/auth:cert_cc", + ], deps = [ "//include/envoy/secret:secret_manager_interface", "//source/common/common:minimal_logger_lib", "//source/common/ssl:tls_certificate_config_impl_lib", - "@envoy_api//envoy/api/v2/auth:cert_cc", ], ) diff --git a/source/common/ssl/BUILD b/source/common/ssl/BUILD index 486d0da347dc..dd1e707ebe5d 100644 --- a/source/common/ssl/BUILD +++ b/source/common/ssl/BUILD @@ -32,6 +32,9 @@ envoy_cc_library( external_deps = [ "ssl", ], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/auth:cert_cc", + ], deps = [ "//include/envoy/secret:secret_manager_interface", "//include/envoy/ssl:context_config_interface", @@ -41,7 +44,6 @@ envoy_cc_library( "//source/common/config:tls_context_json_lib", "//source/common/json:json_loader_lib", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/api/v2/auth:cert_cc", ], ) @@ -73,9 +75,11 @@ envoy_cc_library( name = "tls_certificate_config_impl_lib", srcs = ["tls_certificate_config_impl.cc"], hdrs = ["tls_certificate_config_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/auth:cert_cc", + ], deps = [ "//include/envoy/ssl:tls_certificate_config_interface", "//source/common/config:datasource_lib", - "@envoy_api//envoy/api/v2/auth:cert_cc", ], ) diff --git a/source/common/stats/BUILD b/source/common/stats/BUILD index 4c9997138bd1..e109408a0ba9 100644 --- a/source/common/stats/BUILD +++ b/source/common/stats/BUILD @@ -16,6 +16,9 @@ envoy_cc_library( "abseil_optional", "libcircllhist", ], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/metrics/v2:stats_cc", + ], deps = [ "//include/envoy/common:time_interface", "//include/envoy/server:options_interface", @@ -29,7 +32,6 @@ envoy_cc_library( "//source/common/config:well_known_names", "//source/common/protobuf", "//source/common/singleton:const_singleton", - "@envoy_api//envoy/config/metrics/v2:stats_cc", ], ) diff --git a/source/common/tcp_proxy/BUILD b/source/common/tcp_proxy/BUILD index fcd3000620fb..3e5ddf6cf469 100644 --- a/source/common/tcp_proxy/BUILD +++ b/source/common/tcp_proxy/BUILD @@ -12,6 +12,9 @@ envoy_cc_library( name = "tcp_proxy", srcs = ["tcp_proxy.cc"], hdrs = ["tcp_proxy.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/network/tcp_proxy/v2:tcp_proxy_cc", + ], deps = [ "//include/envoy/access_log:access_log_interface", "//include/envoy/buffer:buffer_interface", @@ -35,6 +38,5 @@ envoy_cc_library( "//source/common/network:utility_lib", "//source/common/request_info:request_info_lib", "//source/common/router:metadatamatchcriteria_lib", - "@envoy_api//envoy/config/filter/network/tcp_proxy/v2:tcp_proxy_cc", ], ) diff --git a/source/common/upstream/BUILD b/source/common/upstream/BUILD index 98c6cf013810..e1686ec06ae1 100644 --- a/source/common/upstream/BUILD +++ b/source/common/upstream/BUILD @@ -13,6 +13,9 @@ envoy_cc_library( name = "cds_api_lib", srcs = ["cds_api_impl.cc"], hdrs = ["cds_api_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:cds_cc", + ], deps = [ ":cds_subscription_lib", "//include/envoy/config:subscription_interface", @@ -24,7 +27,6 @@ envoy_cc_library( "//source/common/config:subscription_factory_lib", "//source/common/config:utility_lib", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/api/v2:cds_cc", ], ) @@ -32,6 +34,9 @@ envoy_cc_library( name = "cds_subscription_lib", srcs = ["cds_subscription.cc"], hdrs = ["cds_subscription.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:cds_cc", + ], deps = [ "//include/envoy/config:subscription_interface", "//include/envoy/event:dispatcher_interface", @@ -45,7 +50,6 @@ envoy_cc_library( "//source/common/http:rest_api_fetcher_lib", "//source/common/json:config_schemas_lib", "//source/common/json:json_loader_lib", - "@envoy_api//envoy/api/v2:cds_cc", ], ) @@ -53,6 +57,10 @@ envoy_cc_library( name = "cluster_manager_lib", srcs = ["cluster_manager_impl.cc"], hdrs = ["cluster_manager_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/admin/v2alpha:config_dump_cc", + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ ":cds_api_lib", ":load_balancer_lib", @@ -82,8 +90,6 @@ envoy_cc_library( "//source/common/protobuf:utility_lib", "//source/common/router:shadow_writer_lib", "//source/common/upstream:upstream_lib", - "@envoy_api//envoy/admin/v2alpha:config_dump_cc", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) @@ -97,10 +103,12 @@ envoy_cc_library( name = "health_checker_base_lib", srcs = ["health_checker_base_impl.cc"], hdrs = ["health_checker_base_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:health_check_cc", + ], deps = [ "//include/envoy/upstream:health_checker_interface", "//source/common/router:router_lib", - "@envoy_api//envoy/api/v2/core:health_check_cc", ], ) @@ -149,13 +157,15 @@ envoy_cc_library( name = "load_stats_reporter_lib", srcs = ["load_stats_reporter.cc"], hdrs = ["load_stats_reporter.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/service/load_stats/v2:lrs_cc", + ], deps = [ "//include/envoy/event:dispatcher_interface", "//include/envoy/stats:stats_macros", "//include/envoy/upstream:cluster_manager_interface", "//source/common/common:minimal_logger_lib", "//source/common/grpc:async_client_lib", - "@envoy_api//envoy/service/load_stats/v2:lrs_cc", ], ) @@ -163,21 +173,25 @@ envoy_cc_library( name = "health_discovery_service_lib", srcs = ["health_discovery_service.cc"], hdrs = ["health_discovery_service.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/service/discovery/v2:hds_cc", + ], deps = [ "//include/envoy/event:dispatcher_interface", "//include/envoy/stats:stats_macros", "//source/common/common:minimal_logger_lib", "//source/common/grpc:async_client_lib", - "@envoy_api//envoy/service/discovery/v2:hds_cc", ], ) envoy_cc_library( name = "locality_lib", hdrs = ["locality.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) @@ -214,6 +228,9 @@ envoy_cc_library( name = "outlier_detection_lib", srcs = ["outlier_detection_impl.cc"], hdrs = ["outlier_detection_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:cds_cc", + ], deps = [ "//include/envoy/access_log:access_log_interface", "//include/envoy/event:dispatcher_interface", @@ -225,7 +242,6 @@ envoy_cc_library( "//source/common/common:utility_lib", "//source/common/http:codes_lib", "//source/common/protobuf", - "@envoy_api//envoy/api/v2:cds_cc", ], ) @@ -272,6 +288,11 @@ envoy_cc_library( name = "eds_lib", srcs = ["eds.cc"], hdrs = ["eds.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:eds_cc", + "@envoy_api//envoy/api/v2/core:base_cc", + "@envoy_api//envoy/api/v2/endpoint:endpoint_cc", + ], deps = [ ":locality_lib", ":sds_subscription_lib", @@ -287,9 +308,6 @@ envoy_cc_library( "//source/common/network:resolver_lib", "//source/common/network:utility_lib", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/api/v2:eds_cc", - "@envoy_api//envoy/api/v2/core:base_cc", - "@envoy_api//envoy/api/v2/endpoint:endpoint_cc", ], ) @@ -297,6 +315,11 @@ envoy_cc_library( name = "sds_subscription_lib", srcs = ["sds_subscription.cc"], hdrs = ["sds_subscription.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:eds_cc", + "@envoy_api//envoy/api/v2/core:base_cc", + "@envoy_api//envoy/api/v2/endpoint:endpoint_cc", + ], deps = [ "//include/envoy/config:subscription_interface", "//source/common/common:assert_lib", @@ -308,9 +331,6 @@ envoy_cc_library( "//source/common/json:json_loader_lib", "//source/common/protobuf", "//source/common/router:router_lib", - "@envoy_api//envoy/api/v2:eds_cc", - "@envoy_api//envoy/api/v2/core:base_cc", - "@envoy_api//envoy/api/v2/endpoint:endpoint_cc", ], ) @@ -336,6 +356,9 @@ envoy_cc_library( envoy_cc_library( name = "upstream_lib", srcs = ["upstream_impl.cc"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + ], deps = [ ":eds_lib", ":health_checker_lib", @@ -360,13 +383,16 @@ envoy_cc_library( "//source/common/protobuf", "//source/common/protobuf:utility_lib", "//source/extensions/transport_sockets:well_known_names", - "@envoy_api//envoy/api/v2/core:base_cc", ], ) envoy_cc_library( name = "upstream_includes", hdrs = ["upstream_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + "@envoy_api//envoy/api/v2/endpoint:endpoint_cc", + ], deps = [ ":load_balancer_lib", ":outlier_detection_lib", @@ -388,7 +414,5 @@ envoy_cc_library( "//source/common/config:metadata_lib", "//source/common/stats:stats_lib", "//source/common/upstream:locality_lib", - "@envoy_api//envoy/api/v2/core:base_cc", - "@envoy_api//envoy/api/v2/endpoint:endpoint_cc", ], ) diff --git a/source/exe/BUILD b/source/exe/BUILD index a6b91acfdf82..8d1e932de1d1 100644 --- a/source/exe/BUILD +++ b/source/exe/BUILD @@ -9,6 +9,7 @@ load( load( "//source/extensions:all_extensions.bzl", "envoy_all_extensions", + "envoy_windows_extensions", ) envoy_package() @@ -37,7 +38,10 @@ envoy_cc_library( "//source/server:options_lib", "//source/server:server_lib", "//source/server:test_hooks_lib", - ] + envoy_all_extensions(), + ] + select({ + "//bazel:windows_x86_64": envoy_windows_extensions(), + "//conditions:default": envoy_all_extensions(), + }), ) envoy_cc_library( diff --git a/source/extensions/access_loggers/file/BUILD b/source/extensions/access_loggers/file/BUILD index 124d5f838e5e..72eb75daeeaf 100644 --- a/source/extensions/access_loggers/file/BUILD +++ b/source/extensions/access_loggers/file/BUILD @@ -24,6 +24,9 @@ envoy_cc_library( name = "config", srcs = ["config.cc"], hdrs = ["config.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/accesslog/v2:file_cc", + ], deps = [ ":file_access_log_lib", "//include/envoy/registry", @@ -31,6 +34,5 @@ envoy_cc_library( "//source/common/access_log:access_log_formatter_lib", "//source/common/protobuf", "//source/extensions/access_loggers:well_known_names", - "@envoy_api//envoy/config/accesslog/v2:file_cc", ], ) diff --git a/source/extensions/access_loggers/http_grpc/BUILD b/source/extensions/access_loggers/http_grpc/BUILD index 8839d961083e..c90339ac2f6c 100644 --- a/source/extensions/access_loggers/http_grpc/BUILD +++ b/source/extensions/access_loggers/http_grpc/BUILD @@ -14,6 +14,11 @@ envoy_cc_library( name = "grpc_access_log_lib", srcs = ["grpc_access_log_impl.cc"], hdrs = ["grpc_access_log_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/accesslog/v2:als_cc", + "@envoy_api//envoy/config/filter/accesslog/v2:accesslog_cc", + "@envoy_api//envoy/service/accesslog/v2:als_cc", + ], deps = [ "//include/envoy/access_log:access_log_interface", "//include/envoy/grpc:async_client_interface", @@ -23,9 +28,6 @@ envoy_cc_library( "//include/envoy/upstream:cluster_manager_interface", "//source/common/grpc:async_client_lib", "//source/common/network:utility_lib", - "@envoy_api//envoy/config/accesslog/v2:als_cc", - "@envoy_api//envoy/config/filter/accesslog/v2:accesslog_cc", - "@envoy_api//envoy/service/accesslog/v2:als_cc", ], ) diff --git a/source/extensions/all_extensions.bzl b/source/extensions/all_extensions.bzl index 6649a0cfdd52..17cc6157a7a3 100644 --- a/source/extensions/all_extensions.bzl +++ b/source/extensions/all_extensions.bzl @@ -1,4 +1,4 @@ -load("@envoy_build_config//:extensions_build_config.bzl", "EXTENSIONS") +load("@envoy_build_config//:extensions_build_config.bzl", "EXTENSIONS", "WINDOWS_EXTENSIONS") # Return all extensions to be compiled into Envoy. def envoy_all_extensions(): @@ -14,3 +14,17 @@ def envoy_all_extensions(): all_extensions.append(path) return all_extensions + +def envoy_windows_extensions(): + # These extensions are registered using the extension system but are required for the core + # Envoy build. + windows_extensions = [ + "//source/extensions/transport_sockets/raw_buffer:config", + "//source/extensions/transport_sockets/ssl:config", + ] + + # These extensions can be removed on a site specific basis. + for path in WINDOWS_EXTENSIONS.values(): + windows_extensions.append(path) + + return windows_extensions diff --git a/source/extensions/extensions_build_config.bzl b/source/extensions/extensions_build_config.bzl index aa0466a7881f..133ea5cde53b 100644 --- a/source/extensions/extensions_build_config.bzl +++ b/source/extensions/extensions_build_config.bzl @@ -78,7 +78,7 @@ EXTENSIONS = { "envoy.stat_sinks.hystrix": "//source/extensions/stat_sinks/hystrix:config", "envoy.stat_sinks.metrics_service": "//source/extensions/stat_sinks/metrics_service:config", "envoy.stat_sinks.statsd": "//source/extensions/stat_sinks/statsd:config", - + # # Tracers # @@ -95,3 +95,96 @@ EXTENSIONS = { "envoy.transport_sockets.alts": "//source/extensions/transport_sockets/alts:tsi_handshaker", "envoy.transport_sockets.capture": "//source/extensions/transport_sockets/capture:config", } + +WINDOWS_EXTENSIONS = { + # + # Access loggers + # + + "envoy.access_loggers.file": "//source/extensions/access_loggers/file:config", + #"envoy.access_loggers.http_grpc": "//source/extensions/access_loggers/http_grpc:config", + + # + # gRPC Credentials Plugins + # + + #"envoy.grpc_credentials.file_based_metadata": "//source/extensions/grpc_credentials/file_based_metadata:config", + + # + # Health checkers + # + + #"envoy.health_checkers.redis": "//source/extensions/health_checkers/redis:config", + + # + # HTTP filters + # + + #"envoy.filters.http.buffer": "//source/extensions/filters/http/buffer:config", + #"envoy.filters.http.cors": "//source/extensions/filters/http/cors:config", + #"envoy.filters.http.dynamo": "//source/extensions/filters/http/dynamo:config", + #"envoy.filters.http.ext_authz": "//source/extensions/filters/http/ext_authz:config", + #"envoy.filters.http.fault": "//source/extensions/filters/http/fault:config", + #"envoy.filters.http.grpc_http1_bridge": "//source/extensions/filters/http/grpc_http1_bridge:config", + #"envoy.filters.http.grpc_json_transcoder": "//source/extensions/filters/http/grpc_json_transcoder:config", + #"envoy.filters.http.grpc_web": "//source/extensions/filters/http/grpc_web:config", + #"envoy.filters.http.gzip": "//source/extensions/filters/http/gzip:config", + #"envoy.filters.http.health_check": "//source/extensions/filters/http/health_check:config", + #"envoy.filters.http.ip_tagging": "//source/extensions/filters/http/ip_tagging:config", + #"envoy.filters.http.lua": "//source/extensions/filters/http/lua:config", + #"envoy.filters.http.ratelimit": "//source/extensions/filters/http/ratelimit:config", + #"envoy.filters.http.rbac": "//source/extensions/filters/http/rbac:config", + #"envoy.filters.http.router": "//source/extensions/filters/http/router:config", + #"envoy.filters.http.squash": "//source/extensions/filters/http/squash:config", + + # + # Listener filters + # + + # NOTE: The proxy_protocol filter is implicitly loaded if proxy_protocol functionality is + # configured on the listener. Do not remove it in that case or configs will fail to load. + "envoy.filters.listener.proxy_protocol": "//source/extensions/filters/listener/proxy_protocol:config", + + # NOTE: The original_dst filter is implicitly loaded if original_dst functionality is + # configured on the listener. Do not remove it in that case or configs will fail to load. + #"envoy.filters.listener.original_dst": "//source/extensions/filters/listener/original_dst:config", + + "envoy.filters.listener.tls_inspector": "//source/extensions/filters/listener/tls_inspector:config", + + # + # Network filters + # + + "envoy.filters.network.client_ssl_auth": "//source/extensions/filters/network/client_ssl_auth:config", + #"envoy.filters.network.echo": "//source/extensions/filters/network/echo:config", + #"envoy.filters.network.ext_authz": "//source/extensions/filters/network/ext_authz:config", + #"envoy.filters.network.http_connection_manager": "//source/extensions/filters/network/http_connection_manager:config", + #"envoy.filters.network.mongo_proxy": "//source/extensions/filters/network/mongo_proxy:config", + #"envoy.filters.network.redis_proxy": "//source/extensions/filters/network/redis_proxy:config", + #"envoy.filters.network.ratelimit": "//source/extensions/filters/network/ratelimit:config", + "envoy.filters.network.tcp_proxy": "//source/extensions/filters/network/tcp_proxy:config", + # TODO(zuercher): switch to config target once a filter exists + #"envoy.filters.network.thrift_proxy": "//source/extensions/filters/network/thrift_proxy:transport_lib", + + # + # Stat sinks + # + + #"envoy.stat_sinks.dog_statsd": "//source/extensions/stat_sinks/dog_statsd:config", + #"envoy.stat_sinks.metrics_service": "//source/extensions/stat_sinks/metrics_service:config", + #"envoy.stat_sinks.statsd": "//source/extensions/stat_sinks/statsd:config", + + # + # Tracers + # + + #"envoy.tracers.dynamic_ot": "//source/extensions/tracers/dynamic_ot:config", + #"envoy.tracers.lightstep": "//source/extensions/tracers/lightstep:config", + #"envoy.tracers.zipkin": "//source/extensions/tracers/zipkin:config", + + # + # Transport sockets + # + + #"envoy.transport_sockets.capture": "//source/extensions/transport_sockets/capture:config", +} diff --git a/source/extensions/filters/common/ext_authz/BUILD b/source/extensions/filters/common/ext_authz/BUILD index d954a8acd6b9..db3e907d5cd5 100644 --- a/source/extensions/filters/common/ext_authz/BUILD +++ b/source/extensions/filters/common/ext_authz/BUILD @@ -11,10 +11,12 @@ envoy_package() envoy_cc_library( name = "ext_authz_interface", hdrs = ["ext_authz.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/service/auth/v2alpha:external_auth_cc", + ], deps = [ "//include/envoy/http:codes_interface", "//source/common/tracing:http_tracer_lib", - "@envoy_api//envoy/service/auth/v2alpha:external_auth_cc", ], ) @@ -60,12 +62,14 @@ envoy_cc_library( name = "check_request_utils_lib", srcs = ["check_request_utils.cc"], hdrs = ["check_request_utils.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/service/auth/v2alpha:external_auth_cc", + ], deps = [ "//include/envoy/grpc:async_client_interface", "//include/envoy/grpc:async_client_manager_interface", "//include/envoy/http:filter_interface", "//include/envoy/upstream:cluster_manager_interface", "//source/common/grpc:async_client_lib", - "@envoy_api//envoy/service/auth/v2alpha:external_auth_cc", ], ) diff --git a/source/extensions/filters/common/rbac/BUILD b/source/extensions/filters/common/rbac/BUILD index 0170fc2d7b8f..2332dde8a450 100644 --- a/source/extensions/filters/common/rbac/BUILD +++ b/source/extensions/filters/common/rbac/BUILD @@ -12,6 +12,10 @@ envoy_cc_library( name = "matchers_lib", srcs = ["matchers.cc"], hdrs = ["matchers.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + "@envoy_api//envoy/config/rbac/v2alpha:rbac_cc", + ], deps = [ "//include/envoy/http:header_map_interface", "//include/envoy/network:connection_interface", @@ -19,8 +23,6 @@ envoy_cc_library( "//source/common/common:matchers_lib", "//source/common/http:header_utility_lib", "//source/common/network:cidr_range_lib", - "@envoy_api//envoy/api/v2/core:base_cc", - "@envoy_api//envoy/config/rbac/v2alpha:rbac_cc", ], ) @@ -38,10 +40,12 @@ envoy_cc_library( name = "engine_lib", srcs = ["engine_impl.cc"], hdrs = ["engine_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:base_cc", + "@envoy_api//envoy/config/filter/http/rbac/v2:rbac_cc", + ], deps = [ "//source/extensions/filters/common/rbac:engine_interface", "//source/extensions/filters/common/rbac:matchers_lib", - "@envoy_api//envoy/api/v2/core:base_cc", - "@envoy_api//envoy/config/filter/http/rbac/v2:rbac_cc", ], ) diff --git a/source/extensions/filters/http/buffer/BUILD b/source/extensions/filters/http/buffer/BUILD index c002a21a99c1..92cb1fd00448 100644 --- a/source/extensions/filters/http/buffer/BUILD +++ b/source/extensions/filters/http/buffer/BUILD @@ -14,6 +14,9 @@ envoy_cc_library( name = "buffer_filter_lib", srcs = ["buffer_filter.cc"], hdrs = ["buffer_filter.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/buffer/v2:buffer_cc", + ], deps = [ "//include/envoy/event:dispatcher_interface", "//include/envoy/event:timer_interface", @@ -29,7 +32,6 @@ envoy_cc_library( "//source/common/http:headers_lib", "//source/common/http:utility_lib", "//source/extensions/filters/http:well_known_names", - "@envoy_api//envoy/config/filter/http/buffer/v2:buffer_cc", ], ) diff --git a/source/extensions/filters/http/ext_authz/BUILD b/source/extensions/filters/http/ext_authz/BUILD index 651c2913e440..eb1ae845dea0 100644 --- a/source/extensions/filters/http/ext_authz/BUILD +++ b/source/extensions/filters/http/ext_authz/BUILD @@ -14,6 +14,9 @@ envoy_cc_library( name = "ext_authz", srcs = ["ext_authz.cc"], hdrs = ["ext_authz.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/ext_authz/v2alpha:ext_authz_cc", + ], deps = [ "//include/envoy/http:codes_interface", "//source/common/buffer:buffer_lib", @@ -24,7 +27,6 @@ envoy_cc_library( "//source/common/http:codes_lib", "//source/common/router:config_lib", "//source/extensions/filters/common/ext_authz:ext_authz_grpc_lib", - "@envoy_api//envoy/config/filter/http/ext_authz/v2alpha:ext_authz_cc", ], ) diff --git a/source/extensions/filters/http/fault/BUILD b/source/extensions/filters/http/fault/BUILD index 2ad7bba0b0e6..0042ae67490d 100644 --- a/source/extensions/filters/http/fault/BUILD +++ b/source/extensions/filters/http/fault/BUILD @@ -14,6 +14,9 @@ envoy_cc_library( name = "fault_filter_lib", srcs = ["fault_filter.cc"], hdrs = ["fault_filter.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/fault/v2:fault_cc", + ], deps = [ "//include/envoy/event:timer_interface", "//include/envoy/http:codes_interface", @@ -29,7 +32,6 @@ envoy_cc_library( "//source/common/http:header_utility_lib", "//source/common/http:headers_lib", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/config/filter/http/fault/v2:fault_cc", ], ) diff --git a/source/extensions/filters/http/grpc_json_transcoder/BUILD b/source/extensions/filters/http/grpc_json_transcoder/BUILD index 5bf972b6ac8e..c51bb8981fb1 100644 --- a/source/extensions/filters/http/grpc_json_transcoder/BUILD +++ b/source/extensions/filters/http/grpc_json_transcoder/BUILD @@ -18,7 +18,10 @@ envoy_cc_library( external_deps = [ "path_matcher", "grpc_transcoding", - "http_api_protos", + ], + http_api_protos_dep = True, + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/transcoder/v2:transcoder_cc", ], deps = [ ":transcoder_input_stream_lib", @@ -28,7 +31,6 @@ envoy_cc_library( "//source/common/grpc:common_lib", "//source/common/http:headers_lib", "//source/common/protobuf", - "@envoy_api//envoy/config/filter/http/transcoder/v2:transcoder_cc", ], ) @@ -37,7 +39,10 @@ envoy_cc_library( srcs = ["transcoder_input_stream_impl.cc"], hdrs = ["transcoder_input_stream_impl.h"], external_deps = ["grpc_transcoding"], - deps = ["//source/common/buffer:zero_copy_input_stream_lib"], + deps = [ + "//source/common/buffer:zero_copy_input_stream_lib", + "//source/common/protobuf", + ], ) envoy_cc_library( diff --git a/source/extensions/filters/http/gzip/BUILD b/source/extensions/filters/http/gzip/BUILD index a31a6f93fee3..404a5690ef6d 100644 --- a/source/extensions/filters/http/gzip/BUILD +++ b/source/extensions/filters/http/gzip/BUILD @@ -14,6 +14,9 @@ envoy_cc_library( name = "gzip_filter_lib", srcs = ["gzip_filter.cc"], hdrs = ["gzip_filter.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/gzip/v2:gzip_cc", + ], deps = [ "//include/envoy/http:filter_interface", "//include/envoy/json:json_object_interface", @@ -25,7 +28,6 @@ envoy_cc_library( "//source/common/json:config_schemas_lib", "//source/common/json:json_validator_lib", "//source/common/protobuf", - "@envoy_api//envoy/config/filter/http/gzip/v2:gzip_cc", ], ) diff --git a/source/extensions/filters/http/header_to_metadata/BUILD b/source/extensions/filters/http/header_to_metadata/BUILD index c32b2255b8f3..3751d6c139e5 100644 --- a/source/extensions/filters/http/header_to_metadata/BUILD +++ b/source/extensions/filters/http/header_to_metadata/BUILD @@ -14,10 +14,12 @@ envoy_cc_library( name = "header_to_metadata_filter_lib", srcs = ["header_to_metadata_filter.cc"], hdrs = ["header_to_metadata_filter.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/header_to_metadata/v2:header_to_metadata_cc", + ], deps = [ "//include/envoy/server:filter_config_interface", "//source/extensions/filters/http:well_known_names", - "@envoy_api//envoy/config/filter/http/header_to_metadata/v2:header_to_metadata_cc", ], ) diff --git a/source/extensions/filters/http/health_check/BUILD b/source/extensions/filters/http/health_check/BUILD index d8cc758715b3..9fb2512fd449 100644 --- a/source/extensions/filters/http/health_check/BUILD +++ b/source/extensions/filters/http/health_check/BUILD @@ -14,6 +14,9 @@ envoy_cc_library( name = "health_check_lib", srcs = ["health_check.cc"], hdrs = ["health_check.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/health_check/v2:health_check_cc", + ], deps = [ "//include/envoy/event:dispatcher_interface", "//include/envoy/event:timer_interface", @@ -28,7 +31,6 @@ envoy_cc_library( "//source/common/http:headers_lib", "//source/common/http:utility_lib", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/config/filter/http/health_check/v2:health_check_cc", ], ) diff --git a/source/extensions/filters/http/ip_tagging/BUILD b/source/extensions/filters/http/ip_tagging/BUILD index 12e72155c14f..6858827ad7b0 100644 --- a/source/extensions/filters/http/ip_tagging/BUILD +++ b/source/extensions/filters/http/ip_tagging/BUILD @@ -14,6 +14,9 @@ envoy_cc_library( name = "ip_tagging_filter_lib", srcs = ["ip_tagging_filter.cc"], hdrs = ["ip_tagging_filter.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/ip_tagging/v2:ip_tagging_cc", + ], deps = [ "//include/envoy/http:filter_interface", "//include/envoy/runtime:runtime_interface", @@ -21,7 +24,6 @@ envoy_cc_library( "//source/common/http:header_map_lib", "//source/common/http:headers_lib", "//source/common/network:lc_trie_lib", - "@envoy_api//envoy/config/filter/http/ip_tagging/v2:ip_tagging_cc", ], ) diff --git a/source/extensions/filters/http/jwt_authn/BUILD b/source/extensions/filters/http/jwt_authn/BUILD index 88a9b691d99f..1d878c0c6b11 100644 --- a/source/extensions/filters/http/jwt_authn/BUILD +++ b/source/extensions/filters/http/jwt_authn/BUILD @@ -12,9 +12,11 @@ envoy_cc_library( name = "extractor_lib", srcs = ["extractor.cc"], hdrs = ["extractor.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/jwt_authn/v2alpha:jwt_authn_cc", + ], deps = [ "//source/common/http:utility_lib", - "@envoy_api//envoy/config/filter/http/jwt_authn/v2alpha:jwt_authn_cc", ], ) @@ -25,11 +27,13 @@ envoy_cc_library( external_deps = [ "jwt_verify_lib", ], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/jwt_authn/v2alpha:jwt_authn_cc", + ], deps = [ "//source/common/common:minimal_logger_lib", "//source/common/config:datasource_lib", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/config/filter/http/jwt_authn/v2alpha:jwt_authn_cc", ], ) diff --git a/source/extensions/filters/http/ratelimit/BUILD b/source/extensions/filters/http/ratelimit/BUILD index 3f85e70b294c..61aaa1710286 100644 --- a/source/extensions/filters/http/ratelimit/BUILD +++ b/source/extensions/filters/http/ratelimit/BUILD @@ -14,6 +14,9 @@ envoy_cc_library( name = "ratelimit_lib", srcs = ["ratelimit.cc"], hdrs = ["ratelimit.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/rate_limit/v2:rate_limit_cc", + ], deps = [ "//include/envoy/http:codes_interface", "//source/common/common:assert_lib", @@ -21,7 +24,6 @@ envoy_cc_library( "//source/common/common:enum_to_int", "//source/common/http:codes_lib", "//source/common/router:config_lib", - "@envoy_api//envoy/config/filter/http/rate_limit/v2:rate_limit_cc", ], ) diff --git a/source/extensions/filters/http/rbac/BUILD b/source/extensions/filters/http/rbac/BUILD index 0dfa0574e1a1..96cc3030b539 100644 --- a/source/extensions/filters/http/rbac/BUILD +++ b/source/extensions/filters/http/rbac/BUILD @@ -24,12 +24,14 @@ envoy_cc_library( name = "rbac_filter_lib", srcs = ["rbac_filter.cc"], hdrs = ["rbac_filter.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/rbac/v2:rbac_cc", + ], deps = [ "//include/envoy/http:filter_interface", "//include/envoy/stats:stats_macros", "//source/common/http:utility_lib", "//source/extensions/filters/common/rbac:engine_lib", "//source/extensions/filters/http:well_known_names", - "@envoy_api//envoy/config/filter/http/rbac/v2:rbac_cc", ], ) diff --git a/source/extensions/filters/http/squash/BUILD b/source/extensions/filters/http/squash/BUILD index b0cbb13c1083..e98046387573 100644 --- a/source/extensions/filters/http/squash/BUILD +++ b/source/extensions/filters/http/squash/BUILD @@ -14,6 +14,9 @@ envoy_cc_library( name = "squash_filter_lib", srcs = ["squash_filter.cc"], hdrs = ["squash_filter.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/http/squash/v2:squash_cc", + ], deps = [ "//include/envoy/event:timer_interface", "//include/envoy/http:codes_interface", @@ -26,7 +29,6 @@ envoy_cc_library( "//source/common/http:message_lib", "//source/common/http:utility_lib", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/config/filter/http/squash/v2:squash_cc", ], ) diff --git a/source/extensions/filters/network/client_ssl_auth/BUILD b/source/extensions/filters/network/client_ssl_auth/BUILD index 23c515dace98..c2085683b71e 100644 --- a/source/extensions/filters/network/client_ssl_auth/BUILD +++ b/source/extensions/filters/network/client_ssl_auth/BUILD @@ -14,6 +14,9 @@ envoy_cc_library( name = "client_ssl_auth", srcs = ["client_ssl_auth.cc"], hdrs = ["client_ssl_auth.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/network/client_ssl_auth/v2:client_ssl_auth_cc", + ], deps = [ "//include/envoy/network:connection_interface", "//include/envoy/network:filter_interface", @@ -31,7 +34,6 @@ envoy_cc_library( "//source/common/json:json_loader_lib", "//source/common/network:cidr_range_lib", "//source/common/network:utility_lib", - "@envoy_api//envoy/config/filter/network/client_ssl_auth/v2:client_ssl_auth_cc", ], ) diff --git a/source/extensions/filters/network/ext_authz/BUILD b/source/extensions/filters/network/ext_authz/BUILD index 530109558523..1c60f991db44 100644 --- a/source/extensions/filters/network/ext_authz/BUILD +++ b/source/extensions/filters/network/ext_authz/BUILD @@ -14,6 +14,9 @@ envoy_cc_library( name = "ext_authz", srcs = ["ext_authz.cc"], hdrs = ["ext_authz.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/network/ext_authz/v2:ext_authz_cc", + ], deps = [ "//include/envoy/network:connection_interface", "//include/envoy/network:filter_interface", @@ -24,7 +27,6 @@ envoy_cc_library( "//source/common/tracing:http_tracer_lib", "//source/extensions/filters/common/ext_authz:ext_authz_grpc_lib", "//source/extensions/filters/common/ext_authz:ext_authz_interface", - "@envoy_api//envoy/config/filter/network/ext_authz/v2:ext_authz_cc", ], ) @@ -32,12 +34,14 @@ envoy_cc_library( name = "config", srcs = ["config.cc"], hdrs = ["config.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/network/ext_authz/v2:ext_authz_cc", + ], deps = [ "//include/envoy/registry", "//source/common/protobuf:utility_lib", "//source/extensions/filters/network:well_known_names", "//source/extensions/filters/network/common:factory_base_lib", "//source/extensions/filters/network/ext_authz", - "@envoy_api//envoy/config/filter/network/ext_authz/v2:ext_authz_cc", ], ) diff --git a/source/extensions/filters/network/mongo_proxy/BUILD b/source/extensions/filters/network/mongo_proxy/BUILD index 364ec8989b53..d01602eeb0bc 100644 --- a/source/extensions/filters/network/mongo_proxy/BUILD +++ b/source/extensions/filters/network/mongo_proxy/BUILD @@ -54,6 +54,9 @@ envoy_cc_library( name = "proxy_lib", srcs = ["proxy.cc"], hdrs = ["proxy.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/network/mongo_proxy/v2:mongo_proxy_cc", + ], deps = [ ":codec_interface", ":codec_lib", @@ -74,7 +77,6 @@ envoy_cc_library( "//source/common/network:filter_lib", "//source/common/protobuf:utility_lib", "//source/common/singleton:const_singleton", - "@envoy_api//envoy/config/filter/network/mongo_proxy/v2:mongo_proxy_cc", ], ) diff --git a/source/extensions/filters/network/ratelimit/BUILD b/source/extensions/filters/network/ratelimit/BUILD index b72d061267cb..70dcdb2ea461 100644 --- a/source/extensions/filters/network/ratelimit/BUILD +++ b/source/extensions/filters/network/ratelimit/BUILD @@ -14,6 +14,9 @@ envoy_cc_library( name = "ratelimit_lib", srcs = ["ratelimit.cc"], hdrs = ["ratelimit.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/network/rate_limit/v2:rate_limit_cc", + ], deps = [ "//include/envoy/network:connection_interface", "//include/envoy/network:filter_interface", @@ -21,7 +24,6 @@ envoy_cc_library( "//include/envoy/runtime:runtime_interface", "//include/envoy/stats:stats_macros", "//source/common/tracing:http_tracer_lib", - "@envoy_api//envoy/config/filter/network/rate_limit/v2:rate_limit_cc", ], ) diff --git a/source/extensions/filters/network/redis_proxy/BUILD b/source/extensions/filters/network/redis_proxy/BUILD index 44297a2d449e..0ce2c09195af 100644 --- a/source/extensions/filters/network/redis_proxy/BUILD +++ b/source/extensions/filters/network/redis_proxy/BUILD @@ -62,6 +62,9 @@ envoy_cc_library( name = "conn_pool_lib", srcs = ["conn_pool_impl.cc"], hdrs = ["conn_pool_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/network/redis_proxy/v2:redis_proxy_cc", + ], deps = [ ":codec_lib", ":conn_pool_interface", @@ -72,7 +75,6 @@ envoy_cc_library( "//source/common/common:assert_lib", "//source/common/network:filter_lib", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/config/filter/network/redis_proxy/v2:redis_proxy_cc", ], ) @@ -80,6 +82,9 @@ envoy_cc_library( name = "proxy_filter_lib", srcs = ["proxy_filter.cc"], hdrs = ["proxy_filter.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/filter/network/redis_proxy/v2:redis_proxy_cc", + ], deps = [ ":codec_interface", ":command_splitter_interface", @@ -89,7 +94,6 @@ envoy_cc_library( "//source/common/buffer:buffer_lib", "//source/common/common:assert_lib", "//source/common/config:utility_lib", - "@envoy_api//envoy/config/filter/network/redis_proxy/v2:redis_proxy_cc", ], ) diff --git a/source/extensions/filters/network/thrift_proxy/BUILD b/source/extensions/filters/network/thrift_proxy/BUILD index 8e4b13b00267..492cc39f778b 100644 --- a/source/extensions/filters/network/thrift_proxy/BUILD +++ b/source/extensions/filters/network/thrift_proxy/BUILD @@ -23,13 +23,15 @@ envoy_cc_library( name = "config", srcs = ["config.cc"], hdrs = ["config.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/extensions/filters/network/thrift_proxy/v2alpha1:thrift_proxy_cc", + ], deps = [ ":filter_lib", "//include/envoy/registry", "//source/common/config:filter_json_lib", "//source/extensions/filters/network:well_known_names", "//source/extensions/filters/network/common:factory_base_lib", - "@envoy_api//envoy/extensions/filters/network/thrift_proxy/v2alpha1:thrift_proxy_cc", ], ) diff --git a/source/extensions/grpc_credentials/file_based_metadata/BUILD b/source/extensions/grpc_credentials/file_based_metadata/BUILD index ae5050dc0cfa..d185ea39d196 100644 --- a/source/extensions/grpc_credentials/file_based_metadata/BUILD +++ b/source/extensions/grpc_credentials/file_based_metadata/BUILD @@ -14,6 +14,9 @@ envoy_cc_library( srcs = ["config.cc"], hdrs = ["config.h"], external_deps = ["grpc"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/grpc_credential/v2alpha:file_based_metadata_cc", + ], deps = [ "//include/envoy/grpc:google_grpc_creds_interface", "//include/envoy/registry", @@ -21,6 +24,5 @@ envoy_cc_library( "//source/common/grpc:common_lib", "//source/common/grpc:google_grpc_creds_lib", "//source/extensions/grpc_credentials:well_known_names", - "@envoy_api//envoy/config/grpc_credential/v2alpha:file_based_metadata_cc", ], ) diff --git a/source/extensions/health_checkers/redis/BUILD b/source/extensions/health_checkers/redis/BUILD index a23cfe122a09..4c4bc814f220 100644 --- a/source/extensions/health_checkers/redis/BUILD +++ b/source/extensions/health_checkers/redis/BUILD @@ -13,11 +13,13 @@ envoy_cc_library( name = "redis", srcs = ["redis.cc"], hdrs = ["redis.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2/core:health_check_cc", + "@envoy_api//envoy/config/health_checker/redis/v2:redis_cc", + ], deps = [ "//source/common/upstream:health_checker_base_lib", "//source/extensions/filters/network/redis_proxy:conn_pool_lib", - "@envoy_api//envoy/api/v2/core:health_check_cc", - "@envoy_api//envoy/config/health_checker/redis/v2:redis_cc", ], ) @@ -38,7 +40,7 @@ envoy_cc_library( envoy_cc_library( name = "utility", hdrs = ["utility.h"], - deps = [ + protobuf_cc_deps = [ "@envoy_api//envoy/api/v2/core:health_check_cc", "@envoy_api//envoy/config/health_checker/redis/v2:redis_cc", ], diff --git a/source/extensions/stat_sinks/dog_statsd/BUILD b/source/extensions/stat_sinks/dog_statsd/BUILD index 6a018243b183..dab07da77550 100644 --- a/source/extensions/stat_sinks/dog_statsd/BUILD +++ b/source/extensions/stat_sinks/dog_statsd/BUILD @@ -14,6 +14,9 @@ envoy_cc_library( name = "config", srcs = ["config.cc"], hdrs = ["config.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/metrics/v2:stats_cc", + ], deps = [ "//include/envoy/registry", "//source/common/network:address_lib", @@ -21,6 +24,5 @@ envoy_cc_library( "//source/extensions/stat_sinks:well_known_names", "//source/extensions/stat_sinks/common/statsd:statsd_lib", "//source/server:configuration_lib", - "@envoy_api//envoy/config/metrics/v2:stats_cc", ], ) diff --git a/source/extensions/stat_sinks/hystrix/BUILD b/source/extensions/stat_sinks/hystrix/BUILD index e307f5fb1941..efdfd0ff7cc2 100644 --- a/source/extensions/stat_sinks/hystrix/BUILD +++ b/source/extensions/stat_sinks/hystrix/BUILD @@ -13,6 +13,9 @@ envoy_cc_library( name = "config", srcs = ["config.cc"], hdrs = ["config.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/metrics/v2:stats_cc", + ], deps = [ "//include/envoy/registry", "//source/common/network:address_lib", @@ -20,7 +23,6 @@ envoy_cc_library( "//source/extensions/stat_sinks:well_known_names", "//source/extensions/stat_sinks/hystrix:hystrix_lib", "//source/server:configuration_lib", - "@envoy_api//envoy/config/metrics/v2:stats_cc", ], ) diff --git a/source/extensions/stat_sinks/metrics_service/BUILD b/source/extensions/stat_sinks/metrics_service/BUILD index 4f7e60d83b6c..c4a92cdc3b02 100644 --- a/source/extensions/stat_sinks/metrics_service/BUILD +++ b/source/extensions/stat_sinks/metrics_service/BUILD @@ -13,6 +13,9 @@ envoy_cc_library( name = "metrics_service_grpc_lib", srcs = ["grpc_metrics_service_impl.cc"], hdrs = ["grpc_metrics_service_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/service/metrics/v2:metrics_service_cc", + ], deps = [ "//include/envoy/grpc:async_client_interface", "//include/envoy/local_info:local_info_interface", @@ -21,7 +24,6 @@ envoy_cc_library( "//include/envoy/upstream:cluster_manager_interface", "//source/common/common:assert_lib", "//source/common/grpc:async_client_lib", - "@envoy_api//envoy/service/metrics/v2:metrics_service_cc", ], ) @@ -29,12 +31,14 @@ envoy_cc_library( name = "config", srcs = ["config.cc"], hdrs = ["config.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/metrics/v2:stats_cc", + "@envoy_api//envoy/service/metrics/v2:metrics_service_cc", + ], deps = [ "//include/envoy/registry", "//source/extensions/stat_sinks:well_known_names", "//source/extensions/stat_sinks/metrics_service:metrics_service_grpc_lib", "//source/server:configuration_lib", - "@envoy_api//envoy/config/metrics/v2:stats_cc", - "@envoy_api//envoy/service/metrics/v2:metrics_service_cc", ], ) diff --git a/source/extensions/stat_sinks/statsd/BUILD b/source/extensions/stat_sinks/statsd/BUILD index cad3c5ab0815..e940aaa9a338 100644 --- a/source/extensions/stat_sinks/statsd/BUILD +++ b/source/extensions/stat_sinks/statsd/BUILD @@ -13,6 +13,9 @@ envoy_cc_library( name = "config", srcs = ["config.cc"], hdrs = ["config.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/metrics/v2:stats_cc", + ], deps = [ "//include/envoy/registry", "//source/common/network:address_lib", @@ -20,6 +23,5 @@ envoy_cc_library( "//source/extensions/stat_sinks:well_known_names", "//source/extensions/stat_sinks/common/statsd:statsd_lib", "//source/server:configuration_lib", - "@envoy_api//envoy/config/metrics/v2:stats_cc", ], ) diff --git a/source/extensions/transport_sockets/capture/BUILD b/source/extensions/transport_sockets/capture/BUILD index dc78eeb94246..321c56d463d0 100644 --- a/source/extensions/transport_sockets/capture/BUILD +++ b/source/extensions/transport_sockets/capture/BUILD @@ -13,14 +13,16 @@ envoy_cc_library( name = "capture_lib", srcs = ["capture.cc"], hdrs = ["capture.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/transport_socket/capture/v2alpha:capture_cc", + "@envoy_api//envoy/data/tap/v2alpha:capture_cc", + ], deps = [ "//include/envoy/network:transport_socket_interface", "//source/common/buffer:buffer_lib", "//source/common/common:assert_lib", "//source/common/network:utility_lib", "//source/common/protobuf", - "@envoy_api//envoy/config/transport_socket/capture/v2alpha:capture_cc", - "@envoy_api//envoy/data/tap/v2alpha:capture_cc", ], ) @@ -28,6 +30,9 @@ envoy_cc_library( name = "config", srcs = ["config.cc"], hdrs = ["config.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/transport_socket/capture/v2alpha:capture_cc", + ], deps = [ ":capture_lib", "//include/envoy/network:transport_socket_interface", @@ -36,6 +41,5 @@ envoy_cc_library( "//source/common/config:utility_lib", "//source/common/protobuf:utility_lib", "//source/extensions/transport_sockets:well_known_names", - "@envoy_api//envoy/config/transport_socket/capture/v2alpha:capture_cc", ], ) diff --git a/source/server/BUILD b/source/server/BUILD index 6ff07ca41dd8..41978fd11a0a 100644 --- a/source/server/BUILD +++ b/source/server/BUILD @@ -24,6 +24,11 @@ envoy_cc_library( name = "configuration_lib", srcs = ["configuration_impl.cc"], hdrs = ["configuration_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:lds_cc", + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", + "@envoy_api//envoy/config/trace/v2:trace_cc", + ], deps = [ "//include/envoy/http:filter_interface", "//include/envoy/network:connection_interface", @@ -43,9 +48,6 @@ envoy_cc_library( "//source/common/protobuf:utility_lib", "//source/common/ratelimit:ratelimit_lib", "//source/common/tracing:http_tracer_lib", - "@envoy_api//envoy/api/v2:lds_cc", - "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", - "@envoy_api//envoy/config/trace/v2:trace_cc", ], ) @@ -162,6 +164,9 @@ envoy_cc_library( name = "lds_api_lib", srcs = ["lds_api.cc"], hdrs = ["lds_api.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:lds_cc", + ], deps = [ ":lds_subscription_lib", "//include/envoy/config:subscription_interface", @@ -172,7 +177,6 @@ envoy_cc_library( "//source/common/config:subscription_factory_lib", "//source/common/config:utility_lib", "//source/common/protobuf:utility_lib", - "@envoy_api//envoy/api/v2:lds_cc", ], ) @@ -180,6 +184,9 @@ envoy_cc_library( name = "lds_subscription_lib", srcs = ["lds_subscription.cc"], hdrs = ["lds_subscription.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/api/v2:lds_cc", + ], deps = [ "//include/envoy/config:subscription_interface", "//source/common/common:assert_lib", @@ -188,7 +195,6 @@ envoy_cc_library( "//source/common/http:rest_api_fetcher_lib", "//source/common/json:config_schemas_lib", "//source/common/json:json_validator_lib", - "@envoy_api//envoy/api/v2:lds_cc", ], ) @@ -196,6 +202,10 @@ envoy_cc_library( name = "listener_manager_lib", srcs = ["listener_manager_impl.cc"], hdrs = ["listener_manager_impl.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/admin/v2alpha:config_dump_cc", + "@envoy_api//envoy/api/v2:lds_cc", + ], deps = [ ":configuration_lib", ":drain_manager_lib", @@ -217,8 +227,6 @@ envoy_cc_library( "//source/extensions/filters/listener:well_known_names", "//source/extensions/filters/network:well_known_names", "//source/extensions/transport_sockets:well_known_names", - "@envoy_api//envoy/admin/v2alpha:config_dump_cc", - "@envoy_api//envoy/api/v2:lds_cc", ], ) @@ -226,9 +234,7 @@ envoy_cc_library( name = "proto_descriptors_lib", srcs = ["proto_descriptors.cc"], hdrs = ["proto_descriptors.h"], - deps = [ - "//source/common/config:protobuf_link_hacks", - "//source/common/protobuf", + protobuf_cc_deps = [ "@envoy_api//envoy/api/v2:cds_cc", "@envoy_api//envoy/api/v2:eds_cc", "@envoy_api//envoy/api/v2:lds_cc", @@ -239,6 +245,10 @@ envoy_cc_library( "@envoy_api//envoy/service/metrics/v2:metrics_service_cc", "@envoy_api//envoy/service/ratelimit/v2:rls_cc", ], + deps = [ + "//source/common/config:protobuf_link_hacks", + "//source/common/protobuf", + ], ) envoy_cc_library( @@ -246,6 +256,9 @@ envoy_cc_library( srcs = ["server.cc"], hdrs = ["server.h"], external_deps = ["abseil_optional"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", + ], deps = [ ":configuration_lib", ":connection_handler_lib", @@ -284,7 +297,6 @@ envoy_cc_library( "//source/common/upstream:cluster_manager_lib", "//source/common/upstream:health_discovery_service_lib", "//source/server/http:admin_lib", - "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", ], ) diff --git a/source/server/config_validation/BUILD b/source/server/config_validation/BUILD index bab593b37ae3..f722952560e2 100644 --- a/source/server/config_validation/BUILD +++ b/source/server/config_validation/BUILD @@ -82,6 +82,9 @@ envoy_cc_library( srcs = ["server.cc"], hdrs = ["server.h"], external_deps = ["abseil_optional"], + protobuf_cc_deps = [ + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", + ], deps = [ ":admin_lib", ":api_lib", @@ -107,6 +110,5 @@ envoy_cc_library( "//source/server:configuration_lib", "//source/server:server_lib", "//source/server/http:admin_lib", - "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", ], ) diff --git a/source/server/http/BUILD b/source/server/http/BUILD index 375f9a96c58d..cf9a3a56f507 100644 --- a/source/server/http/BUILD +++ b/source/server/http/BUILD @@ -12,6 +12,10 @@ envoy_cc_library( name = "admin_lib", srcs = ["admin.cc"], hdrs = ["admin.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/admin/v2alpha:clusters_cc", + "@envoy_api//envoy/admin/v2alpha:config_dump_cc", + ], deps = [ ":config_tracker_lib", "//include/envoy/filesystem:filesystem_interface", @@ -55,8 +59,6 @@ envoy_cc_library( "//source/common/stats:stats_lib", "//source/common/upstream:host_utility_lib", "//source/extensions/access_loggers/file:file_access_log_lib", - "@envoy_api//envoy/admin/v2alpha:clusters_cc", - "@envoy_api//envoy/admin/v2alpha:config_dump_cc", ], ) diff --git a/windows/bazel/get_workspace_status b/windows/bazel/get_workspace_status new file mode 100755 index 000000000000..8f83d55cbf78 --- /dev/null +++ b/windows/bazel/get_workspace_status @@ -0,0 +1,49 @@ +#!/bin/bash + +# This file was imported from https://github.com/bazelbuild/bazel at d6fec93. + +# This script will be run bazel when building process starts to +# generate key-value information that represents the status of the +# workspace. The output should be like +# +# KEY1 VALUE1 +# KEY2 VALUE2 +# +# If the script exits with non-zero code, it's considered as a failure +# and the output will be discarded. + +# For Envoy in particular, we want to force binaries to relink when the Git +# SHA changes (https://github.com/envoyproxy/envoy/issues/2551). This can be +# done by prefixing keys with "STABLE_". To avoid breaking compatibility with +# other status scripts, this one still echos the non-stable ("volatile") names. + +# If this SOURCE_VERSION file exists then it must have been placed here by a +# distribution doing a non-git, source build. +# Distributions would be expected to echo the commit/tag as BUILD_SCM_REVISION +if [ -f SOURCE_VERSION ] +then + echo "BUILD_SCM_REVISION $(cat SOURCE_VERSION)" + echo "STABLE_BUILD_SCM_REVISION $(cat SOURCE_VERSION)" + echo "BUILD_SCM_STATUS Distribution" + exit 0 +fi + +# The code below presents an implementation that works for git repository +git_rev=$(git rev-parse HEAD) +if [[ $? != 0 ]]; +then + exit 1 +fi +echo "BUILD_SCM_REVISION ${git_rev}" +echo "STABLE_BUILD_SCM_REVISION ${git_rev}" + +# Check whether there are any uncommited changes +git diff-index --quiet HEAD -- +if [[ $? == 0 ]]; +then + tree_status="Clean" +else + tree_status="Modified" +fi +echo "BUILD_SCM_STATUS ${tree_status}" +echo "STABLE_BUILD_SCM_STATUS ${tree_status}" diff --git a/windows/bazel/get_workspace_status.bat b/windows/bazel/get_workspace_status.bat new file mode 100644 index 000000000000..8fe3029f7d42 --- /dev/null +++ b/windows/bazel/get_workspace_status.bat @@ -0,0 +1,3 @@ +@ECHO OFF +bash -c "bazel/get_workspace_status %*" +exit %ERRORLEVEL% diff --git a/windows/setup/workstation_setup.ps1 b/windows/setup/workstation_setup.ps1 new file mode 100644 index 000000000000..e965c95f3d05 --- /dev/null +++ b/windows/setup/workstation_setup.ps1 @@ -0,0 +1,54 @@ +$ErrorActionPreference = "Stop"; +$ProgressPreference="SilentlyContinue" + +trap { $host.SetShouldExit(1) } + +Invoke-WebRequest -UseBasicParsing "https://aka.ms/vs/15/release/vs_buildtools.exe" -OutFile "$env:TEMP\vs_buildtools.exe" + +# Install VS Build Tools in a directory without spaces to work around: https://github.com/bazelbuild/bazel/issues/4496 +# otherwise none of the go code will build (c++ is fine) + +$vsInstallDir="c:\VSBuildTools\2017" +echo "Installing VS Build Tools..." +cmd.exe /s /c "$env:TEMP\vs_buildtools.exe --installPath $vsInstallDir --passive --wait --norestart --nocache --add Microsoft.VisualStudio.Component.VC.CoreBuildTools --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.Windows10SDK.17134" + +if ($LASTEXITCODE -ne 0) { + echo "VS Build Tools install failed: $LASTEXITCODE" + exit $LASTEXITCODE +} +Remove-Item "$env:TEMP\vs_buildtools.exe" +echo "Done" + +Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) + +choco install make bazel cmake ninja git -y +if ($LASTEXITCODE -ne 0) { + echo "choco install failed: $LASTEXITCODE" + exit $LASTEXITCODE +} + +$envoyBazelRootDir = "c:\_eb" + +$env:ENVOY_BAZEL_ROOT=$envoyBazelRootDir +setx ENVOY_BAZEL_ROOT $envoyBazelRootDir > $nul +if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE +} + +$env:PATH ="$env:PATH;c:\tools\msys64\usr\bin;c:\make\bin;c:\Program Files\CMake\bin;C:\Python27;c:\programdata\chocolatey\bin;C:\Program Files\Git\bin" +setx PATH $env:PATH > $nul +if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE +} + +$env:BAZEL_VC="$vsInstallDir\VC" +setx BAZEL_VC $env:BAZEL_VC > $nul +if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE +} + +$env:BAZEL_SH="C:\tools\msys64\usr\bin\bash.exe" +setx BAZEL_SH $env:BAZEL_SH > $nul +if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE +} diff --git a/windows/tools/bazel.rc b/windows/tools/bazel.rc new file mode 100644 index 000000000000..205e76b3bed4 --- /dev/null +++ b/windows/tools/bazel.rc @@ -0,0 +1,7 @@ +# Windows/Envoy specific Bazel build/test options. + +build --workspace_status_command=windows/bazel/get_workspace_status.bat +build --experimental_shortened_obj_file_path +build --define signal_trace=disabled +build --define hot_restart=disabled +build --define tcmalloc=disabled From 5bd4ab191b15ecf4703e98847c4cc9bcbab141a4 Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Tue, 3 Jul 2018 15:25:28 -0400 Subject: [PATCH 02/10] Tag native cc_proto_library as "manual" This is so it doesn't build when Linux ci runs `bazel build @envoy_api//envoy/...` Only one of the pgv_cc_proto_library or the native cc_proto_library can build at a time. Signed-off-by: Amin Jamali Signed-off-by: Sam Smith --- api/bazel/api_build_system.bzl | 1 + api/bazel/repositories.bzl | 1 + 2 files changed, 2 insertions(+) diff --git a/api/bazel/api_build_system.bzl b/api/bazel/api_build_system.bzl index 7536aa18388b..874694a35dd8 100644 --- a/api/bazel/api_build_system.bzl +++ b/api/bazel/api_build_system.bzl @@ -135,6 +135,7 @@ def api_proto_library(name, visibility = ["//visibility:private"], srcs = [], de native.cc_proto_library( name = _Suffix(name, _CC_SUFFIX) + "_native", deps = [name], + tags=["manual"], visibility = ["//visibility:public"], ) diff --git a/api/bazel/repositories.bzl b/api/bazel/repositories.bzl index 338722313618..2db011cc9d6e 100644 --- a/api/bazel/repositories.bzl +++ b/api/bazel/repositories.bzl @@ -47,6 +47,7 @@ proto_library( cc_proto_library( name = "http_api_protos_native", deps = [":http_api_protos_proto"], + tags=["manual"], visibility = ["//visibility:public"], ) From 1f88b54aa9b8babe27bb087495993683c86a42a4 Mon Sep 17 00:00:00 2001 From: Amin Jamali Date: Mon, 9 Jul 2018 11:12:33 -0400 Subject: [PATCH 03/10] Use curl instead of wget curl exists in MSYS2 by default. Signed-off-by: Sam Smith --- ci/build_container/build_recipes/cares.sh | 2 +- ci/build_container/build_recipes/gperftools.sh | 2 +- ci/build_container/build_recipes/libevent.sh | 4 ++-- ci/build_container/build_recipes/luajit.sh | 2 +- ci/build_container/build_recipes/nghttp2.sh | 2 +- ci/build_container/build_recipes/yaml-cpp.sh | 2 +- ci/build_container/build_recipes/zlib.sh | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ci/build_container/build_recipes/cares.sh b/ci/build_container/build_recipes/cares.sh index 376cb03ae9d3..5168c44886a4 100755 --- a/ci/build_container/build_recipes/cares.sh +++ b/ci/build_container/build_recipes/cares.sh @@ -10,7 +10,7 @@ VERSION=cares-1_14_0 CPPFLAGS="$(for f in $CXXFLAGS; do if [[ $f =~ -D.* ]]; then echo $f; fi; done | tr '\n' ' ')" CFLAGS="$(for f in $CXXFLAGS; do if [[ ! $f =~ -D.* ]]; then echo $f; fi; done | tr '\n' ' ')" -wget -O c-ares-"$VERSION".tar.gz https://github.com/c-ares/c-ares/archive/"$VERSION".tar.gz +curl https://github.com/c-ares/c-ares/archive/"$VERSION".tar.gz -sLo c-ares-"$VERSION".tar.gz tar xf c-ares-"$VERSION".tar.gz cd c-ares-"$VERSION" diff --git a/ci/build_container/build_recipes/gperftools.sh b/ci/build_container/build_recipes/gperftools.sh index f94c542c01ed..ec8e5f8aedac 100755 --- a/ci/build_container/build_recipes/gperftools.sh +++ b/ci/build_container/build_recipes/gperftools.sh @@ -7,7 +7,7 @@ if [[ "${OS}" == "Windows_NT" ]]; then exit 0 fi -wget -O gperftools-"$VERSION".tar.gz https://github.com/gperftools/gperftools/releases/download/gperftools-"$VERSION"/gperftools-"$VERSION".tar.gz +curl https://github.com/gperftools/gperftools/releases/download/gperftools-"$VERSION"/gperftools-"$VERSION".tar.gz -sLo gperftools-"$VERSION".tar.gz tar xf gperftools-"$VERSION".tar.gz cd gperftools-"$VERSION" diff --git a/ci/build_container/build_recipes/libevent.sh b/ci/build_container/build_recipes/libevent.sh index 245f74a057f4..a03888850a7c 100755 --- a/ci/build_container/build_recipes/libevent.sh +++ b/ci/build_container/build_recipes/libevent.sh @@ -5,7 +5,7 @@ set -e VERSION=2.1.8-stable if [[ "${OS}" == "Windows_NT" ]]; then - wget -O libevent-"$VERSION".tar.gz https://github.com/libevent/libevent/archive/release-"$VERSION".tar.gz + curl https://github.com/libevent/libevent/archive/release-"$VERSION".tar.gz -sLo libevent-"$VERSION".tar.gz tar xf libevent-"$VERSION".tar.gz cd libevent-release-"$VERSION" @@ -22,7 +22,7 @@ if [[ "${OS}" == "Windows_NT" ]]; then ninja install cp "CMakeFiles/event.dir/event.pdb" "$THIRDPARTY_BUILD/lib/event.pdb" else - wget -O libevent-"$VERSION".tar.gz https://github.com/libevent/libevent/releases/download/release-"$VERSION"/libevent-"$VERSION".tar.gz + curl https://github.com/libevent/libevent/releases/download/release-"$VERSION"/libevent-"$VERSION".tar.gz -sLo libevent-"$VERSION".tar.gz tar xf libevent-"$VERSION".tar.gz cd libevent-"$VERSION" diff --git a/ci/build_container/build_recipes/luajit.sh b/ci/build_container/build_recipes/luajit.sh index 70c96c5b1770..52cd77b81cd5 100644 --- a/ci/build_container/build_recipes/luajit.sh +++ b/ci/build_container/build_recipes/luajit.sh @@ -4,7 +4,7 @@ set -e VERSION=2.0.5 -wget -O LuaJIT-"$VERSION".tar.gz https://github.com/LuaJIT/LuaJIT/archive/v"$VERSION".tar.gz +curl https://github.com/LuaJIT/LuaJIT/archive/v"$VERSION".tar.gz -sLo LuaJIT-"$VERSION".tar.gz tar xf LuaJIT-"$VERSION".tar.gz cd LuaJIT-"$VERSION" diff --git a/ci/build_container/build_recipes/nghttp2.sh b/ci/build_container/build_recipes/nghttp2.sh index 1693cfc8d824..14edacc63937 100755 --- a/ci/build_container/build_recipes/nghttp2.sh +++ b/ci/build_container/build_recipes/nghttp2.sh @@ -4,7 +4,7 @@ set -e VERSION=1.32.0 -wget -O nghttp2-"$VERSION".tar.gz https://github.com/nghttp2/nghttp2/releases/download/v"$VERSION"/nghttp2-"$VERSION".tar.gz +curl https://github.com/nghttp2/nghttp2/releases/download/v"$VERSION"/nghttp2-"$VERSION".tar.gz -sLo nghttp2-"$VERSION".tar.gz tar xf nghttp2-"$VERSION".tar.gz cd nghttp2-"$VERSION" diff --git a/ci/build_container/build_recipes/yaml-cpp.sh b/ci/build_container/build_recipes/yaml-cpp.sh index 7e760bdf09b8..f7518664d023 100755 --- a/ci/build_container/build_recipes/yaml-cpp.sh +++ b/ci/build_container/build_recipes/yaml-cpp.sh @@ -4,7 +4,7 @@ set -e VERSION=0.6.2 -wget -O yaml-cpp-"$VERSION".tar.gz https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-"$VERSION".tar.gz +curl https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-"$VERSION".tar.gz -sLo yaml-cpp-"$VERSION".tar.gz tar xf yaml-cpp-"$VERSION".tar.gz cd yaml-cpp-yaml-cpp-"$VERSION" diff --git a/ci/build_container/build_recipes/zlib.sh b/ci/build_container/build_recipes/zlib.sh index 8d1506d39f01..0fbf14440f45 100644 --- a/ci/build_container/build_recipes/zlib.sh +++ b/ci/build_container/build_recipes/zlib.sh @@ -4,7 +4,7 @@ set -e VERSION=1.2.11 -wget -O zlib-"$VERSION".tar.gz https://github.com/madler/zlib/archive/v"$VERSION".tar.gz +curl https://github.com/madler/zlib/archive/v"$VERSION".tar.gz -sLo zlib-"$VERSION".tar.gz tar xf zlib-"$VERSION".tar.gz cd zlib-"$VERSION" From a8eefb8d2dbd9d0eb05ec5e839c8eea3b7994897 Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Mon, 9 Jul 2018 11:38:37 -0400 Subject: [PATCH 04/10] Remove get_workspace_status for windows builds This was used for linkstamping on linux that would not work on windows. Signed-off-by: Amin Jamali --- ci/build_setup.ps1 | 2 +- windows/bazel/get_workspace_status | 49 -------------------------- windows/bazel/get_workspace_status.bat | 3 -- windows/tools/bazel.rc | 1 - 4 files changed, 1 insertion(+), 54 deletions(-) delete mode 100755 windows/bazel/get_workspace_status delete mode 100644 windows/bazel/get_workspace_status.bat diff --git a/ci/build_setup.ps1 b/ci/build_setup.ps1 index 5ec926493754..dcd191c59b55 100755 --- a/ci/build_setup.ps1 +++ b/ci/build_setup.ps1 @@ -17,6 +17,6 @@ $env:ENVOY_SRCDIR = [System.IO.Path]::GetFullPath("$PSScriptRoot\..") echo "ENVOY_BAZEL_ROOT: $env:ENVOY_BAZEL_ROOT" echo "ENVOY_SRCDIR: $env:ENVOY_SRCDIR" -$env:BAZEL_BASE_OPTIONS="--output_base=$env:ENVOY_BAZEL_ROOT --bazelrc=$env:ENVOY_SRCDIR\windows\tools\bazel.rc --batch" +$env:BAZEL_BASE_OPTIONS="--nomaster_bazelrc --output_base=$env:ENVOY_BAZEL_ROOT --bazelrc=$env:ENVOY_SRCDIR\windows\tools\bazel.rc --batch" $env:BAZEL_BUILD_OPTIONS="--strategy=Genrule=standalone --spawn_strategy=standalone --verbose_failures --action_env=HOME --action_env=PYTHONUSERBASE --jobs=$env:NUM_CPUS --show_task_finish $env:BAZEL_BUILD_EXTRA_OPTIONS" $env:BAZEL_TEST_OPTIONS="$env:BAZEL_BUILD_OPTIONS --test_env=HOME --test_env=PYTHONUSERBASE --test_env=UBSAN_OPTIONS=print_stacktrace=1 --cache_test_results=no --test_output=all $env:BAZEL_EXTRA_TEST_OPTIONS" diff --git a/windows/bazel/get_workspace_status b/windows/bazel/get_workspace_status deleted file mode 100755 index 8f83d55cbf78..000000000000 --- a/windows/bazel/get_workspace_status +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -# This file was imported from https://github.com/bazelbuild/bazel at d6fec93. - -# This script will be run bazel when building process starts to -# generate key-value information that represents the status of the -# workspace. The output should be like -# -# KEY1 VALUE1 -# KEY2 VALUE2 -# -# If the script exits with non-zero code, it's considered as a failure -# and the output will be discarded. - -# For Envoy in particular, we want to force binaries to relink when the Git -# SHA changes (https://github.com/envoyproxy/envoy/issues/2551). This can be -# done by prefixing keys with "STABLE_". To avoid breaking compatibility with -# other status scripts, this one still echos the non-stable ("volatile") names. - -# If this SOURCE_VERSION file exists then it must have been placed here by a -# distribution doing a non-git, source build. -# Distributions would be expected to echo the commit/tag as BUILD_SCM_REVISION -if [ -f SOURCE_VERSION ] -then - echo "BUILD_SCM_REVISION $(cat SOURCE_VERSION)" - echo "STABLE_BUILD_SCM_REVISION $(cat SOURCE_VERSION)" - echo "BUILD_SCM_STATUS Distribution" - exit 0 -fi - -# The code below presents an implementation that works for git repository -git_rev=$(git rev-parse HEAD) -if [[ $? != 0 ]]; -then - exit 1 -fi -echo "BUILD_SCM_REVISION ${git_rev}" -echo "STABLE_BUILD_SCM_REVISION ${git_rev}" - -# Check whether there are any uncommited changes -git diff-index --quiet HEAD -- -if [[ $? == 0 ]]; -then - tree_status="Clean" -else - tree_status="Modified" -fi -echo "BUILD_SCM_STATUS ${tree_status}" -echo "STABLE_BUILD_SCM_STATUS ${tree_status}" diff --git a/windows/bazel/get_workspace_status.bat b/windows/bazel/get_workspace_status.bat deleted file mode 100644 index 8fe3029f7d42..000000000000 --- a/windows/bazel/get_workspace_status.bat +++ /dev/null @@ -1,3 +0,0 @@ -@ECHO OFF -bash -c "bazel/get_workspace_status %*" -exit %ERRORLEVEL% diff --git a/windows/tools/bazel.rc b/windows/tools/bazel.rc index 205e76b3bed4..1aeeb3507d26 100644 --- a/windows/tools/bazel.rc +++ b/windows/tools/bazel.rc @@ -1,6 +1,5 @@ # Windows/Envoy specific Bazel build/test options. -build --workspace_status_command=windows/bazel/get_workspace_status.bat build --experimental_shortened_obj_file_path build --define signal_trace=disabled build --define hot_restart=disabled From 80b38b33d580e14b975b809ee214775a3685afee Mon Sep 17 00:00:00 2001 From: Amin Jamali Date: Mon, 9 Jul 2018 11:50:20 -0400 Subject: [PATCH 05/10] BAZEL_SH is the correct bash workstation_setup.ps1 will set BAZEL_SH after installing MSYS2 Signed-off-by: Sam Smith --- bazel/repositories.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazel/repositories.bat b/bazel/repositories.bat index 20bfb7245399..7b6695710593 100644 --- a/bazel/repositories.bat +++ b/bazel/repositories.bat @@ -1,4 +1,4 @@ echo "Start" @ECHO OFF -bash -c "./repositories.sh %*" +%BAZEL_SH% -c "./repositories.sh %*" exit %ERRORLEVEL% From 19e400261f0257bb71d76218080a4ae961ee0537 Mon Sep 17 00:00:00 2001 From: Amin Jamali Date: Mon, 9 Jul 2018 14:34:18 -0400 Subject: [PATCH 06/10] Fix nits Signed-off-by: Sam Smith --- api/bazel/api_build_system.bzl | 5 +++-- ci/build_container/build_recipes/benchmark.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/bazel/api_build_system.bzl b/api/bazel/api_build_system.bzl index 874694a35dd8..85dd0c4340c4 100644 --- a/api/bazel/api_build_system.bzl +++ b/api/bazel/api_build_system.bzl @@ -5,6 +5,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_test") _PY_SUFFIX="_py" _CC_SUFFIX="_cc" +_CC_NATIVE_SUFFIX="_cc_native" _GO_PROTO_SUFFIX="_go_proto" _GO_GRPC_SUFFIX="_go_grpc" _GO_IMPORTPATH_PREFIX="github.com/envoyproxy/data-plane-api/api/" @@ -133,9 +134,9 @@ def api_proto_library(name, visibility = ["//visibility:private"], srcs = [], de ) native.cc_proto_library( - name = _Suffix(name, _CC_SUFFIX) + "_native", + name = _Suffix(name, _CC_NATIVE_SUFFIX), deps = [name], - tags=["manual"], + tags = ["manual"], visibility = ["//visibility:public"], ) diff --git a/ci/build_container/build_recipes/benchmark.sh b/ci/build_container/build_recipes/benchmark.sh index 2a4369a5fd29..761ca8b6034a 100644 --- a/ci/build_container/build_recipes/benchmark.sh +++ b/ci/build_container/build_recipes/benchmark.sh @@ -21,7 +21,7 @@ fi cmake -G "$cmake_generator" ../benchmark \ -DCMAKE_BUILD_TYPE=RELEASE \ -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -$make_cmd +"$make_cmd" cp "src/$benchmark_lib" "$THIRDPARTY_BUILD"/lib cd ../benchmark From 91a87998e7845c5ee5788950614d178f6ec0317e Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Wed, 11 Jul 2018 10:28:37 -0400 Subject: [PATCH 07/10] Use select for prebuilt dependencies Signed-off-by: Natalie Arellano --- ci/prebuilt/BUILD | 61 +++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/ci/prebuilt/BUILD b/ci/prebuilt/BUILD index 37a16486298b..3e2e5bebe2ac 100644 --- a/ci/prebuilt/BUILD +++ b/ci/prebuilt/BUILD @@ -2,32 +2,37 @@ licenses(["notice"]) # Apache 2 package(default_visibility = ["//visibility:public"]) +config_setting( + name = "windows_x86_64", + values = {"cpu": "x64_windows"}, +) + cc_library( name = "ares", - srcs = glob([ - "thirdparty_build/lib/libcares.a", - "thirdparty_build/lib/cares.lib", - ]), + srcs = select({ + ":windows_x86_64": ["thirdparty_build/lib/cares.lib"], + "//conditions:default": ["thirdparty_build/lib/libcares.a"], + }), hdrs = glob(["thirdparty_build/include/ares*.h"]), includes = ["thirdparty_build/include"], ) cc_library( name = "benchmark", - srcs = glob([ - "thirdparty_build/lib/libbenchmark.a", - "thirdparty_build/lib/benchmark.lib", - ]), + srcs = select({ + ":windows_x86_64": ["thirdparty_build/lib/benchmark.lib"], + "//conditions:default": ["thirdparty_build/lib/libbenchmark.a"], + }), hdrs = ["thirdparty_build/include/testing/base/public/benchmark.h"], includes = ["thirdparty_build/include"], ) cc_library( name = "event", - srcs = glob([ - "thirdparty_build/lib/libevent.a", - "thirdparty_build/lib/event.lib", - ]), + srcs = select({ + ":windows_x86_64": ["thirdparty_build/lib/event.lib"], + "//conditions:default": ["thirdparty_build/lib/libevent.a"], + }), hdrs = glob(["thirdparty_build/include/event2/**/*.h"]), includes = ["thirdparty_build/include"], ) @@ -40,10 +45,10 @@ cc_library( cc_library( name = "luajit", - srcs = glob([ - "thirdparty_build/lib/libluajit-5.1.a", - "thirdparty_build/lib/luajit.lib", - ]), + srcs = select({ + ":windows_x86_64": ["thirdparty_build/lib/luajit.lib"], + "//conditions:default": ["thirdparty_build/lib/libluajit-5.1.a"], + }), hdrs = glob(["thirdparty_build/include/luajit-2.0/*"]), includes = ["thirdparty_build/include"], # TODO(mattklein123): We should strip luajit-2.0 here for consumers. However, if we do that @@ -52,10 +57,10 @@ cc_library( cc_library( name = "nghttp2", - srcs = glob([ - "thirdparty_build/lib/libnghttp2.a", - "thirdparty_build/lib/nghttp2.lib", - ]), + srcs = select({ + ":windows_x86_64": ["thirdparty_build/lib/nghttp2.lib"], + "//conditions:default": ["thirdparty_build/lib/libnghttp2.a"], + }), hdrs = glob(["thirdparty_build/include/nghttp2/**/*.h"]), includes = ["thirdparty_build/include"], ) @@ -69,20 +74,20 @@ cc_library( cc_library( name = "yaml_cpp", - srcs = glob([ - "thirdparty_build/lib/libyaml-cpp.a", - "thirdparty_build/lib/libyaml-cpp*.lib", - ]), + srcs = select({ + ":windows_x86_64": glob(["thirdparty_build/lib/libyaml-cpp*.lib"]), + "//conditions:default": ["thirdparty_build/lib/libyaml-cpp.a"], + }), hdrs = glob(["thirdparty_build/include/yaml-cpp/**/*.h"]), includes = ["thirdparty_build/include"], ) cc_library( name = "zlib", - srcs = glob([ - "thirdparty_build/lib/libz.a", - "thirdparty_build/lib/zlibstaticd.lib", - ]), + srcs = select({ + ":windows_x86_64": glob(["thirdparty_build/lib/zlibstaticd.lib"]), + "//conditions:default": ["thirdparty_build/lib/libz.a"], + }), hdrs = [ "thirdparty_build/include/zconf.h", "thirdparty_build/include/zlib.h", From f1a03854ccfba7886688839c13c5b1d9ff1a5a6e Mon Sep 17 00:00:00 2001 From: Matthew Horan Date: Thu, 12 Jul 2018 10:13:57 -0400 Subject: [PATCH 08/10] Fix Windows build after merge Signed-off-by: Sam Smith --- include/envoy/upstream/BUILD | 4 +++- source/extensions/extensions_build_config.bzl | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/envoy/upstream/BUILD b/include/envoy/upstream/BUILD index d8661cc8bd44..f0d9deab4dd8 100644 --- a/include/envoy/upstream/BUILD +++ b/include/envoy/upstream/BUILD @@ -36,9 +36,11 @@ envoy_cc_library( envoy_cc_library( name = "health_checker_interface", hdrs = ["health_checker.h"], + protobuf_cc_deps = [ + "@envoy_api//envoy/data/core/v2alpha:health_check_event_cc", + ], deps = [ ":upstream_interface", - "@envoy_api//envoy/data/core/v2alpha:health_check_event_cc", ], ) diff --git a/source/extensions/extensions_build_config.bzl b/source/extensions/extensions_build_config.bzl index 133ea5cde53b..c12d4fb425a9 100644 --- a/source/extensions/extensions_build_config.bzl +++ b/source/extensions/extensions_build_config.bzl @@ -143,26 +143,26 @@ WINDOWS_EXTENSIONS = { # NOTE: The proxy_protocol filter is implicitly loaded if proxy_protocol functionality is # configured on the listener. Do not remove it in that case or configs will fail to load. - "envoy.filters.listener.proxy_protocol": "//source/extensions/filters/listener/proxy_protocol:config", + #"envoy.filters.listener.proxy_protocol": "//source/extensions/filters/listener/proxy_protocol:config", # NOTE: The original_dst filter is implicitly loaded if original_dst functionality is # configured on the listener. Do not remove it in that case or configs will fail to load. #"envoy.filters.listener.original_dst": "//source/extensions/filters/listener/original_dst:config", - "envoy.filters.listener.tls_inspector": "//source/extensions/filters/listener/tls_inspector:config", + #"envoy.filters.listener.tls_inspector": "//source/extensions/filters/listener/tls_inspector:config", # # Network filters # - "envoy.filters.network.client_ssl_auth": "//source/extensions/filters/network/client_ssl_auth:config", + #"envoy.filters.network.client_ssl_auth": "//source/extensions/filters/network/client_ssl_auth:config", #"envoy.filters.network.echo": "//source/extensions/filters/network/echo:config", #"envoy.filters.network.ext_authz": "//source/extensions/filters/network/ext_authz:config", #"envoy.filters.network.http_connection_manager": "//source/extensions/filters/network/http_connection_manager:config", #"envoy.filters.network.mongo_proxy": "//source/extensions/filters/network/mongo_proxy:config", #"envoy.filters.network.redis_proxy": "//source/extensions/filters/network/redis_proxy:config", #"envoy.filters.network.ratelimit": "//source/extensions/filters/network/ratelimit:config", - "envoy.filters.network.tcp_proxy": "//source/extensions/filters/network/tcp_proxy:config", + #"envoy.filters.network.tcp_proxy": "//source/extensions/filters/network/tcp_proxy:config", # TODO(zuercher): switch to config target once a filter exists #"envoy.filters.network.thrift_proxy": "//source/extensions/filters/network/thrift_proxy:transport_lib", From b5479cf1ecd1d9dbdc4e13c8583a96365aa162fa Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Thu, 12 Jul 2018 10:17:22 -0400 Subject: [PATCH 09/10] Format fixes Signed-off-by: Matthew Horan Signed-off-by: Sam Smith Signed-off-by: Matthew Horan --- bazel/envoy_build_system.bzl | 28 +++++++++++++--------------- bazel/repositories.bzl | 13 +++++++------ source/extensions/all_extensions.bzl | 6 +++--- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl index 28a2a64c2463..09d928fb1389 100644 --- a/bazel/envoy_build_system.bzl +++ b/bazel/envoy_build_system.bzl @@ -6,13 +6,13 @@ def envoy_package(): # Compute the final copts based on various options. def envoy_copts(repository, test = False): posix_options = [ - "-Wall", - "-Wextra", - "-Werror", - "-Wnon-virtual-dtor", - "-Woverloaded-virtual", - "-Wold-style-cast", - "-std=c++14", + "-Wall", + "-Wextra", + "-Werror", + "-Wnon-virtual-dtor", + "-Woverloaded-virtual", + "-Wold-style-cast", + "-std=c++14", ] msvc_options = [ @@ -29,8 +29,8 @@ def envoy_copts(repository, test = False): ] return select({ - "//bazel:windows_x86_64": msvc_options, - "//conditions:default": posix_options, + "//bazel:windows_x86_64": msvc_options, + "//conditions:default": posix_options, }) + select({ # Bazel adds an implicit -DNDEBUG for opt. repository + "//bazel:opt_build": [] if test else ["-ggdb3"], @@ -101,7 +101,6 @@ def _envoy_stamped_linkopts(): ], }) - def _envoy_stamped_deps(): return select({ "@bazel_tools//tools/osx:darwin": [ @@ -149,8 +148,8 @@ def tcmalloc_external_deps(repository): # Dependencies on libevent should be wrapped with this function. def libevent_external_deps(repository): return [envoy_external_dep_path("event")] + select({ - repository + "//bazel:windows_x86_64": [], - "//conditions:default": [envoy_external_dep_path("event_pthreads")], + repository + "//bazel:windows_x86_64": [], + "//conditions:default": [envoy_external_dep_path("event_pthreads")], }) def http_api_protos_external_deps(repository): @@ -198,7 +197,6 @@ def envoy_cc_library( tags = [], deps = [], strip_include_prefix = None): - if tcmalloc_dep: deps += tcmalloc_external_deps(repository) if libevent_dep: @@ -224,8 +222,8 @@ def envoy_cc_library( alwayslink = 1, linkstatic = 1, linkstamp = select({ - repository + "//bazel:windows_x86_64": None, - "//conditions:default": linkstamp, + repository + "//bazel:windows_x86_64": None, + "//conditions:default": linkstamp, }), strip_include_prefix = strip_include_prefix, ) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 49583b891b91..05384c54924f 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -7,9 +7,10 @@ load(":genrule_repository.bzl", "genrule_repository") load(":patched_http_archive.bzl", "patched_http_archive") load(":repository_locations.bzl", "REPOSITORY_LOCATIONS") load(":target_recipes.bzl", "TARGET_RECIPES") -load("@bazel_tools//tools/cpp:windows_cc_configure.bzl", - "find_vc_path", - "setup_vc_env_vars", +load( + "@bazel_tools//tools/cpp:windows_cc_configure.bzl", + "find_vc_path", + "setup_vc_env_vars", ) load("@bazel_tools//tools/cpp:lib_cc_configure.bzl", "get_env_var") @@ -93,9 +94,9 @@ def _build_recipe_repository_impl(ctxt): vc_path = find_vc_path(ctxt) current_path = get_env_var(ctxt, "PATH", None, False) env = setup_vc_env_vars(ctxt, vc_path) - env["PATH"]+=(";%s" % current_path) - env["CC"]="cl" - env["CXX"]="cl" + env["PATH"] += (";%s" % current_path) + env["CC"] = "cl" + env["CXX"] = "cl" env["CXXFLAGS"] = "-DNDEBUG" env["CFLAGS"] = "-DNDEBUG" command = ["./repositories.bat"] + ctxt.attr.recipes diff --git a/source/extensions/all_extensions.bzl b/source/extensions/all_extensions.bzl index 6d868092cbcb..1dc1a34aad6b 100644 --- a/source/extensions/all_extensions.bzl +++ b/source/extensions/all_extensions.bzl @@ -19,12 +19,12 @@ def envoy_windows_extensions(): # These extensions are registered using the extension system but are required for the core # Envoy build. windows_extensions = [ - "//source/extensions/transport_sockets/raw_buffer:config", - "//source/extensions/transport_sockets/ssl:config", + "//source/extensions/transport_sockets/raw_buffer:config", + "//source/extensions/transport_sockets/ssl:config", ] # These extensions can be removed on a site specific basis. for path in WINDOWS_EXTENSIONS.values(): - windows_extensions.append(path) + windows_extensions.append(path) return windows_extensions From e78611441d884d7edc79f766d0e355319d69b73e Mon Sep 17 00:00:00 2001 From: Matthew Horan Date: Thu, 12 Jul 2018 15:31:38 -0400 Subject: [PATCH 10/10] Simplify nghttp2 patch (hopefully can be upstreamed) Signed-off-by: Sam Smith Signed-off-by: Matthew Horan --- ci/build_container/build_recipes/nghttp2.sh | 34 ++++++--------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/ci/build_container/build_recipes/nghttp2.sh b/ci/build_container/build_recipes/nghttp2.sh index 14edacc63937..727d9c615bc2 100755 --- a/ci/build_container/build_recipes/nghttp2.sh +++ b/ci/build_container/build_recipes/nghttp2.sh @@ -11,31 +11,17 @@ cd nghttp2-"$VERSION" # Allow nghttp2 to build as static lib on Windows cat > nghttp2_cmakelists.diff << 'EOF' diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt -index 17e422b..b2e7a6e 100644 +index 17e422b2..e58070f5 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt -@@ -37,8 +37,8 @@ if(WIN32) - set(NGHTTP2_RES ${CMAKE_CURRENT_BINARY_DIR}/version.rc) - endif() - --# Public shared library --add_library(nghttp2 SHARED ${NGHTTP2_SOURCES} ${NGHTTP2_RES}) -+# Public library -+add_library(nghttp2 ${NGHTTP2_SOURCES} ${NGHTTP2_RES}) - set_target_properties(nghttp2 PROPERTIES - COMPILE_FLAGS "${WARNCFLAGS}" - VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION} -@@ -49,6 +49,10 @@ target_include_directories(nghttp2 INTERFACE - "${CMAKE_CURRENT_SOURCE_DIR}/includes" - ) - -+if(NOT BUILD_SHARED_LIBS) -+ target_compile_definitions(nghttp2 PUBLIC "-DNGHTTP2_STATICLIB") -+endif() -+ - if(HAVE_CUNIT OR ENABLE_STATIC_LIB) - # Static library (for unittests because of symbol visibility) - add_library(nghttp2_static STATIC ${NGHTTP2_SOURCES}) +@@ -56,6 +56,7 @@ if(HAVE_CUNIT OR ENABLE_STATIC_LIB) + COMPILE_FLAGS "${WARNCFLAGS}" + VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION} + ARCHIVE_OUTPUT_NAME nghttp2 ++ ARCHIVE_OUTPUT_DIRECTORY static + ) + target_compile_definitions(nghttp2_static PUBLIC "-DNGHTTP2_STATICLIB") + if(ENABLE_STATIC_LIB) EOF if [[ "${OS}" == "Windows_NT" ]]; then @@ -48,7 +34,7 @@ if [[ "${OS}" == "Windows_NT" ]]; then .. ninja ninja install - cp "lib/CMakeFiles/nghttp2.dir/nghttp2.pdb" "$THIRDPARTY_BUILD/lib/nghttp2.pdb" + cp "lib/CMakeFiles/nghttp2_static.dir/nghttp2_static.pdb" "$THIRDPARTY_BUILD/lib/nghttp2_static.pdb" else ./configure --prefix="$THIRDPARTY_BUILD" --enable-shared=no --enable-lib-only make V=1 install