Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ config_setting(
values = {"define": "signal_trace=disabled"},
)

config_setting(
name = "disable_library_autolink",
values = {"define": "library_autolink=disabled"},
)

config_setting(
name = "disable_object_dump_on_signal_trace",
values = {"define": "object_dump_on_signal_trace=disabled"},
Expand Down
1 change: 1 addition & 0 deletions bazel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ The following optional features can be disabled on the Bazel build command-line:
tcmalloc with `--define tcmalloc=gperftools` which is the default for builds other than x86_64 and aarch64.
* deprecated features with `--define deprecated_features=disabled`
* http3/quic with --//bazel:http3=False
* autolinking libraries with --define=library_autolink=disabled
* admin HTML home page with `--define=admin_html=disabled`

## Enabling optional features
Expand Down
14 changes: 13 additions & 1 deletion bazel/envoy_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def envoy_cc_extension(
tags = [],
extra_visibility = [],
visibility = EXTENSION_CONFIG_VISIBILITY,
alwayslink = 1,
**kwargs):
if "//visibility:public" not in visibility:
visibility = visibility + extra_visibility
Expand All @@ -66,6 +67,7 @@ def envoy_cc_extension(
name = name,
tags = tags,
visibility = visibility,
alwayslink = alwayslink,
**kwargs
)
native.cc_library(
Expand All @@ -83,6 +85,7 @@ def envoy_cc_contrib_extension(
tags = [],
extra_visibility = [],
visibility = CONTRIB_EXTENSION_PACKAGE_VISIBILITY,
alwayslink = 1,
**kwargs):
envoy_cc_extension(name, tags, extra_visibility, visibility, **kwargs)

Expand All @@ -101,10 +104,19 @@ def envoy_cc_library(
strip_include_prefix = None,
include_prefix = None,
textual_hdrs = None,
alwayslink = None,
defines = []):
if tcmalloc_dep:
deps += tcmalloc_external_deps(repository)

# If alwayslink is not specified, allow turning it off via --define=library_autolink=disabled
# alwayslink is defaulted on for envoy_cc_extensions to ensure the REGISTRY macros work.
if alwayslink == None:
alwayslink = select({
repository + "//bazel:disable_library_autolink": 0,
"//conditions:default": 1,
})

native.cc_library(
name = name,
srcs = srcs,
Expand All @@ -122,7 +134,7 @@ def envoy_cc_library(
envoy_external_dep_path("abseil_strings"),
envoy_external_dep_path("fmtlib"),
],
alwayslink = 1,
alwayslink = alwayslink,
linkstatic = envoy_linkstatic(),
strip_include_prefix = strip_include_prefix,
include_prefix = include_prefix,
Expand Down
3 changes: 3 additions & 0 deletions changelogs/current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ removed_config_or_runtime:
removed ``envoy.reloadable_features.override_request_timeout_by_gateway_timeout`` and legacy code paths.

new_features:
- area: build
change: |
added an option ``--define=library_autolink=disabled`` to disable autolinking libraries.
- area: generic_proxy
change: |
added :ref:`dubbo codec support <envoy_v3_api_msg_extensions.filters.network.generic_proxy.codecs.dubbo.v3.DubboCodecConfig>` to the
Expand Down
5 changes: 4 additions & 1 deletion ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,10 @@ elif [[ "$CI_TARGET" == "bazel.gcc" ]]; then
elif [[ "$CI_TARGET" == "bazel.debug" ]]; then
setup_clang_toolchain
echo "Testing ${TEST_TARGETS[*]}"
bazel test "${BAZEL_BUILD_OPTIONS[@]}" -c dbg "${TEST_TARGETS[@]}"
# Make sure that there are no regressions to building Envoy with autolink disabled.
EXTRA_OPTIONS=(
"--define" "library_autolink=disabled")
bazel test "${BAZEL_BUILD_OPTIONS[@]}" "${EXTRA_OPTIONS[@]}" -c dbg "${TEST_TARGETS[@]}"

echo "bazel debug build with tests..."
bazel_envoy_binary_build debug
Expand Down
4 changes: 4 additions & 0 deletions ci/osx-build-config/extensions_build_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ WINDOWS_EXTENSIONS = {}
EXTENSION_CONFIG_VISIBILITY = ["//:extension_config"]
EXTENSION_PACKAGE_VISIBILITY = ["//:extension_library"]
CONTRIB_EXTENSION_PACKAGE_VISIBILITY = ["//:contrib_library"]

# As part of (https://github.com/envoyproxy/envoy-mobile/issues/175) we turned down alwayslink for envoy libraries
# This tracks libraries that should be registered as extensions.
LEGACY_ALWAYSLINK = 1
1 change: 1 addition & 0 deletions contrib/generic_proxy/filters/network/source/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,5 @@ envoy_cc_library(
"//source/common/matcher:matcher_lib",
"@envoy_api//contrib/envoy/extensions/filters/network/generic_proxy/matcher/v3:pkg_cc_proto",
],
alwayslink = 1,
)
5 changes: 5 additions & 0 deletions source/common/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ load(
"envoy_package",
"envoy_pch_library",
)
load(
"@envoy_build_config//:extensions_build_config.bzl",
"LEGACY_ALWAYSLINK",
)

licenses(["notice"]) # Apache 2

Expand Down Expand Up @@ -341,6 +345,7 @@ envoy_cc_library(
"@envoy_api//envoy/extensions/regex_engines/v3:pkg_cc_proto",
"@envoy_api//envoy/type/matcher/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)

envoy_cc_library(
Expand Down
2 changes: 2 additions & 0 deletions source/common/crypto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ envoy_cc_library(
"//source/common/common:assert_lib",
"//source/common/singleton:threadsafe_singleton",
],
# for the singleton
alwayslink = 1,
)
5 changes: 5 additions & 0 deletions source/common/grpc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ load(
"envoy_package",
"envoy_select_google_grpc",
)
load(
"@envoy_build_config//:extensions_build_config.bzl",
"LEGACY_ALWAYSLINK",
)

licenses(["notice"]) # Apache 2

Expand Down Expand Up @@ -205,6 +209,7 @@ envoy_cc_library(
"//source/common/config:datasource_lib",
"@envoy_api//envoy/config/core/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)

envoy_cc_library(
Expand Down
5 changes: 5 additions & 0 deletions source/common/http/match_delegate/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ load(
"envoy_cc_library",
"envoy_package",
)
load(
"@envoy_build_config//:extensions_build_config.bzl",
"LEGACY_ALWAYSLINK",
)

licenses(["notice"]) # Apache 2

Expand All @@ -21,4 +25,5 @@ envoy_cc_library(
"@envoy_api//envoy/extensions/common/matching/v3:pkg_cc_proto",
"@envoy_api//envoy/extensions/filters/common/matcher/action/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)
5 changes: 5 additions & 0 deletions source/common/http/matching/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ load(
"envoy_cc_library",
"envoy_package",
)
load(
"@envoy_build_config//:extensions_build_config.bzl",
"LEGACY_ALWAYSLINK",
)

licenses(["notice"]) # Apache 2

Expand All @@ -27,4 +31,5 @@ envoy_cc_library(
"//source/common/http:header_utility_lib",
"@envoy_api//envoy/type/matcher/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)
7 changes: 7 additions & 0 deletions source/common/network/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ load(
"envoy_cc_library",
"envoy_package",
)
load(
"@envoy_build_config//:extensions_build_config.bzl",
"LEGACY_ALWAYSLINK",
)

licenses(["notice"]) # Apache 2

Expand Down Expand Up @@ -157,6 +161,7 @@ envoy_cc_library(
"//envoy/network:transport_socket_interface",
"//envoy/registry",
],
alwayslink = LEGACY_ALWAYSLINK,
)

envoy_cc_library(
Expand Down Expand Up @@ -228,6 +233,7 @@ envoy_cc_library(
"//envoy/registry",
"//envoy/server:bootstrap_extension_config_interface",
],
alwayslink = LEGACY_ALWAYSLINK,
)

envoy_cc_library(
Expand All @@ -254,6 +260,7 @@ envoy_cc_library(
"//source/common/event:dispatcher_includes",
"@envoy_api//envoy/extensions/network/socket_interface/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)

envoy_cc_library(
Expand Down
5 changes: 5 additions & 0 deletions source/common/network/matching/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ load(
"envoy_cc_library",
"envoy_package",
)
load(
"@envoy_build_config//:extensions_build_config.bzl",
"LEGACY_ALWAYSLINK",
)

licenses(["notice"]) # Apache 2

Expand All @@ -28,4 +32,5 @@ envoy_cc_library(
"//source/common/network:utility_lib",
"@envoy_api//envoy/extensions/matching/common_inputs/network/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)
5 changes: 5 additions & 0 deletions source/common/quic/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ load(
"envoy_cc_library",
"envoy_package",
)
load(
"@envoy_build_config//:extensions_build_config.bzl",
"LEGACY_ALWAYSLINK",
)

licenses(["notice"]) # Apache 2

Expand Down Expand Up @@ -431,6 +435,7 @@ envoy_cc_library(
"@com_github_google_quiche//:quic_core_crypto_crypto_handshake_lib",
"@envoy_api//envoy/extensions/transport_sockets/quic/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)

# Create a single target that contains all the libraries that register factories.
Expand Down
6 changes: 6 additions & 0 deletions source/common/router/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ load(
"envoy_cc_library",
"envoy_package",
)
load(
"@envoy_build_config//:extensions_build_config.bzl",
"LEGACY_ALWAYSLINK",
)

licenses(["notice"]) # Apache 2

Expand Down Expand Up @@ -78,6 +82,7 @@ envoy_cc_library(
"@envoy_api//envoy/type/matcher/v3:pkg_cc_proto",
"@envoy_api//envoy/type/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)

envoy_cc_library(
Expand Down Expand Up @@ -362,6 +367,7 @@ envoy_cc_library(
"//source/extensions/filters/http/common:factory_base_lib",
"@envoy_api//envoy/extensions/filters/http/upstream_codec/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)

envoy_cc_library(
Expand Down
5 changes: 5 additions & 0 deletions source/common/ssl/matching/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ load(
"envoy_cc_library",
"envoy_package",
)
load(
"@envoy_build_config//:extensions_build_config.bzl",
"LEGACY_ALWAYSLINK",
)

licenses(["notice"]) # Apache 2

Expand All @@ -18,4 +22,5 @@ envoy_cc_library(
"//envoy/network:filter_interface",
"@envoy_api//envoy/extensions/matching/common_inputs/ssl/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)
9 changes: 9 additions & 0 deletions source/common/upstream/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ load(
"envoy_package",
"envoy_select_enable_http3",
)
load(
"@envoy_build_config//:extensions_build_config.bzl",
"LEGACY_ALWAYSLINK",
)

licenses(["notice"]) # Apache 2

Expand Down Expand Up @@ -357,6 +361,7 @@ envoy_cc_library(
"@envoy_api//envoy/config/core/v3:pkg_cc_proto",
"@envoy_api//envoy/config/endpoint/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)

envoy_cc_library(
Expand All @@ -377,6 +382,7 @@ envoy_cc_library(
"@envoy_api//envoy/config/core/v3:pkg_cc_proto",
"@envoy_api//envoy/config/endpoint/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)

envoy_cc_library(
Expand Down Expand Up @@ -480,6 +486,7 @@ envoy_cc_library(
"@envoy_api//envoy/config/endpoint/v3:pkg_cc_proto",
"@envoy_api//envoy/service/discovery/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)

envoy_cc_library(
Expand Down Expand Up @@ -594,6 +601,7 @@ envoy_cc_library(
"@envoy_api//envoy/config/cluster/v3:pkg_cc_proto",
"@envoy_api//envoy/config/endpoint/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)

envoy_cc_library(
Expand All @@ -606,6 +614,7 @@ envoy_cc_library(
"@envoy_api//envoy/config/cluster/v3:pkg_cc_proto",
"@envoy_api//envoy/config/endpoint/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)

envoy_cc_library(
Expand Down
5 changes: 5 additions & 0 deletions source/common/watchdog/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ load(
"envoy_cc_library",
"envoy_package",
)
load(
"@envoy_build_config//:extensions_build_config.bzl",
"LEGACY_ALWAYSLINK",
)

licenses(["notice"]) # Apache 2

Expand Down Expand Up @@ -35,4 +39,5 @@ envoy_cc_library(
"//source/common/protobuf:message_validator_lib",
"@envoy_api//envoy/watchdog/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
)
1 change: 1 addition & 0 deletions source/extensions/access_loggers/wasm/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ envoy_cc_library(
"//source/common/http:header_map_lib",
"//source/extensions/common/wasm:wasm_lib",
],
alwayslink = 1,
)

envoy_cc_extension(
Expand Down
5 changes: 3 additions & 2 deletions source/extensions/bootstrap/internal_listener/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ envoy_cc_extension(
],
)

envoy_cc_library(
envoy_cc_extension(
name = "internal_listener_registry",
srcs = [
"internal_listener_registry.cc",
Expand All @@ -33,9 +33,10 @@ envoy_cc_library(
"//source/server:listener_manager_lib",
"@envoy_api//envoy/extensions/bootstrap/internal_listener/v3:pkg_cc_proto",
],
alwayslink = 1,
)

envoy_cc_library(
envoy_cc_extension(
name = "client_connection_factory",
srcs = [
"client_connection_factory.cc",
Expand Down
Loading