Skip to content

Commit

Permalink
build: Update ICU and googleurl (#12376)
Browse files Browse the repository at this point in the history
This patch updates ICU to 67.1 and googleurl to https://quiche.googlesource.com/googleurl/+/ef0d23689e240e6c8de4c3a5296b209128c87373. This reduces `bazel/external/googleurl.patch` to only handling MSVC quirks.

Please note that googleurl direction for Windows is to use clang-cl, while we still use msvc-cl (hence the patch). 

Risk Level: Low
Testing: Existing
Docs Changes: N/A
Release Notes: N/A
Fixes #12015 

Signed-off-by: Dhi Aurrahman <[email protected]>
  • Loading branch information
dio authored Aug 7, 2020
1 parent 7c92028 commit c9c4709
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 108 deletions.
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ build --action_env=CXX
build --action_env=LLVM_CONFIG
build --action_env=PATH

# Skip system ICU linking.
build --@com_googlesource_googleurl//build_config:system_icu=0

# Common flags for sanitizers
build:sanitizer --define tcmalloc=disabled
build:sanitizer --linkopt -ldl
Expand Down
101 changes: 17 additions & 84 deletions bazel/external/googleurl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# clang-cl. Tracked in https://github.com/envoyproxy/envoy/issues/11974.

diff --git a/base/compiler_specific.h b/base/compiler_specific.h
index 2962537..6193b56 100644
index 0cd36dc..8c4cbd4 100644
--- a/base/compiler_specific.h
+++ b/base/compiler_specific.h
@@ -7,10 +7,6 @@
Expand All @@ -16,7 +16,21 @@ index 2962537..6193b56 100644
// Annotate a variable indicating it's ok if the variable is not used.
// (Typically used to silence a compiler warning when the assignment
// is important for some other reason.)
@@ -212,7 +208,9 @@
@@ -55,8 +51,12 @@
// prevent code folding, see gurl_base::debug::Alias.
// Use like:
// void NOT_TAIL_CALLED FooBar();
-#if defined(__clang__) && __has_attribute(not_tail_called)
+#if defined(__clang__)
+#if defined(__has_attribute)
+#if __has_attribute(not_tail_called)
#define NOT_TAIL_CALLED __attribute__((not_tail_called))
+#endif
+#endif
#else
#define NOT_TAIL_CALLED
#endif
@@ -226,7 +226,9 @@
#endif
#endif

Expand All @@ -27,7 +41,7 @@ index 2962537..6193b56 100644
// Attribute "uninitialized" disables -ftrivial-auto-var-init=pattern for
// the specified variable.
// Library-wide alternative is
@@ -243,6 +241,8 @@
@@ -257,6 +259,8 @@
// E.g. platform, bot, benchmark or test name in patch description or next to
// the attribute.
#define STACK_UNINITIALIZED __attribute__((uninitialized))
Expand All @@ -36,84 +50,3 @@ index 2962537..6193b56 100644
#else
#define STACK_UNINITIALIZED
#endif
diff --git a/base/strings/BUILD b/base/strings/BUILD
index 7a06170..7c86a5f 100644
--- a/base/strings/BUILD
+++ b/base/strings/BUILD
@@ -6,23 +6,21 @@ load("//:build_config.bzl", "build_config")
cc_library(
name = "strings",
srcs = [
- "string16.cc",
"string_piece.cc",
"string_util.cc",
"string_util_constants.cc",
"utf_string_conversion_utils.cc",
"utf_string_conversions.cc",
- ],
+ ] + build_config.strings_srcs,
hdrs = [
"char_traits.h",
"string16.h",
"string_piece.h",
"string_piece_forward.h",
"string_util.h",
- "string_util_posix.h",
"utf_string_conversion_utils.h",
"utf_string_conversions.h",
- ],
+ ] + build_config.strings_hdrs,
copts = build_config.default_copts,
visibility = ["//visibility:public"],
deps = [
diff --git a/build_config.bzl b/build_config.bzl
index d5fca65..fc0d7e5 100644
--- a/build_config/build_config.bzl
+++ b/build_config/build_config.bzl
@@ -1,8 +1,25 @@
-_default_copts = [
- "-std=c++14",
- "-fno-strict-aliasing",
-]
+_default_copts = select({
+ "@envoy//bazel:windows_x86_64": [
+ "/std:c++17",
+ ],
+ "//conditions:default": [
+ "-std=c++17",
+ "-fno-strict-aliasing",
+ ],
+})
+
+_strings_srcs = select({
+ "@envoy//bazel:windows_x86_64": [],
+ "//conditions:default": ["string16.cc"],
+})
+
+_strings_hdrs = select({
+ "@envoy//bazel:windows_x86_64": ["string_util_win.h"],
+ "//conditions:default": ["string_util_posix.h"],
+})

build_config = struct(
default_copts = _default_copts,
+ strings_srcs = _strings_srcs,
+ strings_hdrs = _strings_hdrs,
)
diff --git a/url/BUILD b/url/BUILD
index 0126bdc..5d1a171 100644
--- a/url/BUILD
+++ b/url/BUILD
@@ -43,11 +43,11 @@ cc_library(
"url_util.h",
],
copts = build_config.default_copts,
- linkopts = ["-licuuc"],
visibility = ["//visibility:public"],
deps = [
"//base",
"//base/strings",
"//polyfills",
+ "@org_unicode_icuuc//:common",
],
)
22 changes: 9 additions & 13 deletions bazel/external/icuuc.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ load("@rules_cc//cc:defs.bzl", "cc_library")

