Lightweight coding agent that runs in your terminal
Rust
Move V8's ICU Bazel rules into the workspace (#54710)
Sean Huang3076caafdf67
diff --git a/patches/v8_bazel_rules.patch b/patches/v8_bazel_rules.patchindex f8381203bf..c2d557ad3d 100644--- a/patches/v8_bazel_rules.patch+++ b/patches/v8_bazel_rules.patch@@ -1,6 +1,6 @@# What: adapt upstream V8 Bazel rules to this workspace's hermetic toolchains# and externally provided dependencies.-# Scope: Bazel BUILD/defs/BUILD.icu integration only, including dependency+# Scope: Bazel BUILD/defs integration only, including dependency# wiring, generated sources, and visibility; no standalone V8 source patching.diff --git a/orig/v8-15.2.124.1/bazel/defs.bzl b/mod/v8-15.2.124.1/bazel/defs.bzl@@ -409,104 +409,3 @@ diff --git a/orig/v8-15.2.124.1/BUILD.bazel b/mod/v8-15.2.124.1/BUILD.bazel}),noicu_deps = [":v8_libshared_noicu"],noicu_srcs = [-diff --git a/orig/v8-15.2.124.1/bazel/BUILD.icu b/mod/v8-15.2.124.1/bazel/BUILD.icu---- a/orig/v8-15.2.124.1/bazel/BUILD.icu-+++ b/mod/v8-15.2.124.1/bazel/BUILD.icu-@@ -1,3 +1,24 @@-+load("@rules_cc//cc:defs.bzl", "cc_library")-+-+CUSTOM_LIBCXX_COPTS = select({-+ "@v8//:is_v8_use_rusty_v8_custom_libcxx": [-+ "-nostdinc++",-+ "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",-+ "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",-+ "-D_LIBCPP_INSTRUMENTED_WITH_ASAN=0",-+ "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",-+ ],-+ "//conditions:default": [],-+})-+-+CUSTOM_LIBCXX_DEPS = select({-+ "@v8//:is_v8_use_rusty_v8_custom_libcxx": [-+ "@@//third_party/v8:rusty_v8_custom_libcxx_headers",-+ "@@//third_party/v8:rusty_v8_custom_libcxx_runtime",-+ ],-+ "//conditions:default": [],-+})-+- # Copyright 2021 the V8 project authors. All rights reserved.- # Use of this source code is governed by a BSD-style license that can be- # found in the LICENSE file.-@@ -16,15 +37,12 @@- ]),- copts = select({- "@platforms//os:windows": [-- "/wd4005", # Macro redefinition.-- "/wd4068", # Unknown pragmas.-- "/wd4267", # Conversion from size_t on 64-bits.-- "/utf-8", # ICU source files are in UTF-8.-+ "-Wno-deprecated-declarations",- ],- "//conditions:default": [- "-Wno-deprecated-declarations",- ],-- }),-+ }) + CUSTOM_LIBCXX_COPTS,- data = [":icudata"],- defines = [- "HAVE_DLOPEN=0",-@@ -54,6 +72,7 @@- "U_ICUDATAENTRY_IN_COMMON",- ],- tags = ["requires-rtti"],-+ deps = CUSTOM_LIBCXX_DEPS,- alwayslink = 1,- )--@@ -65,19 +84,16 @@- ]),- copts = select({- "@platforms//os:windows": [-- "/wd4005", # Macro redefinition.-- "/wd4068", # Unknown pragmas.-- "/wd4267", # Conversion from size_t on 64-bits.-- "/utf-8", # ICU source files are in UTF-8.-+ "-Wno-deprecated-declarations",- ],- "//conditions:default": [- "-Wno-deprecated-declarations",- ],-- }),-+ }) + CUSTOM_LIBCXX_COPTS,- local_defines = [- "U_I18N_IMPLEMENTATION",- ],-- deps = [":icuuc"],-+ deps = [":icuuc"] + CUSTOM_LIBCXX_DEPS,- alwayslink = 1,- )--@@ -93,13 +109,10 @@- ]),- copts = select({- "@platforms//os:windows": [-- "/wd4005", # Macro redefinition.-- "/wd4068", # Unknown pragmas.-- "/wd4267", # Conversion from size_t on 64-bits.-- "/utf-8", # ICU source files are in UTF-8.-+ "-Wno-deprecated-declarations",- ],- "//conditions:default": [],-- }),-+ }) + CUSTOM_LIBCXX_COPTS,- include_prefix = "third_party/icu",- local_defines = [- "U_COMMON_IMPLEMENTATION",-@@ -108,6 +121,6 @@- deps = [- ":icui18n",- ":icuuc",-- ],-+ ] + CUSTOM_LIBCXX_DEPS,- alwayslink = 1,- )diff --git a/patches/v8_module_deps.patch b/patches/v8_module_deps.patchindex 1fbd3f5a2a..3bd5008abd 100644--- a/patches/v8_module_deps.patch+++ b/patches/v8_module_deps.patch@@ -27,7 +27,7 @@ diff --git a/orig/v8-15.2.124.1/MODULE.bazel b/mod/v8-15.2.124.1/MODULE.bazel++git_repository(+ name = "icu",-+ build_file = "@v8//:bazel/BUILD.icu",++ build_file = "@@//third_party/v8:icu.BUILD.bazel",+ commit = "d578f2e8b7bd5938e21cfb6bf15c079e0aa5b738",+ patch_cmds = ["find source -name BUILD.bazel | xargs rm"],+ patch_cmds_win = ["Get-ChildItem -Path source -File -Include BUILD.bazel -Recurse | Remove-Item"],diff --git a/third_party/v8/BUILD.bazel b/third_party/v8/BUILD.bazelindex f43b56f680..4c93e5b494 100644--- a/third_party/v8/BUILD.bazel+++ b/third_party/v8/BUILD.bazel@@ -4,6 +4,8 @@ load("@rules_cc//cc:defs.bzl", "cc_library")package(default_visibility = ["//visibility:public"])+exports_files(["icu.BUILD.bazel"])+config_setting(name = "platform_aarch64_unknown_linux_musl",constraint_values = [diff --git a/third_party/v8/icu.BUILD.bazel b/third_party/v8/icu.BUILD.bazelnew file mode 100644index 0000000000..329e64adb7--- /dev/null+++ b/third_party/v8/icu.BUILD.bazel@@ -0,0 +1,113 @@+# Copyright 2021 the V8 project authors. All rights reserved.+# Use of this source code is governed by a BSD-style license that can be+# found in the LICENSE file.++load("@rules_cc//cc:defs.bzl", "cc_library")++# ICU must use the same C++ runtime as the V8 artifact and its host generators.+_ICU_V8_COPTS = select({+ "@@//third_party/v8:use_rusty_v8_custom_libcxx": [+ "-nostdinc++",+ "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",+ "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",+ "-D_LIBCPP_INSTRUMENTED_WITH_ASAN=0",+ "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",+ ],+ "//conditions:default": [],+})++_ICU_V8_RUNTIME_DEPS = select({+ "@@//third_party/v8:use_rusty_v8_custom_libcxx": [+ "@@//third_party/v8:rusty_v8_custom_libcxx_headers",+ "@@//third_party/v8:rusty_v8_custom_libcxx_runtime",+ ],+ "//conditions:default": [],+})++filegroup(+ name = "icudata",+ srcs = ["common/icudtl.dat"],+ visibility = ["//visibility:public"],+)++cc_library(+ name = "icuuc",+ srcs = glob([+ "source/common/**/*.h",+ "source/common/**/*.cpp",+ ]),+ copts = ["-Wno-deprecated-declarations"] + _ICU_V8_COPTS,+ data = [":icudata"],+ defines = [+ "HAVE_DLOPEN=0",+ "UCONFIG_ONLY_HTML_CONVERSION=1",+ "U_CHARSET_IS_UTF8=1",+ "U_USING_ICU_NAMESPACE=0",+ "U_ENABLE_DYLOAD=0",+ "USE_CHROMIUM_ICU=1",+ "U_ENABLE_TRACING=1",+ "U_ENABLE_RESOURCE_TRACING=0",+ "UNISTR_FROM_STRING_EXPLICIT=",+ "UNISTR_FROM_CHAR_EXPLICIT=",+ ] + select({+ "@platforms//os:windows": [+ "U_STATIC_IMPLEMENTATION",+ "UNICODE",+ "_UNICODE",+ ],+ "//conditions:default": [],+ }),+ includes = [+ "source/common",+ "source/i18n",+ ],+ local_defines = [+ "U_COMMON_IMPLEMENTATION",+ "U_ICUDATAENTRY_IN_COMMON",+ ],+ tags = ["requires-rtti"],+ deps = _ICU_V8_RUNTIME_DEPS,+ alwayslink = 1,+)++cc_library(+ name = "icui18n",+ srcs = glob([+ "source/i18n/**/*.h",+ "source/i18n/**/*.cpp",+ ]),+ copts = ["-Wno-deprecated-declarations"] + _ICU_V8_COPTS,+ local_defines = [+ "U_I18N_IMPLEMENTATION",+ ],+ deps = [":icuuc"] + _ICU_V8_RUNTIME_DEPS,+ alwayslink = 1,+)++cc_library(+ name = "icu",+ srcs = [+ "source/stubdata/stubdata.cpp",+ "source/stubdata/stubdata.h",+ ],+ hdrs = glob([+ "source/common/unicode/*.h",+ "source/i18n/unicode/*.h",+ ]),+ copts = select({+ "@platforms//os:windows": [+ "-Wno-deprecated-declarations",+ ],+ "//conditions:default": [],+ }) + _ICU_V8_COPTS,+ include_prefix = "third_party/icu",+ local_defines = [+ "U_COMMON_IMPLEMENTATION",+ ],+ visibility = ["//visibility:public"],+ deps = [+ ":icui18n",+ ":icuuc",+ ] + _ICU_V8_RUNTIME_DEPS,+ alwayslink = 1,+)