diff --git a/.azure-pipelines/pipelines.yml b/.azure-pipelines/pipelines.yml index b7d2f94d3206..3395229a721c 100644 --- a/.azure-pipelines/pipelines.yml +++ b/.azure-pipelines/pipelines.yml @@ -132,17 +132,22 @@ jobs: steps: - powershell: | .\ci\windows_ci_setup.ps1 + Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR\usr\bin" + Write-Host "##vso[task.prependpath]$env:VC_TOOLS_BIN_X64;$env:VC_CMAKE_PATH\CMake\bin;$env:VC_CMAKE_PATH\Ninja" Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR" displayName: "Install dependencies" env: TOOLS_BIN_DIR: $(Pipeline.Workspace)\bin + VC_CMAKE_PATH: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake" + VC_TOOLS_BIN_X64: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX64\\x64" - bash: ci/windows_ci_steps.sh displayName: "Run Windows CI" env: - TMPDIR: $(Agent.TempDirectory) BAZEL_VC: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC" - BAZEL_SH: "C:\\Program Files\\Git\\bin\\bash.exe" + BAZEL_SH: $(Pipeline.Workspace)/bin/usr/bin/bash.exe BAZEL_REMOTE_CACHE: grpcs://remotebuildexecution.googleapis.com BAZEL_REMOTE_INSTANCE: projects/envoy-ci/instances/default_instance GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey) + MSYS2_ARG_CONV_EXCL: "*" + TMPDIR: $(Agent.TempDirectory) diff --git a/.bazelrc b/.bazelrc index 028f8bf46785..f39013f27000 100644 --- a/.bazelrc +++ b/.bazelrc @@ -10,7 +10,7 @@ # Startup options cannot be selected via config. startup --host_jvm_args=-Xmx2g -build --workspace_status_command=bazel/get_workspace_status +build --workspace_status_command="bash bazel/get_workspace_status" build --experimental_local_memory_estimate build --experimental_strict_action_env=true build --host_force_python=PY3 @@ -205,5 +205,46 @@ build:compdb --strip=always build:compdb --build_tag_filters=-nocompdb build:compdb --define=ENVOY_CONFIG_COMPILATION_DATABASE=1 +# Windows build quirks +build:windows --action_env=TMPDIR +build:windows --define signal_trace=disabled +build:windows --define hot_restart=disabled +build:windows --define tcmalloc=disabled +build:windows --define manual_stamp=manual_stamp + +# Should not be required after upstream fix to bazel, +# and already a no-op to linux/macos builds +# see issue https://github.com/bazelbuild/rules_foreign_cc/issues/301 +build:windows --copt="-DCARES_STATICLIB" +build:windows --copt="-DNGHTTP2_STATICLIB" +build:windows --copt="-DCURL_STATICLIB" + +# Required to work around build defects on Windows MSVC cl +# Unguarded gcc pragmas in quiche are not recognized by MSVC +build:msvc-cl --copt="/wd4068" +# Allows 'nodiscard' function return values to be discarded +build:msvc-cl --copt="/wd4834" +# Allows inline functions to be undefined +build:msvc-cl --copt="/wd4506" +build:msvc-cl --copt="-D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING" + +# Required to work around Windows clang-cl build defects +# Ignore conflicting definitions of _WIN32_WINNT +# Overriding __TIME__ etc is problematic (and is actually an invalid no-op) +build:clang-cl --copt="-Wno-macro-redefined" +build:clang-cl --copt="-Wno-builtin-macro-redefined" +build:clang-cl --action_env=USE_CLANG_CL=1 + +# Defaults to 'auto' - Off for windows, so override to linux behavior +build:windows --enable_runfiles=yes + +# This should become adopted by bazel as the default +build:windows --features=compiler_param_file + +# These options attempt to force a monolithic binary including the CRT +build:windows --features=fully_static_link +build:windows --features=static_link_msvcrt +build:windows --dynamic_mode=off + try-import %workspace%/clang.bazelrc try-import %workspace%/user.bazelrc diff --git a/bazel/external/kafka_int32.patch b/bazel/external/kafka_int32.patch new file mode 100644 index 000000000000..8b88fe335821 --- /dev/null +++ b/bazel/external/kafka_int32.patch @@ -0,0 +1,27 @@ +--- DescribeGroupsResponse.json 2020-03-25 16:12:16.373302600 -0400 ++++ DescribeGroupsResponse.json 2020-03-25 16:11:16.184156200 -0400 +@@ -63,7 +63,7 @@ + { "name": "MemberAssignment", "type": "bytes", "versions": "0+", + "about": "The current assignment provided by the group leader." } + ]}, +- { "name": "AuthorizedOperations", "type": "int32", "versions": "3+", "default": "-2147483648", ++ { "name": "AuthorizedOperations", "type": "int32", "versions": "3+", "default": "INT32_MIN", + "about": "32-bit bitfield to represent authorized operations for this group." } + ]} + ] + +--- MetadataResponse.json 2020-03-25 15:53:36.319161000 -0400 ++++ MetadataResponse.json 2020-03-25 15:54:11.510400000 -0400 +@@ -81,10 +81,10 @@ + { "name": "OfflineReplicas", "type": "[]int32", "versions": "5+", "ignorable": true, + "about": "The set of offline replicas of this partition." } + ]}, +- { "name": "TopicAuthorizedOperations", "type": "int32", "versions": "8+", "default": "-2147483648", ++ { "name": "TopicAuthorizedOperations", "type": "int32", "versions": "8+", "default": "INT32_MIN", + "about": "32-bit bitfield to represent authorized operations for this topic." } + ]}, +- { "name": "ClusterAuthorizedOperations", "type": "int32", "versions": "8+", "default": "-2147483648", ++ { "name": "ClusterAuthorizedOperations", "type": "int32", "versions": "8+", "default": "INT32_MIN", + "about": "32-bit bitfield to represent authorized operations for this cluster." } + ] + } diff --git a/bazel/foreign_cc/BUILD b/bazel/foreign_cc/BUILD index 24910612adf2..b2ee9cb74d7b 100644 --- a/bazel/foreign_cc/BUILD +++ b/bazel/foreign_cc/BUILD @@ -36,8 +36,6 @@ cc_library( ], ) -# autotools packages are unusable on Windows as-is -# TODO: Consider our own luajit.BUILD file as we do with many other packages configure_make( name = "luajit", configure_command = "build.py", @@ -51,10 +49,10 @@ configure_make( lib_source = "@com_github_luajit_luajit//:all", make_commands = [], out_include_dir = "include/luajit-2.1", - static_libraries = [ - "libluajit-5.1.a", - ], - tags = ["skip_on_windows"], + static_libraries = select({ + "//bazel:windows_x86_64": ["lua51.lib"], + "//conditions:default": ["libluajit-5.1.a"], + }), ) configure_make( @@ -70,10 +68,10 @@ configure_make( lib_source = "@com_github_moonjit_moonjit//:all", make_commands = [], out_include_dir = "include/moonjit-2.2", - static_libraries = [ - "libluajit-5.1.a", - ], - tags = ["skip_on_windows"], + static_libraries = select({ + "//bazel:windows_x86_64": ["lua51.lib"], + "//conditions:default": ["libluajit-5.1.a"], + }), ) envoy_cmake_external( diff --git a/bazel/foreign_cc/luajit.patch b/bazel/foreign_cc/luajit.patch index 82e8733a70fc..39d58d6dc3b0 100644 --- a/bazel/foreign_cc/luajit.patch +++ b/bazel/foreign_cc/luajit.patch @@ -48,7 +48,7 @@ new file mode 100755 index 0000000..9c71271 --- /dev/null +++ b/build.py -@@ -0,0 +1,39 @@ +@@ -0,0 +1,56 @@ +#!/usr/bin/env python + +import argparse @@ -86,5 +86,22 @@ index 0000000..9c71271 + + os.system('make V=1 PREFIX="{}" install'.format(args.prefix)) + -+main() ++def win_main(): ++ src_dir = os.path.dirname(os.path.realpath(__file__)) ++ dst_dir = os.getcwd() + "/luajit" ++ shutil.copytree(src_dir, os.path.basename(src_dir)) ++ os.chdir(os.path.basename(src_dir) + "/src") ++ os.system('msvcbuild.bat static') ++ os.makedirs(dst_dir + "/lib", exist_ok=True) ++ shutil.copy("lua51.lib", dst_dir + "/lib") ++ os.makedirs(dst_dir + "/include/luajit-2.1", exist_ok=True) ++ for header in ["lauxlib.h", "luaconf.h", "lua.h", "lua.hpp", "luajit.h", "lualib.h"]: ++ shutil.copy(header, dst_dir + "/include/luajit-2.1") ++ os.makedirs(dst_dir + "/bin", exist_ok=True) ++ shutil.copy("luajit.exe", dst_dir + "/bin") ++ ++if os.name == 'nt': ++ win_main() ++else: ++ main() + diff --git a/bazel/foreign_cc/moonjit.patch b/bazel/foreign_cc/moonjit.patch index 77679e2b13fa..c0d2c274eaae 100644 --- a/bazel/foreign_cc/moonjit.patch +++ b/bazel/foreign_cc/moonjit.patch @@ -48,7 +48,7 @@ new file mode 100755 index 0000000..9c71271 --- /dev/null +++ b/build.py -@@ -0,0 +1,39 @@ +@@ -0,0 +1,56 @@ +#!/usr/bin/env python + +import argparse @@ -86,5 +86,22 @@ index 0000000..9c71271 + + os.system('make V=1 PREFIX="{}" install'.format(args.prefix)) + -+main() ++def win_main(): ++ src_dir = os.path.dirname(os.path.realpath(__file__)) ++ dst_dir = os.getcwd() + "/moonjit" ++ shutil.copytree(src_dir, os.path.basename(src_dir)) ++ os.chdir(os.path.basename(src_dir) + "/src") ++ os.system('msvcbuild.bat static') ++ os.makedirs(dst_dir + "/lib", exist_ok=True) ++ shutil.copy("lua51.lib", dst_dir + "/lib") ++ os.makedirs(dst_dir + "/include/moonjit-2.2", exist_ok=True) ++ for header in ["lauxlib.h", "luaconf.h", "lua.h", "lua.hpp", "luajit.h", "lualib.h"]: ++ shutil.copy(header, dst_dir + "/include/moonjit-2.2") ++ os.makedirs(dst_dir + "/bin", exist_ok=True) ++ shutil.copy("luajit.exe", dst_dir + "/bin") ++ ++if os.name == 'nt': ++ win_main() ++else: ++ main() + diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 012d67bfa12c..90cefccf2094 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -5,8 +5,14 @@ load("@envoy_api//bazel:envoy_http_archive.bzl", "envoy_http_archive") load(":repository_locations.bzl", "REPOSITORY_LOCATIONS") load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") -# dict of {build recipe name: longform extension name,} -PPC_SKIP_TARGETS = {"luajit": "envoy.filters.http.lua"} +PPC_SKIP_TARGETS = ["envoy.filters.http.lua"] + +WINDOWS_SKIP_TARGETS = [ + "envoy.tracers.dynamic_ot", + "envoy.tracers.lightstep", + "envoy.tracers.datadog", + "envoy.tracers.opencensus", +] # Make all contents of an external repository accessible under a filegroup. Used for external HTTP # archives, e.g. cares. @@ -795,6 +801,7 @@ filegroup( http_archive( name = "kafka_source", build_file_content = KAFKASOURCE_BUILD_CONTENT, + patches = ["@envoy//bazel/external:kafka_int32.patch"], **REPOSITORY_LOCATIONS["kafka_source"] ) diff --git a/ci/build_setup.ps1 b/ci/build_setup.ps1 index b9768397f604..9d64fff8f1ca 100755 --- a/ci/build_setup.ps1 +++ b/ci/build_setup.ps1 @@ -17,5 +17,5 @@ $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="--noworkspace_rc --output_base=$env:ENVOY_BAZEL_ROOT --bazelrc=$env:ENVOY_SRCDIR\windows\.bazelrc" +$env:BAZEL_BASE_OPTIONS="--output_base=$env:ENVOY_BAZEL_ROOT" $env:BAZEL_BUILD_OPTIONS="--config=msvc-cl --features=compiler_param_file --strategy=Genrule=standalone --spawn_strategy=standalone --verbose_failures --jobs=$env:NUM_CPUS --show_task_finish --test_output=all $env:BAZEL_BUILD_EXTRA_OPTIONS $env:BAZEL_EXTRA_TEST_OPTIONS" diff --git a/ci/windows_ci_setup.ps1 b/ci/windows_ci_setup.ps1 index c0709a75cadc..c39f2c083e22 100644 --- a/ci/windows_ci_setup.ps1 +++ b/ci/windows_ci_setup.ps1 @@ -2,14 +2,6 @@ # The list of installed software can be found at: # https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md -Add-Type -AssemblyName System.IO.Compression.FileSystem -function Unzip -{ - param([string]$zipfile, [string]$outpath) - - [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) -} - function Checksum { param([string]$filepath, [string]$expected, [string]$algorithm) @@ -26,10 +18,23 @@ function Checksum mkdir "$env:TOOLS_BIN_DIR" $wc = New-Object System.Net.WebClient $wc.DownloadFile("https://github.com/bazelbuild/bazelisk/releases/download/v1.0/bazelisk-windows-amd64.exe", "$env:TOOLS_BIN_DIR\bazel.exe") -$wc.DownloadFile("https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip", "$env:TOOLS_BIN_DIR\ninja-win.zip") +# See https://sourceforge.net/projects/msys2/files/Base/x86_64/ for msys2 download source +$wc.DownloadFile("http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20190524.tar.xz", "$env:TEMP\msys2.tar.xz") # Check the SHA256 file hash of each downloaded file. Checksum $env:TOOLS_BIN_DIR\bazel.exe 96395ee9e3fb9f4499fcaffa8a94dd72b0748f495f366bc4be44dbf09d6827fc SHA256 -Checksum $env:TOOLS_BIN_DIR\ninja-win.zip 2d70010633ddaacc3af4ffbd21e22fae90d158674a09e132e06424ba3ab036e9 SHA256 +Checksum $env:TEMP\msys2.tar.xz 168e156fa9f00d90a8445676c023c63be6e82f71487f4e2688ab5cb13b345383 SHA256 -Unzip "$env:TOOLS_BIN_DIR\ninja-win.zip" "$env:TOOLS_BIN_DIR" +# Unpack and install msys2 and required packages +$tarpath="$env:ProgramFiles\Git\usr\bin\tar.exe" +$msys2TarPathClean = "/$env:TEMP/msys2.tar.xz".replace(':', '').replace('\', '/') +$outDirClean = "/$env:TOOLS_BIN_DIR".replace(':', '').replace('\', '/') +&"$tarpath" -Jxf $msys2TarPathClean -C $outDirClean --strip-components=1 +# Add utils to the path for msys2 setup +$env:PATH = "$env:TOOLS_BIN_DIR\usr\bin;$env:TOOLS_BIN_DIR\mingw64\bin;$env:PATH" +bash.exe -c "pacman-key --init 2>&1" +bash.exe -c "pacman-key --populate msys2 2>&1" +bash.exe -c "pacman.exe -Syyuu --noconfirm 2>&1" +bash.exe -c "pacman.exe -Syuu --noconfirm 2>&1" +bash.exe -c "pacman.exe -S --noconfirm --needed compression diffutils patch 2>&1" +bash.exe -c "pacman.exe -Scc --noconfirm 2>&1" diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index 9677009b9965..0ded44c4dd82 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -20,14 +20,24 @@ df -h # rules_foreign_cc does not currently use bazel output/temp directories by default, it uses mktemp # which respects the value of the TMPDIR environment variable drive="$(readlink -f $TMPDIR | cut -d '/' -f2)" -/c/windows/system32/cmd.exe "/c mklink /d $drive:\\$drive $drive:\\" +if [ ! -e "/$drive/$drive" ]; then + /c/windows/system32/cmd.exe /c "mklink /d $drive:\\$drive $drive:\\" +fi -BAZEL_STARTUP_OPTIONS="--noworkspace_rc --bazelrc=windows/.bazelrc --output_base=c:/_eb" +BAZEL_STARTUP_OPTIONS="--output_base=c:/_eb" BAZEL_BUILD_OPTIONS="-c opt --config=msvc-cl --show_task_finish --verbose_failures \ --test_output=all ${BAZEL_BUILD_EXTRA_OPTIONS} ${BAZEL_EXTRA_TEST_OPTIONS}" -bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //bazel/... --build_tag_filters=-skip_on_windows +# With all envoy-static and //test/ tree building, no need to test compile externals +# bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //bazel/... --build_tag_filters=-skip_on_windows bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //source/exe:envoy-static --build_tag_filters=-skip_on_windows -# bazel ${BAZEL_STARTUP_OPTIONS} test ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows --build_tests_only --test_summary=terse --test_output=errors +# TODO(sunjayBhatia, wrowe): We are disabling building/running tests for now as the AZP pipelines +# workers do not provide enough resources for us to produce fast enough or reliable enough builds. +# Test compilation of known MSVC-compatible test sources +# bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows --build_tests_only + +# Test invocations of known-working tests on Windows +# bazel ${BAZEL_STARTUP_OPTIONS} test ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows,-fails_on_windows --build_tests_only --test_summary=terse --test_output=errors + diff --git a/source/exe/BUILD b/source/exe/BUILD index 43ff9f36fd9f..867605c7663d 100644 --- a/source/exe/BUILD +++ b/source/exe/BUILD @@ -9,12 +9,8 @@ load( "envoy_cc_win32_library", "envoy_package", ) -load( - "//source/extensions:all_extensions.bzl", - "envoy_all_extensions", - "envoy_windows_extensions", -) -load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS") +load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") +load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") envoy_package() @@ -41,7 +37,7 @@ envoy_cc_library( "//source/server:server_lib", "//source/server:listener_hooks_lib", ] + select({ - "//bazel:windows_x86_64": envoy_windows_extensions(), + "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), "//conditions:default": envoy_all_extensions(), }), diff --git a/source/exe/win32/platform_impl.cc b/source/exe/win32/platform_impl.cc index 5db56c722521..ffedb3f478f6 100644 --- a/source/exe/win32/platform_impl.cc +++ b/source/exe/win32/platform_impl.cc @@ -9,10 +9,9 @@ namespace Envoy { PlatformImpl::PlatformImpl() : thread_factory_(std::make_unique()), file_system_(std::make_unique()) { - const WORD wVersionRequested = MAKEWORD(2, 2); - WSADATA wsaData; - const int rc = ::WSAStartup(wVersionRequested, &wsaData); - RELEASE_ASSERT(rc == 0, "WSAStartup failed with error"); + WSADATA wsa_data; + const WORD version_requested = MAKEWORD(2, 2); + RELEASE_ASSERT(WSAStartup(version_requested, &wsa_data) == 0, "WSAStartup failed with error"); } PlatformImpl::~PlatformImpl() { ::WSACleanup(); } diff --git a/source/extensions/all_extensions.bzl b/source/extensions/all_extensions.bzl index 74ea28bf426f..95f018c44973 100644 --- a/source/extensions/all_extensions.bzl +++ b/source/extensions/all_extensions.bzl @@ -1,5 +1,5 @@ load("@bazel_skylib//lib:dicts.bzl", "dicts") -load("@envoy_build_config//:extensions_build_config.bzl", "EXTENSIONS", "WINDOWS_EXTENSIONS") +load("@envoy_build_config//:extensions_build_config.bzl", "EXTENSIONS") # These extensions are registered using the extension system but are required for the core Envoy build. # The map may be overridden by extensions specified in envoy_build_config. @@ -9,14 +9,8 @@ _required_extensions = { } # Return all extensions to be compiled into Envoy. -def envoy_all_extensions(blacklist = dict()): +def envoy_all_extensions(blacklist = []): all_extensions = dicts.add(_required_extensions, EXTENSIONS) # These extensions can be removed on a site specific basis. - return [v for k, v in all_extensions.items() if not k in blacklist.values()] - -def envoy_windows_extensions(): - all_extensions = dicts.add(_required_extensions, WINDOWS_EXTENSIONS) - - # These extensions can be removed on a site specific basis. - return all_extensions.values() + return [v for k, v in all_extensions.items() if not k in blacklist] diff --git a/source/extensions/clusters/redis/redis_cluster.cc b/source/extensions/clusters/redis/redis_cluster.cc index dc0ebae317c0..0d07abb071d2 100644 --- a/source/extensions/clusters/redis/redis_cluster.cc +++ b/source/extensions/clusters/redis/redis_cluster.cc @@ -1,7 +1,5 @@ #include "redis_cluster.h" -#include - #include "envoy/config/cluster/redis/redis_cluster.pb.h" #include "envoy/config/cluster/redis/redis_cluster.pb.validate.h" #include "envoy/config/cluster/v3/cluster.pb.h" diff --git a/source/extensions/extensions_build_config.bzl b/source/extensions/extensions_build_config.bzl index 87b79586312f..1bb72dfb7e1d 100644 --- a/source/extensions/extensions_build_config.bzl +++ b/source/extensions/extensions_build_config.bzl @@ -172,177 +172,3 @@ EXTENSIONS = { "envoy.filters.http.cache.simple_http_cache": "//source/extensions/filters/http/cache/simple_http_cache:simple_http_cache_lib", } - -WINDOWS_EXTENSIONS = { - # - # Access loggers - # - - "envoy.access_loggers.file": "//source/extensions/access_loggers/file:config", - "envoy.access_loggers.http_grpc": "//source/extensions/access_loggers/grpc:http_config", - "envoy.access_loggers.tcp_grpc": "//source/extensions/access_loggers/grpc:tcp_config", - - # - # Clusters - # - - "envoy.clusters.aggregate": "//source/extensions/clusters/aggregate:cluster", - "envoy.clusters.dynamic_forward_proxy": "//source/extensions/clusters/dynamic_forward_proxy:cluster", - # "envoy.clusters.redis": "//source/extensions/clusters/redis:redis_cluster", - - # - # gRPC Credentials Plugins - # - - "envoy.grpc_credentials.file_based_metadata": "//source/extensions/grpc_credentials/file_based_metadata:config", - "envoy.grpc_credentials.aws_iam": "//source/extensions/grpc_credentials/aws_iam:config", - - # - # Health checkers - # - - # "envoy.health_checkers.redis": "//source/extensions/health_checkers/redis:config", - - # - # HTTP filters - # - - # "envoy.filters.http.adaptive_concurrency": "//source/extensions/filters/http/adaptive_concurrency:config", - "envoy.filters.http.aws_lambda": "//source/extensions/filters/http/aws_lambda:config", - "envoy.filters.http.aws_request_signing": "//source/extensions/filters/http/aws_request_signing:config", - "envoy.filters.http.buffer": "//source/extensions/filters/http/buffer:config", - "envoy.filters.http.cache": "//source/extensions/filters/http/cache:config", - "envoy.filters.http.cors": "//source/extensions/filters/http/cors:config", - "envoy.filters.http.csrf": "//source/extensions/filters/http/csrf:config", - "envoy.filters.http.dynamic_forward_proxy": "//source/extensions/filters/http/dynamic_forward_proxy: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_http1_reverse_bridge": "//source/extensions/filters/http/grpc_http1_reverse_bridge:config", - "envoy.filters.http.grpc_json_transcoder": "//source/extensions/filters/http/grpc_json_transcoder:config", - "envoy.filters.http.grpc_stats": "//source/extensions/filters/http/grpc_stats: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.header_to_metadata": "//source/extensions/filters/http/header_to_metadata: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.jwt_authn": "//source/extensions/filters/http/jwt_authn:config", - # "envoy.filters.http.lua": "//source/extensions/filters/http/lua:config", - "envoy.filters.http.on_demand": "//source/extensions/filters/http/on_demand:config", - "envoy.filters.http.original_src": "//source/extensions/filters/http/original_src: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", - "envoy.filters.http.tap": "//source/extensions/filters/http/tap:config", - - # - # Listener filters - # - - "envoy.filters.listener.http_inspector": "//source/extensions/filters/listener/http_inspector: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.original_src": "//source/extensions/filters/listener/original_src:config", - # 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.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.direct_response": "//source/extensions/filters/network/direct_response:config", - "envoy.filters.network.dubbo_proxy": "//source/extensions/filters/network/dubbo_proxy: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", - # WiP - # "envoy.filters.network.kafka_broker": "//source/extensions/filters/network/kafka:kafka_broker_config_lib", - "envoy.filters.network.local_ratelimit": "//source/extensions/filters/network/local_ratelimit:config", - "envoy.filters.network.mongo_proxy": "//source/extensions/filters/network/mongo_proxy:config", - # "envoy.filters.network.mysql_proxy": "//source/extensions/filters/network/mysql_proxy:config", - "envoy.filters.network.ratelimit": "//source/extensions/filters/network/ratelimit:config", - "envoy.filters.network.rbac": "//source/extensions/filters/network/rbac:config", - # "envoy.filters.network.redis_proxy": "//source/extensions/filters/network/redis_proxy:config", - "envoy.filters.network.tcp_proxy": "//source/extensions/filters/network/tcp_proxy:config", - "envoy.filters.network.thrift_proxy": "//source/extensions/filters/network/thrift_proxy:config", - "envoy.filters.network.sni_cluster": "//source/extensions/filters/network/sni_cluster:config", - "envoy.filters.network.zookeeper_proxy": "//source/extensions/filters/network/zookeeper_proxy:config", - - # - # UDP filters - # - - "envoy.filters.udp_listener.udp_proxy": "//source/extensions/filters/udp/udp_proxy:config", - - # - # Resource monitors - # - - "envoy.resource_monitors.fixed_heap": "//source/extensions/resource_monitors/fixed_heap:config", - "envoy.resource_monitors.injected_resource": "//source/extensions/resource_monitors/injected_resource:config", - - # - # Stat sinks - # - - "envoy.stat_sinks.dog_statsd": "//source/extensions/stat_sinks/dog_statsd:config", - # "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", - - # - # Thrift filters - # - - "envoy.filters.thrift.router": "//source/extensions/filters/network/thrift_proxy/router:config", - "envoy.filters.thrift.ratelimit": "//source/extensions/filters/network/thrift_proxy/filters/ratelimit:config", - - # - # Tracers - # - - # These first three require opentracing to build on windows, but it is - # a foreign_cc build based on a linux autotools build schema. - # "envoy.tracers.dynamic_ot": "//source/extensions/tracers/dynamic_ot:config", - # "envoy.tracers.lightstep": "//source/extensions/tracers/lightstep:config", - # "envoy.tracers.datadog": "//source/extensions/tracers/datadog:config", - "envoy.tracers.zipkin": "//source/extensions/tracers/zipkin:config", - # The opencensus tool needs windows porting (unistd.h isn't c++) - # "envoy.tracers.opencensus": "//source/extensions/tracers/opencensus:config", - # WiP - "envoy.tracers.xray": "//source/extensions/tracers/xray:config", - - # - # Transport sockets - # - - "envoy.transport_sockets.alts": "//source/extensions/transport_sockets/alts:config", - "envoy.transport_sockets.raw_buffer": "//source/extensions/transport_sockets/raw_buffer:config", - "envoy.transport_sockets.tap": "//source/extensions/transport_sockets/tap:config", - - # - # Retry host predicates - # - - "envoy.retry_host_predicates.previous_hosts": "//source/extensions/retry/host/previous_hosts:config", - "envoy.retry_host_predicates.omit_canary_hosts": "//source/extensions/retry/host/omit_canary_hosts:config", - "envoy.retry_host_predicates.omit_host_metadata": "//source/extensions/retry/host/omit_host_metadata:config", - - # - # Retry priorities - # - - "envoy.retry_priorities.previous_priorities": "//source/extensions/retry/priority/previous_priorities:config", - - # - # CacheFilter plugins - # - - "envoy.filters.http.cache.simple_http_cache": "//source/extensions/filters/http/cache/simple_http_cache:simple_http_cache_lib", -} diff --git a/source/extensions/filters/network/redis_proxy/command_splitter_impl.cc b/source/extensions/filters/network/redis_proxy/command_splitter_impl.cc index 0f7abdf4b793..adfbf7ff9fbe 100644 --- a/source/extensions/filters/network/redis_proxy/command_splitter_impl.cc +++ b/source/extensions/filters/network/redis_proxy/command_splitter_impl.cc @@ -189,7 +189,7 @@ SplitRequestPtr MGETRequest::create(Router& router, Common::Redis::RespValuePtr& request_ptr->pending_response_->asArray().swap(responses); Common::Redis::RespValueSharedPtr base_request = std::move(incoming_request); - for (uint64_t i = 1; i < base_request->asArray().size(); i++) { + for (uint32_t i = 1; i < base_request->asArray().size(); i++) { request_ptr->pending_requests_.emplace_back(*request_ptr, i - 1); PendingRequest& pending_request = request_ptr->pending_requests_.back(); @@ -265,8 +265,8 @@ SplitRequestPtr MSETRequest::create(Router& router, Common::Redis::RespValuePtr& request_ptr->pending_response_->type(Common::Redis::RespType::SimpleString); Common::Redis::RespValueSharedPtr base_request = std::move(incoming_request); - unsigned fragment_index = 0; - for (unsigned i = 1; i < base_request->asArray().size(); i += 2) { + uint32_t fragment_index = 0; + for (uint32_t i = 1; i < base_request->asArray().size(); i += 2) { request_ptr->pending_requests_.emplace_back(*request_ptr, fragment_index++); PendingRequest& pending_request = request_ptr->pending_requests_.back(); @@ -336,7 +336,7 @@ SplitRequestPtr SplitKeysSumResultRequest::create(Router& router, request_ptr->pending_response_->type(Common::Redis::RespType::Integer); Common::Redis::RespValueSharedPtr base_request = std::move(incoming_request); - for (unsigned i = 1; i < base_request->asArray().size(); i++) { + for (uint32_t i = 1; i < base_request->asArray().size(); i++) { request_ptr->pending_requests_.emplace_back(*request_ptr, i - 1); PendingRequest& pending_request = request_ptr->pending_requests_.back(); diff --git a/source/extensions/quic_listeners/quiche/platform/quic_iovec_impl.h b/source/extensions/quic_listeners/quiche/platform/quic_iovec_impl.h index 66ed85ce1aa7..eeffd32cb814 100644 --- a/source/extensions/quic_listeners/quiche/platform/quic_iovec_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/quic_iovec_impl.h @@ -6,6 +6,4 @@ // consumed or referenced directly by other Envoy code. It serves purely as a // porting layer for QUICHE. -// TODO(danzh) Add Windows support for iovec. -// Only works in platforms supports POSIX for now. -#include +#include "envoy/common/platform.h" diff --git a/source/extensions/stat_sinks/hystrix/BUILD b/source/extensions/stat_sinks/hystrix/BUILD index 8437dff366b0..d058088df9b2 100644 --- a/source/extensions/stat_sinks/hystrix/BUILD +++ b/source/extensions/stat_sinks/hystrix/BUILD @@ -17,11 +17,11 @@ envoy_cc_extension( hdrs = ["config.h"], security_posture = "data_plane_agnostic", deps = [ + ":hystrix_lib", "//include/envoy/registry", "//source/common/network:address_lib", "//source/common/network:resolver_lib", "//source/extensions/stat_sinks:well_known_names", - "//source/extensions/stat_sinks/hystrix:hystrix_lib", "//source/server:configuration_lib", "@envoy_api//envoy/config/metrics/v3:pkg_cc_proto", ], diff --git a/source/extensions/stat_sinks/hystrix/hystrix.h b/source/extensions/stat_sinks/hystrix/hystrix.h index e0daa8caae74..08aa4f6b0c7e 100644 --- a/source/extensions/stat_sinks/hystrix/hystrix.h +++ b/source/extensions/stat_sinks/hystrix/hystrix.h @@ -23,8 +23,8 @@ using QuantileLatencyMap = std::unordered_map; static const std::vector hystrix_quantiles = {0, 0.25, 0.5, 0.75, 0.90, 0.95, 0.99, 0.995, 1}; -struct { - const std::string AllowHeadersHystrix{"Accept, Cache-Control, X-Requested-With, Last-Event-ID"}; +static const struct { + absl::string_view AllowHeadersHystrix{"Accept, Cache-Control, X-Requested-With, Last-Event-ID"}; } AccessControlAllowHeadersValue; struct ClusterStatsCache { diff --git a/test/config_test/BUILD b/test/config_test/BUILD index 494341c4b6fd..a00de6bb96c4 100644 --- a/test/config_test/BUILD +++ b/test/config_test/BUILD @@ -6,10 +6,8 @@ load( "envoy_cc_test_library", "envoy_package", ) -load( - "//source/extensions:all_extensions.bzl", - "envoy_all_extensions", -) +load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") +load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") envoy_package() @@ -45,5 +43,9 @@ envoy_cc_test_library( "//test/mocks/ssl:ssl_mocks", "//test/test_common:threadsafe_singleton_injector_lib", "//test/test_common:simulated_time_system_lib", - ] + envoy_all_extensions(), + ] + select({ + "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), + "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), + "//conditions:default": envoy_all_extensions(), + }), ) diff --git a/test/server/BUILD b/test/server/BUILD index e3c1cdaa06e7..6dded97d08a3 100644 --- a/test/server/BUILD +++ b/test/server/BUILD @@ -10,10 +10,8 @@ load( "envoy_package", "envoy_select_hot_restart", ) -load( - "//source/extensions:all_extensions.bzl", - "envoy_all_extensions", -) +load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") +load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") envoy_package() @@ -311,7 +309,11 @@ envoy_cc_fuzz_test( "//test/mocks/stats:stats_mocks", "//test/test_common:environment_lib", "//test/test_common:test_time_lib", - ] + envoy_all_extensions(), + ] + select({ + "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), + "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), + "//conditions:default": envoy_all_extensions(), + }), ) filegroup( diff --git a/test/server/config_validation/BUILD b/test/server/config_validation/BUILD index e00f954dc3df..f785888ac01c 100644 --- a/test/server/config_validation/BUILD +++ b/test/server/config_validation/BUILD @@ -1,10 +1,8 @@ licenses(["notice"]) # Apache 2 load("//bazel:envoy_build_system.bzl", "envoy_cc_fuzz_test", "envoy_cc_test", "envoy_package") -load( - "//source/extensions:all_extensions.bzl", - "envoy_all_extensions", -) +load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") +load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") envoy_package() @@ -95,5 +93,9 @@ envoy_cc_fuzz_test( "//test/integration:integration_lib", "//test/mocks/server:server_mocks", "//test/test_common:environment_lib", - ] + envoy_all_extensions(), + ] + select({ + "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), + "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), + "//conditions:default": envoy_all_extensions(), + }), ) diff --git a/windows/.bazelrc b/windows/.bazelrc deleted file mode 100644 index e48a2e1baa85..000000000000 --- a/windows/.bazelrc +++ /dev/null @@ -1,50 +0,0 @@ -# Windows/Envoy specific Bazel build/test options. - -build --action_env=PATH -build --action_env=TMPDIR - -build --experimental_local_memory_estimate - -build --define signal_trace=disabled -build --define hot_restart=disabled -build --define tcmalloc=disabled -build --define manual_stamp=manual_stamp - -build --workspace_status_command="bash bazel/get_workspace_status" -build --host_javabase=@bazel_tools//tools/jdk:remote_jdk11 -build --javabase=@bazel_tools//tools/jdk:remote_jdk11 -build --enable_platform_specific_config - -# Experimental: We already have absl in the build, define absl=1 -# to tell googletest to use absl for backtrace (this appears to be -# broken on msvc-cl dbg builds) -build --define absl=1 - -# Should not be required after upstream fix, see issue; -# https://github.com/bazelbuild/rules_foreign_cc/issues/301 -build --copt="-DCARES_STATICLIB" -build --copt="-DNGHTTP2_STATICLIB" -build --copt="-DCURL_STATICLIB" - -# Required to work around quiche build defect -# Unguarded gcc pragmas are not recognized by MSVC -build:msvc-cl --copt="/wd4068" -# Allows 'nodiscard' function return values to be discarded -build:msvc-cl --copt="/wd4834" -# Allows inline functions to be undefined -build:msvc-cl --copt="/wd4506" -build:msvc-cl --copt="-D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING" - -# Required to work around clang build defects -# Conflicting definitions of _WIN32_WINNT -# Overriding __TIME__ etc is problematic -build:clang-cl --copt="-Wno-macro-redefined" -build:clang-cl --copt="-Wno-builtin-macro-redefined" -build:clang-cl --action_env=USE_CLANG_CL=1 - -build --experimental_enable_runfiles -build --features=compiler_param_file -build --features=fully_static_link -build --features=static_link_msvcrt -build --dynamic_mode=off - diff --git a/windows/setup/workstation_setup.ps1 b/windows/setup/workstation_setup.ps1 deleted file mode 100644 index bf253519602e..000000000000 --- a/windows/setup/workstation_setup.ps1 +++ /dev/null @@ -1,54 +0,0 @@ -$ErrorActionPreference = "Stop"; -$ProgressPreference="SilentlyContinue" - -trap { $host.SetShouldExit(1) } - -Start-BitsTransfer "https://aka.ms/vs/15/release/vs_buildtools.exe" "$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 -}