licenses(["notice"]) # Apache 2

exports_files([
"icu4c/LICENSE",
"icu4j/main/shared/licenses/LICENSE",
])
exports_files(["LICENSE"])

icuuc_copts = [
"-DU_STATIC_IMPLEMENTATION",
Expand All @@ -31,29 +28,28 @@ icuuc_copts = [

cc_library(
name = "headers",
hdrs = glob(["icu4c/source/common/unicode/*.h"]),
includes = ["icu4c/source/common"],
hdrs = glob(["source/common/unicode/*.h"]),
includes = ["source/common"],
visibility = ["//visibility:public"],
)

cc_library(
name = "common",
hdrs = glob(["icu4c/source/common/unicode/*.h"]),
includes = ["icu4c/source/common"],
hdrs = glob(["source/common/unicode/*.h"]),
includes = ["source/common"],
visibility = ["//visibility:public"],
deps = [":icuuc"],
)

cc_library(
name = "icuuc",
srcs = glob([
"icu4c/source/common/*.c",
"icu4c/source/common/*.cpp",
"icu4c/source/stubdata/*.cpp",
"source/common/*.c",
"source/common/*.cpp",
"source/stubdata/*.cpp",
]),
hdrs = glob(["icu4c/source/common/*.h"]),
hdrs = glob(["source/common/*.h"]),
copts = icuuc_copts,
tags = ["requires-rtti"],
visibility = ["//visibility:private"],
deps = [":headers"],
)
5 changes: 0 additions & 5 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -903,11 +903,6 @@ def _org_unicode_icuuc():
_repository_impl(
name = "org_unicode_icuuc",
build_file = "@envoy//bazel/external:icuuc.BUILD",
# TODO(dio): Consider patching udata when we need to embed some data.
)
native.bind(
name = "icuuc",
actual = "@org_unicode_icuuc//:common",
)

def _foreign_cc_dependencies():
Expand Down
13 changes: 7 additions & 6 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,10 @@ DEPENDENCY_REPOSITORIES = dict(
cpe = "N/A",
),
com_googlesource_googleurl = dict(
# Static snapshot of https://quiche.googlesource.com/quiche/+archive/googleurl_6dafefa72cba2ab2ba4922d17a30618e9617c7cf.tar.gz
sha256 = "f1ab73ddd1a7db4e08a9e4db6c2e98e5a0a7bbaca08f5fee0d73adb02c24e44a",
urls = ["https://storage.googleapis.com/quiche-envoy-integration/googleurl_6dafefa72cba2ab2ba4922d17a30618e9617c7cf.tar.gz"],
# Static snapshot of https://quiche.googlesource.com/quiche/+archive/ef0d23689e240e6c8de4c3a5296b209128c87373.tar.gz.
sha256 = "d769283fed1319bca68bae8bdd47fbc3a7933999329eee850eff1f1ea61ce176",
# 2020-08-05
urls = ["https://storage.googleapis.com/quiche-envoy-integration/googleurl_ef0d23689e240e6c8de4c3a5296b209128c87373.tar.gz"],
use_category = ["dataplane"],
cpe = "N/A",
),
Expand Down Expand Up @@ -484,9 +485,9 @@ DEPENDENCY_REPOSITORIES = dict(
use_category = ["test"],
),
org_unicode_icuuc = dict(
strip_prefix = "icu-release-64-2",
sha256 = "524960ac99d086cdb6988d2a92fc163436fd3c6ec0a84c475c6382fbf989be05",
urls = ["https://github.com/unicode-org/icu/archive/release-64-2.tar.gz"],
strip_prefix = "icu",
sha256 = "94a80cd6f251a53bd2a997f6f1b5ac6653fe791dfab66e1eb0227740fb86d5dc",
urls = ["https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-src.tgz"],
use_category = ["dataplane"],
cpe = "cpe:2.3:a:icu-project:international_components_for_unicode",
),
Expand Down

0 comments on commit c9c4709

Please sign in to comment.