Skip to content

Commit 82b3d46

Browse files
authored
bazel: Rename [API_]VERSION to [API_]VERSION.txt (envoyproxy#20219)
The C++ stdlib now has a header called `version` https://en.cppreference.com/w/cpp/header/version On macOS, because of the case insensitive file system, if you disable sandboxing for build performance, building C++ could pick up the root VERSION file instead of the actual C++ version header. This renames VERSION and API_VERSION to have the .txt extension to avoid this conflict. Signed-off-by: Keith Smiley <[email protected]>
1 parent 0b769f6 commit 82b3d46

File tree

14 files changed

+15
-15
lines changed

14 files changed

+15
-15
lines changed

API_VERSION API_VERSION.txt

File renamed without changes.

BUILD

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
licenses(["notice"]) # Apache 2
22

33
exports_files([
4-
"VERSION",
5-
"API_VERSION",
4+
"VERSION.txt",
5+
"API_VERSION.txt",
66
".clang-format",
77
"pytest.ini",
88
".coveragerc",

VERSION VERSION.txt

File renamed without changes.

bazel/repositories.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def _envoy_repo_impl(repository_ctx):
7878
7979
"""
8080
repo_path = repository_ctx.path(repository_ctx.attr.envoy_root).dirname
81-
version = repository_ctx.read(repo_path.get_child("VERSION")).strip()
81+
version = repository_ctx.read(repo_path.get_child("VERSION.txt")).strip()
8282
repository_ctx.file("version.bzl", "VERSION = '%s'" % version)
8383
repository_ctx.file("path.bzl", "PATH = '%s'" % repo_path)
8484
repository_ctx.file("__init__.py", "PATH = '%s'\nVERSION = '%s'" % (repo_path, version))

docs/BUILD

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ exports_files([
1212
"v2_mapping.json",
1313
"empty_extensions.json",
1414
"redirects.txt",
15-
"VERSION",
1615
])
1716

1817
envoy_package()
@@ -190,7 +189,7 @@ genrule(
190189
$(location //tools/docs:sphinx_runner) \\
191190
--build_sha="$${BUILD_SHA:-}" \\
192191
--docs_tag="$${DOCS_TAG:-}" \\
193-
--version_file=$(location //:VERSION) \\
192+
--version_file=$(location //:VERSION.txt) \\
194193
--validator_path=$(location //tools/config_validation:validate_fragment) \\
195194
--descriptor_path=$(location //tools/type_whisperer:all_protos_with_ext_pb_text.pb_text) \\
196195
$(location rst) \\
@@ -201,6 +200,6 @@ genrule(
201200
":rst",
202201
"//tools/config_validation:validate_fragment",
203202
"//tools/type_whisperer:all_protos_with_ext_pb_text.pb_text",
204-
"//:VERSION",
203+
"//:VERSION.txt",
205204
],
206205
)

docs/root/version_history/current.rst

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Minor Behavior Changes
1313
*Changes that may cause incompatibilities for some users, but should not for most*
1414

1515
* access_log: log all header values in the grpc access log.
16+
* build: ``VERSION`` and ``API_VERSION`` have been renamed to ``VERSION.txt`` and ``API_VERSION.txt`` respectively to avoid conflicts with the C++ ``<version>`` header.
1617
* config: warning messages for protobuf unknown fields now contain ancestors for easier troubleshooting.
1718
* decompressor: decompressor does not duplicate `accept-encoding` header values anymore. This behavioral change can be reverted by setting runtime guard ``envoy.reloadable_features.append_to_accept_content_encoding_only_once`` to false.
1819
* dynamic_forward_proxy: if a DNS resolution fails, failing immediately with a specific resolution error, rather than finishing up all local filters and failing to select an upstream host.

source/common/common/documentation_url.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Envoy {
44

5-
// TODO(ggreenway): replace 'latest' with the current version, pulled from the VERSION file at
5+
// TODO(ggreenway): replace 'latest' with the current version, pulled from the VERSION.txt file at
66
// the root of the repo.
77
#define ENVOY_DOC_URL_ROOT "https://www.envoyproxy.io/docs/envoy/latest"
88

source/common/version/BUILD

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ envoy_package()
1212

1313
genrule(
1414
name = "generate_version_number",
15-
srcs = ["//:VERSION"],
15+
srcs = ["//:VERSION.txt"],
1616
outs = ["version_number.h"],
1717
cmd = """echo "#define BUILD_VERSION_NUMBER \\"$$(cat $<)\\"" >$@""",
1818
visibility = ["//visibility:private"],
1919
)
2020

2121
genrule(
2222
name = "generate_api_version_number",
23-
srcs = ["//:API_VERSION"],
23+
srcs = ["//:API_VERSION.txt"],
2424
outs = ["api_version_number.h"],
2525
cmd = """./$(location //tools/api_versioning:generate_api_version_header_bin) $< >$@""",
2626
tools = ["//tools/api_versioning:generate_api_version_header_bin"],

test/exe/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ envoy_sh_test(
5353
srcs = ["version_out_test.sh"],
5454
coverage = False,
5555
data = [
56-
"//:VERSION",
56+
"//:VERSION.txt",
5757
"//bazel:raw_build_id.ldscript",
5858
"//source/exe:envoy-static",
5959
],

test/exe/version_out_test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fi
2020
VERSION=$(${ENVOY_BIN} --version | \
2121
sed -n -E 's/.*version: ([0-9a-f]{40})\/([0-9]+\.[0-9]+\.[0-9]+)(-[a-zA-Z0-9\-_]+)?\/(Clean|Modified)\/(RELEASE|DEBUG)\/([a-zA-Z-]+)$/\2\3/p')
2222

23-
EXPECTED=$(cat "${TEST_SRCDIR}/envoy/VERSION")
23+
EXPECTED=$(cat "${TEST_SRCDIR}/envoy/VERSION.txt")
2424

2525
if [[ "${VERSION}" != "${EXPECTED}" ]]; then
2626
echo "Version mismatch, got: ${VERSION}, expected: ${EXPECTED}".

tools/api_versioning/generate_api_version_header.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def generate_header_file(input_path):
2424
correct value.
2525
2626
Args:
27-
input_path: the file containing the API version (API_VERSION).
27+
input_path: the file containing the API version (API_VERSION.txt).
2828
2929
Returns:
3030
the header file contents.

tools/api_versioning/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def get_api_version(input_path):
1616
"""Returns the API version from a given API version input file.
1717
1818
Args:
19-
input_path: the file containing the API version (API_VERSION).
19+
input_path: the file containing the API version (API_VERSION.txt).
2020
2121
Returns:
2222
a namedtuple containing the major, minor, patch versions.

tools/proto_format/proto_sync.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def proto_print(src, dst):
145145
'bazel-bin/tools/protoxform/protoprint', src,
146146
str(dst),
147147
'./bazel-bin/tools/protoxform/protoprint.runfiles/envoy/tools/type_whisperer/api_type_db.pb_text',
148-
'API_VERSION'
148+
'API_VERSION.txt'
149149
])
150150

151151

tools/protoxform/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ py_binary(
3030
],
3131
data = [
3232
"//:.clang-format",
33-
"//:API_VERSION",
33+
"//:API_VERSION.txt",
3434
"//tools/type_whisperer:api_type_db.pb_text",
3535
],
3636
visibility = ["//visibility:public"],

0 commit comments

Comments
 (0)