Skip to content

Commit

Permalink
Merge branch 'master' into h3options
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Zhang <[email protected]>
  • Loading branch information
danzh1989 committed Apr 2, 2021
2 parents c255c5d + 8037370 commit c860abf
Show file tree
Hide file tree
Showing 43 changed files with 797 additions and 238 deletions.
5 changes: 4 additions & 1 deletion api/bazel/external_proto_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ EXTERNAL_PROTO_IMPORT_BAZEL_DEP_MAP = {
"metrics.proto": "@prometheus_metrics_model//:client_model",
"opencensus/proto/trace/v1/trace.proto": "@opencensus_proto//opencensus/proto/trace/v1:trace_proto",
"opencensus/proto/trace/v1/trace_config.proto": "@opencensus_proto//opencensus/proto/trace/v1:trace_config_proto",
"opentelemetry/proto/common/v1/common.proto": "@opentelemetry_proto//:logs",
"opentelemetry/proto/common/v1/common.proto": "@opentelemetry_proto//:common",
}

# This maps from the Bazel proto_library target to the Go language binding target for external dependencies.
Expand All @@ -24,6 +24,7 @@ EXTERNAL_PROTO_GO_BAZEL_DEP_MAP = {
"@opencensus_proto//opencensus/proto/trace/v1:trace_proto": "@opencensus_proto//opencensus/proto/trace/v1:trace_proto_go",
"@opencensus_proto//opencensus/proto/trace/v1:trace_config_proto": "@opencensus_proto//opencensus/proto/trace/v1:trace_and_config_proto_go",
"@opentelemetry_proto//:logs": "@opentelemetry_proto//:logs_go_proto",
"@opentelemetry_proto//:common": "@opentelemetry_proto//:common_go_proto",
}

# This maps from the Bazel proto_library target to the C++ language binding target for external dependencies.
Expand All @@ -33,6 +34,7 @@ EXTERNAL_PROTO_CC_BAZEL_DEP_MAP = {
"@opencensus_proto//opencensus/proto/trace/v1:trace_proto": "@opencensus_proto//opencensus/proto/trace/v1:trace_proto_cc",
"@opencensus_proto//opencensus/proto/trace/v1:trace_config_proto": "@opencensus_proto//opencensus/proto/trace/v1:trace_config_proto_cc",
"@opentelemetry_proto//:logs": "@opentelemetry_proto//:logs_cc_proto",
"@opentelemetry_proto//:common": "@opentelemetry_proto//:common_cc_proto",
}

