From 9b26b1ea6ad149d2e625508c3159004c2d284573 Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Wed, 18 Jul 2018 10:55:29 -0400 Subject: [PATCH 1/4] Initial bazel build file changes for Windows This just contains the "non-controversial changes" to get Envoy building on Windows. Future PRs will address: 1. getting external deps to build on Windows 2. getting PGV working on Windows Signed-off-by: Sam Smith Signed-off-by: Amin Jamali Signed-off-by: Matthew Horan Signed-off-by: Akshat Gokhale --- .gitignore | 1 + bazel/BUILD | 29 ++++++ bazel/envoy_build_system.bzl | 59 ++++++++++-- bazel/external/libcircllhist.BUILD | 4 + bazel/repositories.bat | 4 + bazel/repositories.bzl | 27 +++++- bazel/repository_locations.bzl | 2 +- ci/build_setup.ps1 | 22 +++++ ci/do_ci.ps1 | 20 ++++ ci/prebuilt/BUILD | 40 ++++++-- source/common/event/BUILD | 10 +- source/common/filesystem/BUILD | 2 +- source/exe/BUILD | 6 +- source/extensions/all_extensions.bzl | 16 +++- source/extensions/extensions_build_config.bzl | 93 +++++++++++++++++++ windows/setup/workstation_setup.ps1 | 54 +++++++++++ windows/tools/bazel.rc | 6 ++ 17 files changed, 363 insertions(+), 32 deletions(-) create mode 100644 bazel/repositories.bat create mode 100755 ci/build_setup.ps1 create mode 100755 ci/do_ci.ps1 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/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 374ecb4612d3..a545a293ddd1 100644 --- a/bazel/envoy_build_system.bzl +++ b/bazel/envoy_build_system.bzl @@ -5,19 +5,39 @@ 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", + "-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"], @@ -47,6 +67,9 @@ def envoy_linkopts(): "-pagezero_size 10000", "-image_base 100000000", ], + "//bazel:windows_x86_64": [ + "-DEFAULTLIB:advapi32.lib", + ], "//conditions:default": [ "-pthread", "-lrt", @@ -62,6 +85,7 @@ def _envoy_stamped_linkopts(): # # /usr/bin/ld.gold: internal error in write_build_id, at ../../gold/layout.cc:5419 "@envoy//bazel:coverage_build": [], + "//bazel:windows_x86_64": [], # MacOS doesn't have an official equivalent to the `.note.gnu.build-id` # ELF section, so just stuff the raw ID into a new text section. @@ -120,6 +144,13 @@ 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")], + }) + # 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"). @@ -144,6 +175,7 @@ def envoy_cc_library( visibility = None, external_deps = [], tcmalloc_dep = None, + libevent_dep = None, repository = "", linkstamp = None, tags = [], @@ -151,6 +183,9 @@ def envoy_cc_library( strip_include_prefix = None): if tcmalloc_dep: deps += tcmalloc_external_deps(repository) + if libevent_dep: + deps += libevent_external_deps(repository) + native.cc_library( name = name, srcs = srcs, @@ -168,7 +203,10 @@ def envoy_cc_library( 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, ) @@ -481,5 +519,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..7b6695710593 --- /dev/null +++ b/bazel/repositories.bat @@ -0,0 +1,4 @@ +echo "Start" +@ECHO OFF +%BAZEL_SH% -c "./repositories.sh %*" +exit %ERRORLEVEL% diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index c85aaf358c8f..3d231c259ff0 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -7,6 +7,12 @@ 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 @@ -67,6 +73,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", @@ -81,11 +88,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) diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index c9e1446d8e73..fbbb8794595e 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_setup.ps1 b/ci/build_setup.ps1 new file mode 100755 index 000000000000..dcd191c59b55 --- /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="--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/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..3e2e5bebe2ac 100644 --- a/ci/prebuilt/BUILD +++ b/ci/prebuilt/BUILD @@ -2,23 +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 = ["thirdparty_build/lib/libcares.a"], + 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 = ["thirdparty_build/lib/libbenchmark.a"], + 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 = ["thirdparty_build/lib/libevent.a"], + 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"], ) @@ -31,7 +45,10 @@ cc_library( cc_library( name = "luajit", - srcs = ["thirdparty_build/lib/libluajit-5.1.a"], + 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 @@ -40,7 +57,10 @@ cc_library( cc_library( name = "nghttp2", - srcs = ["thirdparty_build/lib/libnghttp2.a"], + 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"], ) @@ -54,14 +74,20 @@ cc_library( cc_library( name = "yaml_cpp", - srcs = ["thirdparty_build/lib/libyaml-cpp.a"], + 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 = ["thirdparty_build/lib/libz.a"], + 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", 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..1c2b286e07b5 100644 --- a/source/common/filesystem/BUILD +++ b/source/common/filesystem/BUILD @@ -40,7 +40,7 @@ envoy_cc_library( "inotify/watcher_impl.h", ], }), - external_deps = ["event"], + libevent_dep = 1, strip_include_prefix = select({ "@bazel_tools//tools/osx:darwin": "kqueue", "//conditions:default": "inotify", 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/all_extensions.bzl b/source/extensions/all_extensions.bzl index f5613b67d55b..1dc1a34aad6b 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 04b1d40a6adb..133ea5cde53b 100644 --- a/source/extensions/extensions_build_config.bzl +++ b/source/extensions/extensions_build_config.bzl @@ -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/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..1aeeb3507d26 --- /dev/null +++ b/windows/tools/bazel.rc @@ -0,0 +1,6 @@ +# Windows/Envoy specific Bazel build/test options. + +build --experimental_shortened_obj_file_path +build --define signal_trace=disabled +build --define hot_restart=disabled +build --define tcmalloc=disabled From 1e5ccfc13444f6a23d2122a55bb3947a16f83ad8 Mon Sep 17 00:00:00 2001 From: Akshat Gokhale Date: Thu, 19 Jul 2018 09:37:08 -0400 Subject: [PATCH 2/4] Cleanup bazel build options - --batch is deprecated - the --action_env and --test_env settings aren't necesssary on Windows Signed-off-by: Sam Smith Signed-off-by: Akshat Gokhale --- ci/build_setup.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/build_setup.ps1 b/ci/build_setup.ps1 index dcd191c59b55..12a3aeff987f 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="--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" +$env:BAZEL_BASE_OPTIONS="--nomaster_bazelrc --output_base=$env:ENVOY_BAZEL_ROOT --bazelrc=$env:ENVOY_SRCDIR\windows\tools\bazel.rc" +$env:BAZEL_BUILD_OPTIONS="--strategy=Genrule=standalone --spawn_strategy=standalone --verbose_failures --jobs=$env:NUM_CPUS --show_task_finish $env:BAZEL_BUILD_EXTRA_OPTIONS" +$env:BAZEL_TEST_OPTIONS="$env:BAZEL_BUILD_OPTIONS --cache_test_results=no --test_output=all $env:BAZEL_EXTRA_TEST_OPTIONS" From 93dd72967226987a26fb12b0fdd0dc113050b87e Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Thu, 19 Jul 2018 09:53:04 -0400 Subject: [PATCH 3/4] Use Start-BitsTransfer instead of Invoke-WebRequest Signed-off-by: Akshat Gokhale Signed-off-by: Sam Smith --- windows/setup/workstation_setup.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/setup/workstation_setup.ps1 b/windows/setup/workstation_setup.ps1 index e965c95f3d05..bf253519602e 100644 --- a/windows/setup/workstation_setup.ps1 +++ b/windows/setup/workstation_setup.ps1 @@ -3,7 +3,7 @@ $ProgressPreference="SilentlyContinue" trap { $host.SetShouldExit(1) } -Invoke-WebRequest -UseBasicParsing "https://aka.ms/vs/15/release/vs_buildtools.exe" -OutFile "$env:TEMP\vs_buildtools.exe" +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) From 8d04a12d6c36cb304fec927c3492e4b49f7e4a59 Mon Sep 17 00:00:00 2001 From: Akshat Gokhale Date: Thu, 19 Jul 2018 09:57:20 -0400 Subject: [PATCH 4/4] Add note that `experimental_shortened_obj_file_path` will be removed in future versions of Bazel Signed-off-by: Sam Smith Signed-off-by: Akshat Gokhale --- windows/tools/bazel.rc | 1 + 1 file changed, 1 insertion(+) diff --git a/windows/tools/bazel.rc b/windows/tools/bazel.rc index 1aeeb3507d26..234d5bc4a85a 100644 --- a/windows/tools/bazel.rc +++ b/windows/tools/bazel.rc @@ -1,5 +1,6 @@ # Windows/Envoy specific Bazel build/test options. +// TODO: remove experimental_shortened_obj_file_path for Bazel 0.16.0 build --experimental_shortened_obj_file_path build --define signal_trace=disabled build --define hot_restart=disabled