# This maps from the Bazel proto_library target to the Python language binding target for external dependencies.
Expand All @@ -42,4 +44,5 @@ EXTERNAL_PROTO_PY_BAZEL_DEP_MAP = {
"@opencensus_proto//opencensus/proto/trace/v1:trace_proto": "@opencensus_proto//opencensus/proto/trace/v1:trace_proto_py",
"@opencensus_proto//opencensus/proto/trace/v1:trace_config_proto": "@opencensus_proto//opencensus/proto/trace/v1:trace_config_proto_py",
"@opentelemetry_proto//:logs": "@opentelemetry_proto//:logs_py_proto",
"@opentelemetry_proto//:common": "@opentelemetry_proto//:common_py_proto",
}
23 changes: 21 additions & 2 deletions api/bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,39 @@ OPENTELEMETRY_LOGS_BUILD_CONTENT = """
load("@envoy_api//bazel:api_build_system.bzl", "api_cc_py_proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
api_cc_py_proto_library(
name = "common",
srcs = [
"opentelemetry/proto/common/v1/common.proto",
],
visibility = ["//visibility:public"],
)
go_proto_library(
name = "common_go_proto",
importpath = "go.opentelemetry.io/proto/otlp/common/v1",
proto = ":common",
visibility = ["//visibility:public"],
)
# TODO(snowp): Generating one Go package from all of these protos could cause problems in the future,
# but nothing references symbols from collector or resource so we're fine for now.
api_cc_py_proto_library(
name = "logs",
srcs = [
"opentelemetry/proto/collector/logs/v1/logs_service.proto",
"opentelemetry/proto/common/v1/common.proto",
"opentelemetry/proto/logs/v1/logs.proto",
"opentelemetry/proto/resource/v1/resource.proto",
],
deps = [
"//:common",
],
visibility = ["//visibility:public"],
)
go_proto_library(
name = "logs_go_proto",
importpath = "logs",
importpath = "go.opentelemetry.io/proto/otlp/logs/v1",
proto = ":logs",
visibility = ["//visibility:public"],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ api_proto_package(
deps = [
"//envoy/extensions/access_loggers/grpc/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
"@opentelemetry_proto//:logs",
"@opentelemetry_proto//:common",
],
)

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 39 additions & 51 deletions bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -290,35 +290,37 @@ config_setting(
bool_flag(
name = "http3",
build_setting_default = True,
visibility = ["//visibility:private"],
)

config_setting(
name = "disable_http3",
name = "disable_http3_setting",
flag_values = {
":http3": "False",
},
visibility = ["//visibility:private"],
)

selects.config_setting_group(
name = "disable_http3_all_reasons",
name = "disable_http3",
match_any = [
":disable_http3",
":disable_http3_setting",
":boringssl_fips",
],
)

config_setting(
name = "disable_hot_restart",
name = "disable_hot_restart_setting",
values = {"define": "hot_restart=disabled"},
visibility = ["//visibility:private"],
)

# Used to avoid conflicting selects https://github.com/bazelbuild/bazel/issues/8323
alias(
name = "disable_hot_restart_or_apple",
actual = select({
":apple": ":apple",
"//conditions:default": ":disable_hot_restart",
}),
selects.config_setting_group(
name = "disable_hot_restart",
match_any = [
":apple",
":disable_hot_restart_setting",
],
)

config_setting(
Expand Down Expand Up @@ -534,53 +536,39 @@ alias(
}),
)

alias(
selects.config_setting_group(
name = "apple",
actual = select(
{
":darwin": ":darwin",
":darwin_x86_64": ":darwin_x86_64",
":ios_arm64": ":ios_arm64",
":ios_arm64e": ":ios_arm64e",
":ios_armv7": ":ios_armv7",
":ios_armv7s": ":ios_armv7s",
":ios_i386": ":ios_i386",
":ios_x86_64": ":ios_x86_64",
# If we're not on an apple platform return a value that will never match in the select() statement calling this
# since it would have already been matched above.
"//conditions:default": ":darwin",
},
),
match_any = [
":darwin",
":darwin_x86_64",
":ios_arm64",
":ios_arm64e",
":ios_armv7",
":ios_armv7s",
":ios_i386",
":ios_x86_64",
],
)

alias(
selects.config_setting_group(
name = "linux",
actual = select(
{
":linux_x86_64": ":linux_x86_64",
":linux_aarch64": ":linux_aarch64",
":linux_ppc": ":linux_ppc",
":linux_s390x": "linux_s390x",
":linux_mips64": ":linux_mips64",
# If we're not on an linux platform return a value that will never match in the select() statement calling this
# since it would have already been matched above.
"//conditions:default": ":linux_x86_64",
},
),
match_any = [
":linux_aarch64",
":linux_mips64",
":linux_ppc",
":linux_s390x",
":linux_x86_64",
],
)

alias(
selects.config_setting_group(
name = "x86",
actual = select(
{
":darwin_x86_64": ":darwin_x86_64",
":ios_x86_64": "ios_x86_64",
"linux_x86_64": "linux_x86_64",
"windows_x86_64": "windows_x86_64",
# If we're not on an x86 platform return a value that will never match in the select() statement calling this since it would have already been matched above.
"//conditions:default": ":darwin_x86_64",
},
),
match_any = [
":darwin_x86_64",
":ios_x86_64",
":linux_x86_64",
":windows_x86_64",
],
)

alias(
Expand Down
32 changes: 16 additions & 16 deletions bazel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ It is recommended to use [Bazelisk](https://github.com/bazelbuild/bazelisk) inst

On Linux, run the following commands:

```
```console
sudo wget -O /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64
sudo chmod +x /usr/local/bin/bazel
```

On macOS, run the following command:
```
```console
brew install bazelisk
```

On Windows, run the following commands:
```
```cmd
mkdir %USERPROFILE%\bazel
powershell Invoke-WebRequest https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-windows-amd64.exe -OutFile %USERPROFILE%\bazel\bazel.exe
set PATH=%PATH%;%USERPROFILE%\bazel
Expand Down Expand Up @@ -52,7 +52,7 @@ for how to update or override dependencies.
1. Install external dependencies.
### Ubuntu
On Ubuntu, run the following:
```
```console
sudo apt-get install \
libtool \
cmake \
Expand All @@ -68,19 +68,19 @@ for how to update or override dependencies.

### Fedora
On Fedora (maybe also other red hat distros), run the following:
```
```console
dnf install cmake libtool libstdc++ libstdc++-static libatomic ninja-build lld patch aspell-en
```

### Linux
On Linux, we recommend using the prebuilt Clang+LLVM package from [LLVM official site](http://releases.llvm.org/download.html).
Extract the tar.xz and run the following:
```
```console
bazel/setup_clang.sh <PATH_TO_EXTRACTED_CLANG_LLVM>
```

This will setup a `clang.bazelrc` file in Envoy source root. If you want to make clang as default, run the following:
```
```console
echo "build --config=clang" >> user.bazelrc
```

Expand All @@ -96,7 +96,7 @@ for how to update or override dependencies.

### macOS
On macOS, you'll need to install several dependencies. This can be accomplished via [Homebrew](https://brew.sh/):
```
```console
brew install coreutils wget cmake libtool go bazel automake ninja clang-format autoconf aspell
```
_notes_: `coreutils` is used for `realpath`, `gmd5sum` and `gsha256sum`
Expand Down Expand Up @@ -155,22 +155,22 @@ for how to update or override dependencies.
will not work. Add a symlink for `python3.exe` pointing to the installed `python.exe` for Envoy scripts
and Bazel rules which follow POSIX python conventions. Add `pip.exe` to the PATH and install the `wheel`
package.
```
```cmd
mklink %USERPROFILE%\Python38\python3.exe %USERPROFILE%\Python38\python.exe
set PATH=%PATH%;%USERPROFILE%\Python38
set PATH=%PATH%;%USERPROFILE%\Python38\Scripts
pip install wheel
```

[Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019):
For building with MSVC (the `msvc-cl` config option), you must install at least the VC++ workload.
For building with MSVC, you must install at least the VC++ workload.
You may alternately install the entire Visual Studio 2019 and use the Build Tools installed in that
package. Earlier versions of VC++ Build Tools/Visual Studio are not recommended or supported.
If installed in a non-standard filesystem location, be sure to set the `BAZEL_VC` environment variable
to the path of the VC++ package to allow Bazel to find your installation of VC++. NOTE: ensure that
the `link.exe` that resolves on your PATH is from VC++ Build Tools and not `/usr/bin/link.exe` from MSYS2,
which is determined by their relative ordering in your PATH.
```
```cmd
set BAZEL_VC=%USERPROFILE%\VSBT2019\VC
set PATH=%PATH%;%USERPROFILE%\VSBT2019\VC\Tools\MSVC\14.26.28801\bin\Hostx64\x64
```
Expand All @@ -181,7 +181,7 @@ for how to update or override dependencies.
Tools are sufficient in most cases, but are 32 bit binaries. These flavors will not run in
the project's GCP CI remote build environment, so 64 bit builds from the CMake and ninja
projects are used instead.
```
```cmd
set PATH=%PATH%;%USERPROFILE%\VSBT2019\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin
set PATH=%PATH%;%USERPROFILE%\VSBT2019\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
```
Expand All @@ -191,7 +191,7 @@ for how to update or override dependencies.
Set the `BAZEL_SH` environment variable to the path of the installed MSYS2 `bash.exe`
executable. Additionally, setting the `MSYS2_ARG_CONV_EXCL` environment variable to a value
of `*` is often advisable to ensure argument parsing in the MSYS2 shell behaves as expected.
```
```cmd
set PATH=%PATH%;%USERPROFILE%\msys64\usr\bin
set BAZEL_SH=%USERPROFILE%\msys64\usr\bin\bash.exe
set MSYS2_ARG_CONV_EXCL=*
Expand All @@ -201,7 +201,7 @@ for how to update or override dependencies.
Set the `TMPDIR` environment variable to a path usable as a temporary directory (e.g.
`C:\Windows\TEMP`), and create a directory symlink `C:\c` to `C:\`, so that the MSYS2
path `/c/Windows/TEMP` is equivalent to the Windows path `C:\Windows\TEMP`:
```
```cmd
set TMPDIR=C:\Windows\TEMP
mklink /d C:\c C:\
```
Expand All @@ -218,12 +218,12 @@ for how to update or override dependencies.

[Git](https://git-scm.com/downloads): This version from the Git project, or the version
distributed using pacman under MSYS2 will both work, ensure one is on the PATH:.
```
```cmd
set PATH=%PATH%;%USERPROFILE%\Git\bin
```

Lastly, persist environment variable changes.
```
``` cmd
setx PATH "%PATH%"
setx BAZEL_SH "%BAZEL_SH%"
setx MSYS2_ARG_CONV_EXCL "%MSYS2_ARG_CONV_EXCL%"
Expand Down
4 changes: 2 additions & 2 deletions bazel/envoy_select.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ def envoy_select_google_grpc(xs, repository = ""):
# Selects the given values if http3 is enabled in the current build.
def envoy_select_enable_http3(xs, repository = ""):
return select({
repository + "//bazel:disable_http3_all_reasons": [],
repository + "//bazel:disable_http3": [],
"//conditions:default": xs,
})

# Selects the given values if hot restart is enabled in the current build.
def envoy_select_hot_restart(xs, repository = ""):
return select({
repository + "//bazel:disable_hot_restart_or_apple": [],
repository + "//bazel:disable_hot_restart": [],
"//conditions:default": xs,
})

Expand Down
2 changes: 1 addition & 1 deletion bazel/envoy_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def envoy_cc_fuzz_test(
)

fuzzing_decoration(
base_name = name,
name = name,
raw_binary = name,
engine = "@envoy//bazel:fuzzing_engine",
corpus = [corpus_name],
Expand Down
Loading

0 comments on commit c860abf

Please sign in to comment.