Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Bazel (#736)

0x2Adr1bbebb1a56762
diff --git a/.bazelrc b/.bazelrc
new file mode 100644
index 00000000..cb1b9584
--- /dev/null
+++ b/.bazelrc
@@ -0,0 +1,4 @@
+build --action_env=BAZEL_CXXOPTS="-std=c++17"
+build --experimental_strict_action_env
+
+build --cxxopt="-std=c++17"
diff --git a/.gitignore b/.gitignore
index 64f9e71c..07331e04 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,11 @@
.idea
*.iml
external*
-build*
+/build*
test-build*
cmake-build*
cmake-build-debug
cmake-build-release
*.pem
.DS_Store
+/bazel-*
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 00000000..b5dd0c6b
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,5 @@
+{
+ "clangd.arguments": [
+ "--compile-commands-dir=bazel-bin"
+ ]
+}
\ No newline at end of file
diff --git a/BUILD b/BUILD
new file mode 100644
index 00000000..a0519093
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,125 @@
+load("@com_grail_bazel_compdb//:defs.bzl", "compilation_database")
+load("@com_grail_bazel_output_base_util//:defs.bzl", "OUTPUT_BASE")
+
+# Target to generate a compile_commands.json compilation database file
+compilation_database(
+ name = "compdb",
+ output_base = OUTPUT_BASE,
+ targets = [
+ "//:typesense-server",
+ "//:search",
+ "//:benchmark",
+ ],
+)
+
+filegroup(
+ name = "src_files",
+ srcs = glob(["src/*.cpp"]),
+)
+
+cc_library(
+ name = "headers",
+ hdrs = glob([
+ "include/**/*.h",
+ "include/**/*.hpp",
+ ]),
+ includes = ["include"],
+)
+
+cc_library(
+ name = "common_deps",
+ defines = [
+ "NDEBUG",
+ "TYPESENSE_VERSION=\\\"nightly\\\"",
+ ],
+ linkopts = select({
+ "@platforms//os:macos": ["-framework Foundation -framework SystemConfiguration"],
+ "//conditions:default": [],
+ }),
+ deps = [
+ ":headers",
+ "@com_github_brpc_braft//:braft",
+ "@com_github_brpc_brpc//:brpc",
+ "@com_github_google_glog//:glog",
+ "@curl",
+ "@for",
+ "@h2o",
+ "@iconv",
+ "@icu",
+ "@jemalloc",
+ "@kakasi",
+ "@lrucache",
+ "@rocksdb",
+ "@s2geometry",
+ ],
+)
+
+COPTS = [
+ "-Wall",
+ "-Wextra",
+ "-Wno-unused-parameter",
+ "-Werror=return-type",
+ "-O2",
+ "-g",
+]
+
+cc_binary(
+ name = "typesense-server",
+ srcs = [
+ "src/main/typesense_server.cpp",
+ ":src_files",
+ ],
+ copts = COPTS,
+ deps = [":common_deps"],
+)
+
+cc_binary(
+ name = "search",
+ srcs = [
+ "src/main/main.cpp",
+ ":src_files",
+ ],
+ copts = COPTS,
+ deps = [":common_deps"],
+)
+
+cc_binary(
+ name = "benchmark",
+ srcs = [
+ "src/main/benchmark.cpp",
+ ":src_files",
+ ],
+ copts = COPTS,
+ deps = [":common_deps"],
+)
+
+filegroup(
+ name = "test_src_files",
+ srcs = glob(["test/*.cpp"]),
+)
+
+filegroup(
+ name = "test_data_files",
+ srcs = glob([
+ "test/**/*.txt",
+ "test/**/*.ini",
+ "test/**/*.jsonl",
+ ]),
+)
+
+cc_test(
+ name = "typesense-test",
+ srcs = [
+ ":src_files",
+ ":test_src_files",
+ ],
+ copts = COPTS,
+ data = [
+ ":test_data_files",
+ "@libart//:data",
+ ],
+ deps = [
+ ":common_deps",
+ "@com_google_googletest//:gtest",
+ ],
+)
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 00000000..34b363f1
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,256 @@
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
+
+git_repository(
+ name = "com_grail_bazel_compdb",
+ commit = "58672f5eecd70a2d3ed50016a3abf907701404e0",
+ remote = "https://github.com/grailbio/bazel-compilation-database.git",
+)
+
+load("@com_grail_bazel_compdb//:deps.bzl", "bazel_compdb_deps")
+
+bazel_compdb_deps()
+
+http_archive(
+ name = "rules_foreign_cc",
+ patches = ["//bazel:foreign_cc.patch"],
+ sha256 = "2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51",
+ strip_prefix = "rules_foreign_cc-0.9.0",
+ url = "https://github.com/bazelbuild/rules_foreign_cc/archive/refs/tags/0.9.0.tar.gz",
+)
+
+load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
+
+rules_foreign_cc_dependencies()
+
+# brpc and its dependencies
+git_repository(
+ name = "com_github_brpc_brpc",
+ branch = "master",
+ patches = [
+ "//bazel/brpc:butil.patch",
+ "//bazel/brpc:brpc.patch",
+ ],
+ remote = "https://github.com/apache/incubator-brpc.git",
+)
+
+new_git_repository(
+ name = "com_github_madler_zlib",
+ build_file = "//bazel:zlib.BUILD",
+ remote = "https://github.com/madler/zlib.git",
+ tag = "v1.2.12",
+)
+
+git_repository(
+ name = "rules_perl",
+ commit = "71efd8d4ba6c7a1f2d7c7d8c46609518b725524f",
+ remote = "https://github.com/bazelbuild/rules_perl.git",
+)
+
+load("@rules_perl//perl:deps.bzl", "perl_register_toolchains", "perl_rules_dependencies")
+
+perl_rules_dependencies()
+
+perl_register_toolchains()
+
+register_toolchains(
+ "@rules_perl//:darwin_toolchain",
+ "@rules_perl//:linux_arm64_toolchain",
+ "@rules_perl//:linux_x86_64_toolchain",
+)
+
+git_repository(
+ name = "com_github_brpc_braft",
+ commit = "c6d5cb0b667cc9ed27d2d355655e82988633a3fe",
+ patches = ["//bazel/braft:0001.patch"],
+ remote = "https://github.com/baidu/braft.git",
+ repo_mapping = {
+ "@zlib": "@com_github_madler_zlib",
+ },
+)
+
+# Below are dependencies of brpc/braft and protobuf
+http_archive(
+ name = "rules_pkg",
+ sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz",
+ "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz",
+ ],
+)
+
+load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
+
+rules_pkg_dependencies()
+
+git_repository(
+ name = "com_google_protobuf",
+ remote = "https://github.com/protocolbuffers/protobuf.git",
+ repo_mapping = {
+ "@zlib": "@com_github_madler_zlib",
+ },
+ tag = "v21.5",
+)
+
+http_archive(
+ name = "com_github_google_leveldb", # 2021-02-23T21:51:12Z
+ build_file = "//bazel/leveldb:leveldb.BUILD",
+ sha256 = "9a37f8a6174f09bd622bc723b55881dc541cd50747cbd08831c2a82d620f6d76",
+ strip_prefix = "leveldb-1.23",
+ urls = [
+ "https://github.com/google/leveldb/archive/refs/tags/1.23.tar.gz",
+ ],
+)
+
+http_archive(
+ name = "com_github_google_crc32c", # 2021-10-05T19:47:30Z
+ build_file = "//bazel:crc32c.BUILD",
+ sha256 = "ac07840513072b7fcebda6e821068aa04889018f24e10e46181068fb214d7e56",
+ strip_prefix = "crc32c-1.1.2",
+ urls = ["https://github.com/google/crc32c/archive/1.1.2.tar.gz"],
+)
+
+http_archive(
+ name = "com_github_google_snappy", # 2017-08-25
+ build_file = "//bazel:snappy.BUILD",
+ sha256 = "3dfa02e873ff51a11ee02b9ca391807f0c8ea0529a4924afa645fbf97163f9d4",
+ strip_prefix = "snappy-1.1.7",
+ urls = [
+ "https://storage.googleapis.com/mirror.tensorflow.org/github.com/google/snappy/archive/1.1.7.tar.gz",
+ "https://github.com/google/snappy/archive/1.1.7.tar.gz",
+ ],
+)
+
+new_git_repository(
+ name = "for",
+ build_file = "//bazel:libfor.BUILD",
+ commit = "49611808d08d4e47116aa2a3ddcabeb418f405f7",
+ remote = "https://github.com/cruppstahl/libfor.git",
+)
+
+new_git_repository(
+ name = "lrucache",
+ build_file = "//bazel:lrucache.BUILD",
+ commit = "13f30ad33a227a3e9682578c450777380ecddfcf",
+ remote = "https://github.com/goldsborough/lru-cache.git",
+)
+
+new_git_repository(
+ name = "kakasi",
+ build_file = "//bazel:kakasi.BUILD",
+ commit = "9e0825a02c7ea5605e968f6208f769f7c49d6860",
+ remote = "https://github.com/typesense/kakasi.git",
+)
+
+http_archive(
+ name = "com_github_gflags_gflags",
+ sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf",
+ strip_prefix = "gflags-2.2.2",
+ urls = ["https://github.com/gflags/gflags/archive/v2.2.2.tar.gz"],
+)
+
+http_archive(
+ name = "com_github_google_glog",
+ sha256 = "122fb6b712808ef43fbf80f75c52a21c9760683dae470154f02bddfc61135022",
+ strip_prefix = "glog-0.6.0",
+ urls = ["https://github.com/google/glog/archive/v0.6.0.zip"],
+)
+
+new_git_repository(
+ name = "rocksdb",
+ build_file = "//bazel:rocksdb.BUILD",
+ remote = "https://github.com/facebook/rocksdb.git",
+ tag = "v7.5.3",
+)
+
+http_archive(
+ name = "curl",
+ build_file = "//bazel:curl.BUILD",
+ sha256 = "b00d84ffe1219f3b013629840b09dae2df5b7e24fb7447b9b74fad280024c73b",
+ strip_prefix = "curl-7.84.0",
+ urls = ["https://github.com/curl/curl/releases/download/curl-7_84_0/curl-7.84.0.zip"],
+)
+
+new_git_repository(
+ name = "h2o",
+ build_file = "//bazel/h2o:BUILD",
+ commit = "1491a703195790278091fd7aee547fbba78e89af",
+ patches = ["//bazel/h2o:h2o_1491a703195790278091fd7aee547fbba78e89af.patch"],
+ remote = "https://github.com/h2o/h2o.git",
+)
+
+http_archive(
+ name = "openssl",
+ build_file = "//bazel:openssl3.BUILD",
+ sha256 = "aa7d8d9bef71ad6525c55ba11e5f4397889ce49c2c9349dcea6d3e4f0b024a7a",
+ strip_prefix = "openssl-3.0.5",
+ urls = ["https://www.openssl.org/source/openssl-3.0.5.tar.gz"],
+)
+
+http_archive(
+ name = "jemalloc",
+ build_file = "//bazel:jemalloc.BUILD",
+ sha256 = "2db82d1e7119df3e71b7640219b6dfe84789bc0537983c3b7ac4f7189aecfeaa",
+ strip_prefix = "jemalloc-5.3.0",
+ urls = ["https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2"],
+)
+
+new_git_repository(
+ name = "s2geometry",
+ build_file = "//bazel/s2geometry:BUILD",
+ commit = "efb124d8eaf3433323d3e877dedd5e94a63339a3",
+ patches = ["//bazel/s2geometry:0001.patch"],
+ remote = "https://github.com/google/s2geometry.git",
+)
+
+new_git_repository(
+ name = "icu",
+ build_file = "//bazel/icu:BUILD",
+ patches = ["//bazel/icu:icu.patch"],
+ remote = "https://github.com/unicode-org/icu.git",
+ tag = "release-71-1",
+)
+
+git_repository(
+ name = "com_google_googletest",
+ remote = "https://github.com/google/googletest.git",
+ tag = "release-1.12.1",
+)
+
+new_git_repository(
+ name = "libart",
+ build_file = "//bazel:libart.BUILD",
+ commit = "bbbf588bca55bce095538ee8ca8b422904baebc5",
+ remote = "https://github.com/kishorenc/libart.git",
+)
+
+new_git_repository(
+ name = "picotls_openssl",
+ build_file = "//bazel/picotls_openssl:BUILD",
+ commit = "7970614ad049d194fe1691bdf0cc66c6930a3a2f", # 07/21/2022
+ patches = ["//bazel/picotls_openssl:0001.patch"],
+ remote = "https://github.com/h2o/picotls.git",
+)
+
+new_git_repository(
+ name = "quicly",
+ build_file = "//bazel/quicly:BUILD",
+ commit = "46110287eb20e0780cf41bd30fc4715907ccf400", # 08/08/2022
+ patches = ["//bazel/quicly:0001.patch"],
+ remote = "https://github.com/h2o/quicly.git",
+)
+
+new_git_repository(
+ name = "klib",
+ build_file = "//bazel/klib:BUILD",
+ commit = "de09fb7dff67be7c1a58e5be9fee4b4a9ca3a265", # 03/04/2017
+ remote = "https://github.com/attractivechaos/klib.git",
+)
+
+http_archive(
+ name = "iconv",
+ build_file = "//bazel:iconv.BUILD",
+ sha256 = "8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313",
+ strip_prefix = "libiconv-1.17",
+ urls = ["https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz"],
+)
diff --git a/bazel/BUILD b/bazel/BUILD
new file mode 100644
index 00000000..e69de29b
diff --git a/bazel/braft/0001.patch b/bazel/braft/0001.patch
new file mode 100644
index 00000000..04da1726
--- /dev/null
+++ b/bazel/braft/0001.patch
@@ -0,0 +1,49 @@
+
+
+--- BUILD
++++ BUILD
+@@ -18,14 +18,12 @@ cc_library(
+ defines = [],
+ copts = [
+ "-DGFLAGS=gflags",
+- "-DOS_LINUX",
+ "-DSNAPPY",
+ "-DHAVE_SSE42",
+ "-DNDEBUG",
+ "-D__STDC_FORMAT_MACROS",
+ "-fno-omit-frame-pointer",
+ "-momit-leaf-frame-pointer",
+- "-msse4.2",
+ "-pthread",
+ "-Wsign-compare",
+ "-Wno-unused-parameter",
+@@ -33,9 +31,18 @@ cc_library(
+ "-Woverloaded-virtual",
+ "-Wnon-virtual-dtor",
+ "-Wno-missing-field-initializers",
+- "-std=c++11",
+ "-DGFLAGS_NS=google",
+- ],
++ ] + select({
++ "@platforms//os:macos": [
++ "-DOS_MACOSX",
++ ],
++ "//conditions:default": [
++ "-DOS_LINUX",
++ ],
++ }) + select({
++ "@platforms//cpu:x86_64": [ "-msse4.2" ],
++ "//conditions:default": [],
++ }),
+ linkopts = [
+ "-lm",
+ "-lpthread",
+@@ -44,7 +51,7 @@ cc_library(
+ "@com_github_brpc_brpc//:brpc",
+ "@com_github_gflags_gflags//:gflags",
+ "@com_github_google_glog//:glog",
+- "@com_google_protobuf//:protobuf",
++ "@com_google_protobuf//:protobuf",
+ "@zlib//:zlib",
+ ":cc_braft_internal_proto",
+ ],
diff --git a/bazel/braft/BUILD b/bazel/braft/BUILD
new file mode 100644
index 00000000..e69de29b
diff --git a/bazel/brpc/BUILD b/bazel/brpc/BUILD
new file mode 100644
index 00000000..e69de29b
diff --git a/bazel/brpc/brpc.patch b/bazel/brpc/brpc.patch
new file mode 100644
index 00000000..34e9942a
--- /dev/null
+++ b/bazel/brpc/brpc.patch
@@ -0,0 +1,33 @@
+
+
+--- BUILD.bazel
++++ BUILD.bazel
+@@ -48,7 +48,7 @@ LINKOPTS = [
+ "-pthread",
+ "-ldl",
+ ] + select({
+- "@bazel_tools//tools/osx:darwin": [
++ "@platforms//os:macos": [
+ "-framework CoreFoundation",
+ "-framework CoreGraphics",
+ "-framework CoreData",
+@@ -206,7 +206,7 @@ BUTIL_SRCS = [
+ "src/butil/recordio.cc",
+ "src/butil/popen.cpp",
+ ] + select({
+- "@bazel_tools//tools/osx:darwin": [
++ "@platforms//os:macos": [
+ "src/butil/time/time_mac.cc",
+ "src/butil/mac/scoped_mach_port.cc",
+ ],
+@@ -322,7 +322,7 @@ cc_library(
+ "//bazel/config:brpc_with_glog": ["@com_github_google_glog//:glog"],
+ "//conditions:default": [],
+ }) + select({
+- "@bazel_tools//tools/osx:darwin": [":macos_lib"],
++ "@platforms//os:macos": [":macos_lib"],
+ "//conditions:default": [],
+ }),
+ )
+
+
diff --git a/bazel/brpc/butil.patch b/bazel/brpc/butil.patch
new file mode 100644
index 00000000..7b02dc8b
--- /dev/null
+++ b/bazel/brpc/butil.patch
@@ -0,0 +1,130 @@
+--- src/butil/logging.cc
++++ src/butil/logging.cc
+@@ -121,9 +121,9 @@ DEFINE_bool(crash_on_fatal_log, false,
+ DEFINE_bool(print_stack_on_check, true,
+ "Print the stack trace when a CHECK was failed");
+
+-DEFINE_int32(v, 0, "Show all VLOG(m) messages for m <= this."
++DEFINE_int32(v_butil, 0, "Show all VLOG(m) messages for m <= this."
+ " Overridable by --vmodule.");
+-DEFINE_string(vmodule, "", "per-module verbose level."
++DEFINE_string(vmodule_butil, "", "per-module verbose level."
+ " Argument is a comma-separated list of MODULE_NAME=LOG_LEVEL."
+ " MODULE_NAME is a glob pattern, matched against the filename base"
+ " (that is, name ignoring .cpp/.h)."
+@@ -131,7 +131,7 @@ DEFINE_string(vmodule, "", "per-module verbose level."
+
+ DEFINE_bool(log_pid, false, "Log process id");
+
+-DEFINE_int32(minloglevel, 0, "Any log at or above this level will be "
++DEFINE_int32(minloglevel_butil, 0, "Any log at or above this level will be "
+ "displayed. Anything below this level will be silently ignored. "
+ "0=INFO 1=NOTICE 2=WARNING 3=ERROR 4=FATAL");
+
+@@ -437,11 +437,11 @@ bool BaseInitLoggingImpl(const LoggingSettings& settings) {
+ }
+
+ void SetMinLogLevel(int level) {
+- FLAGS_minloglevel = std::min(BLOG_FATAL, level);
++ FLAGS_minloglevel_butil = std::min(BLOG_FATAL, level);
+ }
+
+ int GetMinLogLevel() {
+- return FLAGS_minloglevel;
++ return FLAGS_minloglevel_butil;
+ }
+
+ void SetShowErrorDialogs(bool enable_dialogs) {
+@@ -1104,7 +1104,7 @@ void CloseLogFile() {
+ }
+
+ void RawLog(int level, const char* message) {
+- if (level >= FLAGS_minloglevel) {
++ if (level >= FLAGS_minloglevel_butil) {
+ size_t bytes_written = 0;
+ const size_t message_len = strlen(message);
+ int rv;
+@@ -1355,12 +1355,12 @@ private:
+ // vlog_site_list. To keep the critical area small, we use optimistic
+ // locking : Assign local site w/o locking, then insert the site into
+ // global list w/ locking, if local_module_list != global_vmodule_list or
+-// local_default_v != FLAGS_v, repeat the assigment.
++// local_default_v != FLAGS_v_butil, repeat the assigment.
+ // An important property of vlog_site_list is that: It does not remove sites.
+ // When we need to iterate the list, we don't have to hold the lock. What we
+ // do is to get the head of the list inside lock and iterate the list w/o
+ // lock. If new sites is inserted during the iteration, it should see and
+-// use the updated vmodule_list and FLAGS_v, nothing will be missed.
++// use the updated vmodule_list and FLAGS_v_butil, nothing will be missed.
+
+ static int vlog_site_list_add(VLogSite* site,
+ VModuleList** expected_module_list,
+@@ -1370,8 +1370,8 @@ static int vlog_site_list_add(VLogSite* site,
+ *expected_module_list = vmodule_list;
+ return -1;
+ }
+- if (*expected_default_v != FLAGS_v) {
+- *expected_default_v = FLAGS_v;
++ if (*expected_default_v != FLAGS_v_butil) {
++ *expected_default_v = FLAGS_v_butil;
+ return -1;
+ }
+ site->set_next(vlog_site_list);
+@@ -1386,7 +1386,7 @@ bool add_vlog_site(const int** v, const char* filename, int line_no,
+ return false;
+ }
+ VModuleList* module_list = vmodule_list;
+- int default_v = FLAGS_v;
++ int default_v = FLAGS_v_butil;
+ do {
+ site->v() = default_v;
+ if (module_list) {
+@@ -1414,7 +1414,7 @@ void print_vlog_sites(VLogSitePrinter* printer) {
+ }
+ }
+
+-// [Thread-safe] Reset FLAGS_vmodule.
++// [Thread-safe] Reset FLAGS_vmodule_butil.
+ static int on_reset_vmodule(const char* vmodule) {
+ // resetting must be serialized.
+ BAIDU_SCOPED_LOCK(reset_vmodule_and_v_mutex);
+@@ -1440,7 +1440,7 @@ static int on_reset_vmodule(const char* vmodule) {
+ old_vlog_site_list = vlog_site_list;
+ }
+ for (VLogSite* p = old_vlog_site_list; p; p = p->next()) {
+- p->v() = FLAGS_v;
++ p->v() = FLAGS_v_butil;
+ module_list->find_verbose_level(
+ p->module(), p->full_module(), &p->v());
+ }
+@@ -1469,9 +1469,9 @@ static bool validate_vmodule(const char*, const std::string& vmodule) {
+ }
+
+ const bool ALLOW_UNUSED validate_vmodule_dummy = GFLAGS_NS::RegisterFlagValidator(
+- &FLAGS_vmodule, &validate_vmodule);
++ &FLAGS_vmodule_butil, &validate_vmodule);
+
+-// [Thread-safe] Reset FLAGS_v.
++// [Thread-safe] Reset FLAGS_v_butil.
+ static void on_reset_verbose(int default_v) {
+ VModuleList* cur_module_list = NULL;
+ VLogSite* cur_vlog_site_list = NULL;
+@@ -1499,7 +1499,7 @@ static bool validate_v(const char*, int32_t v) {
+ }
+
+ const bool ALLOW_UNUSED validate_v_dummy = GFLAGS_NS::RegisterFlagValidator(
+- &FLAGS_v, &validate_v);
++ &FLAGS_v_butil, &validate_v);
+
+ static bool PassValidate(const char*, bool) {
+ return true;
+@@ -1516,7 +1516,7 @@ static bool NonNegativeInteger(const char*, int32_t v) {
+ }
+
+ const bool ALLOW_UNUSED validate_min_log_level = GFLAGS_NS::RegisterFlagValidator(
+- &FLAGS_minloglevel, NonNegativeInteger);
++ &FLAGS_minloglevel_butil, NonNegativeInteger);
+
+ } // namespace logging
+
+
diff --git a/bazel/brpc/openssl.BUILD b/bazel/brpc/openssl.BUILD
new file mode 100644
index 00000000..c02cb6fb
--- /dev/null
+++ b/bazel/brpc/openssl.BUILD
@@ -0,0 +1,165 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright 2016 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copied from https://github.com/bazelbuild/rules_foreign_cc/blob/0.7.0/examples/third_party/openssl/BUILD.openssl.bazel
+#
+# Modifications:
+# 1. Create alias `ssl` & `crypto` to align with boringssl.
+# 2. Build with `@com_github_madler_zlib//:zlib`.
+# 3. Add more configure options coming from debian openssl package configurations.
+
+load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make", "configure_make_variant")
+
+filegroup(
+ name = "all_srcs",
+ srcs = glob(["**"]),
+)
+
+CONFIGURE_OPTIONS = [
+ "no-idea",
+ "no-mdc2",
+ "no-rc5",
+ "no-ssl3",
+ "no-ssl3-method",
+ "enable-rfc3779",
+ "enable-cms",
+ "no-capieng",
+ "enable-ec_nistp_64_gcc_128",
+ "--with-zlib-include=$$EXT_BUILD_DEPS$$",
+ "--with-zlib-lib=$$EXT_BUILD_DEPS$$",
+ # https://stackoverflow.com/questions/36220341/struct-in6-addr-has-no-member-named-s6-addr32-with-ansi
+ "-D_DEFAULT_SOURCE=1",
+ "-DPEDANTIC",
+]
+
+LIB_NAME = "openssl"
+
+MAKE_TARGETS = [
+ "build_libs",
+ "install_dev",
+]
+
+config_setting(
+ name = "msvc_compiler",
+ flag_values = {
+ "@bazel_tools//tools/cpp:compiler": "msvc-cl",
+ },
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "ssl",
+ actual = "openssl",
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "crypto",
+ actual = "openssl",
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "openssl",
+ actual = select({
+ ":msvc_compiler": "openssl_msvc",
+ "//conditions:default": "openssl_default",
+ }),
+ visibility = ["//visibility:public"],
+)
+
+configure_make_variant(
+ name = "openssl_msvc",
+ build_data = [
+ "@nasm//:nasm",
+ "@perl//:perl",
+ ],
+ configure_command = "Configure",
+ configure_in_place = True,
+ configure_options = CONFIGURE_OPTIONS + [
+ "VC-WIN64A",
+ # Unset Microsoft Assembler (MASM) flags set by built-in MSVC toolchain,
+ # as NASM is unsed to build OpenSSL rather than MASM
+ "ASFLAGS=\" \"",
+ ],
+ configure_prefix = "$PERL",
+ env = {
+ # The Zi flag must be set otherwise OpenSSL fails to build due to missing .pdb files
+ "CFLAGS": "-Zi",
+ "PATH": "$$(dirname $(execpath @nasm//:nasm)):$$PATH",
+ "PERL": "$(execpath @perl//:perl)",
+ },
+ lib_name = LIB_NAME,
+ lib_source = ":all_srcs",
+ out_static_libs = [
+ "libssl.lib",
+ "libcrypto.lib",
+ ],
+ targets = MAKE_TARGETS,
+ toolchain = "@rules_foreign_cc//toolchains:preinstalled_nmake_toolchain",
+ deps = [
+ "@com_github_madler_zlib//:zlib",
+ ],
+)
+
+# https://wiki.openssl.org/index.php/Compilation_and_Installation
+configure_make(
+ name = "openssl_default",
+ configure_command = "config",
+ configure_in_place = True,
+ configure_options = CONFIGURE_OPTIONS,
+ env = select({
+ "@platforms//os:macos": {
+ "AR": "",
+ "PERL": "$$EXT_BUILD_ROOT$$/$(PERL)",
+ },
+ "//conditions:default": {
+ "PERL": "$$EXT_BUILD_ROOT$$/$(PERL)",
+ },
+ }),
+ lib_name = LIB_NAME,
+ lib_source = ":all_srcs",
+ # Note that for Linux builds, libssl must come before libcrypto on the linker command-line.
+ # As such, libssl must be listed before libcrypto
+ out_static_libs = [
+ "libssl.a",
+ "libcrypto.a",
+ ],
+ targets = MAKE_TARGETS,
+ toolchains = ["@rules_perl//:current_toolchain"],
+ deps = [
+ "@com_github_madler_zlib//:zlib",
+ ],
+)
+
+filegroup(
+ name = "gen_dir",
+ srcs = [":openssl"],
+ output_group = "gen_dir",
+)
diff --git a/bazel/config/BUILD.bazel b/bazel/config/BUILD.bazel
new file mode 100644
index 00000000..df52a296
--- /dev/null
+++ b/bazel/config/BUILD.bazel
@@ -0,0 +1,100 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+licenses(["notice"]) # Apache v2
+
+selects.config_setting_group(
+ name = "brpc_with_glog",
+ match_any = [
+ ":brpc_with_glog_deprecated_flag",
+ ":brpc_with_glog_new_flag",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "brpc_with_glog_deprecated_flag",
+ define_values = {"with_glog": "true"},
+)
+
+config_setting(
+ name = "brpc_with_glog_new_flag",
+ define_values = {"BRPC_WITH_GLOG": "true"},
+)
+
+selects.config_setting_group(
+ name = "brpc_with_mesalink",
+ match_any = [
+ ":brpc_with_mesalink_deprecated_flag",
+ ":brpc_with_mesalink_new_flag",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "brpc_with_mesalink_deprecated_flag",
+ define_values = {"with_mesalink": "true"},
+)
+
+config_setting(
+ name = "brpc_with_mesalink_new_flag",
+ define_values = {"BRPC_WITH_MESALINK": "true"},
+)
+
+selects.config_setting_group(
+ name = "brpc_with_thrift",
+ match_any = [
+ ":brpc_with_thrift_deprecated_flag",
+ ":brpc_with_thrift_new_flag",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "brpc_with_thrift_legacy_version",
+ define_values = {"BRPC_WITH_THRIFT_LEGACY_VERSION": "true"},
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "brpc_with_thrift_deprecated_flag",
+ define_values = {"with_thrift": "true"},
+)
+
+config_setting(
+ name = "brpc_with_thrift_new_flag",
+ define_values = {"BRPC_WITH_THRIFT": "true"},
+)
+
+config_setting(
+ name = "brpc_build_for_unittest",
+ define_values = {"BRPC_BUILD_FOR_UNITTEST": "true"},
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "brpc_with_sse42",
+ define_values = {"BRPC_WITH_SSE42": "true"},
+ values = {"cpu": "x86_64"},
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "darwin",
+ values = {"cpu": "darwin"},
+ visibility = ["//:__subpkgs__"],
+)
diff --git a/bazel/crc32c.BUILD b/bazel/crc32c.BUILD
new file mode 100644
index 00000000..72715d48
--- /dev/null
+++ b/bazel/crc32c.BUILD
@@ -0,0 +1,93 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
+
+genrule(
+ name = "crc32c_config_h",
+ srcs = ["src/crc32c_config.h.in"],
+ outs = ["crc32c/crc32c_config.h"],
+ cmd = """
+sed -e 's/#cmakedefine01/#define/' \
+""" + select({
+ "@//bazel/config:brpc_with_sse42": """-e 's/ HAVE_SSE42/ HAVE_SSE42 1/' \
+""",
+ "//conditions:default": """-e 's/ HAVE_SSE42/ HAVE_SSE42 0/' \
+""",
+ }) + select({
+ "@//bazel/config:brpc_with_glog": """-e 's/ CRC32C_TESTS_BUILT_WITH_GLOG/ CRC32C_TESTS_BUILT_WITH_GLOG 1/' \
+""",
+ "//conditions:default": """-e 's/ CRC32C_TESTS_BUILT_WITH_GLOG/ CRC32C_TESTS_BUILT_WITH_GLOG 0/' \
+""",
+ }) + """-e 's/ BYTE_ORDER_BIG_ENDIAN/ BYTE_ORDER_BIG_ENDIAN 0/' \
+ -e 's/ HAVE_BUILTIN_PREFETCH/ HAVE_BUILTIN_PREFETCH 0/' \
+ -e 's/ HAVE_MM_PREFETCH/ HAVE_MM_PREFETCH 0/' \
+ -e 's/ HAVE_ARM64_CRC32C/ HAVE_ARM64_CRC32C 0/' \
+ -e 's/ HAVE_STRONG_GETAUXVAL/ HAVE_STRONG_GETAUXVAL 0/' \
+ -e 's/ HAVE_WEAK_GETAUXVAL/ HAVE_WEAK_GETAUXVAL 0/' \
+ < $< > $@
+""",
+)
+
+cc_library(
+ name = "crc32c",
+ srcs = [
+ "src/crc32c.cc",
+ "src/crc32c_arm64.cc",
+ "src/crc32c_arm64.h",
+ "src/crc32c_arm64_check.h",
+ "src/crc32c_internal.h",
+ "src/crc32c_portable.cc",
+ "src/crc32c_prefetch.h",
+ "src/crc32c_read_le.h",
+ "src/crc32c_round_up.h",
+ "src/crc32c_sse42.cc",
+ "src/crc32c_sse42.h",
+ "src/crc32c_sse42_check.h",
+ ":crc32c_config_h",
+ ],
+ hdrs = [
+ "include/crc32c/crc32c.h",
+ ],
+ copts = select({
+ "@//bazel/config:brpc_with_sse42": ["-msse4.2"],
+ "//conditions:default": [],
+ }),
+ strip_include_prefix = "include",
+ visibility = ["//visibility:public"],
+)
+
+cc_test(
+ name = "crc32c_test",
+ srcs = [
+ "src/crc32c_arm64_unittest.cc",
+ "src/crc32c_extend_unittests.h",
+ "src/crc32c_portable_unittest.cc",
+ "src/crc32c_prefetch_unittest.cc",
+ "src/crc32c_read_le_unittest.cc",
+ "src/crc32c_round_up_unittest.cc",
+ "src/crc32c_sse42_unittest.cc",
+ "src/crc32c_test_main.cc",
+ "src/crc32c_unittest.cc",
+ ],
+ deps = [
+ ":crc32c",
+ "@com_google_googletest//:gtest",
+ "@com_google_googletest//:gtest_main",
+ ] + select({
+ "@//bazel/config:brpc_with_glog": ["@com_github_google_glog//:glog"],
+ "//conditions:default": [],
+ }),
+)
diff --git a/bazel/curl.BUILD b/bazel/curl.BUILD
new file mode 100644
index 00000000..7b1337d5
--- /dev/null
+++ b/bazel/curl.BUILD
@@ -0,0 +1,39 @@
+load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
+
+package(default_visibility = ["//visibility:public"])
+
+filegroup(
+ name = "all_srcs",
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+CMAKE_CACHE_ENTRIES = {
+ "BUILD_SHARED_LIBS": "OFF",
+ "CMAKE_BUILD_TYPE": "Release",
+ "OPENSSL_ROOT_DIR": "$$EXT_BUILD_DEPS$$/openssl",
+ "CURL_USE_OPENSSL": "ON",
+ "BUILD_CURL_EXE": "OFF",
+ "CURL_DISABLE_LDAP": "ON",
+ "CURL_DISABLE_LDAPS": "ON",
+ "CURL_USE_LIBSSH2": "OFF",
+}
+
+CMAKE_MACOS_CACHE_ENTRIES = dict(CMAKE_CACHE_ENTRIES.items() + {}.items())
+
+CMAKE_LINUX_CACHE_ENTRIES = dict(CMAKE_CACHE_ENTRIES.items() + {
+ "CMAKE_C_FLAGS": "-fPIC",
+}.items())
+
+cmake(
+ name = "curl",
+ build_args = ["-j8"],
+ cache_entries = select({
+ "@platforms//os:linux": CMAKE_LINUX_CACHE_ENTRIES,
+ "@platforms//os:macos": CMAKE_MACOS_CACHE_ENTRIES,
+ "//conditions:default": CMAKE_CACHE_ENTRIES,
+ }),
+ lib_source = "//:all_srcs",
+ out_static_libs = ["libcurl.a"],
+ deps = ["@openssl"],
+)
diff --git a/bazel/foreign_cc.patch b/bazel/foreign_cc.patch
new file mode 100644
index 00000000..76fd5f77
--- /dev/null
+++ b/bazel/foreign_cc.patch
@@ -0,0 +1,13 @@
+--- foreign_cc/private/configure_script.bzl
++++ foreign_cc/private/configure_script.bzl
+@@ -70,7 +70,7 @@
+ ).lstrip())
+
+ script.append("##mkdirs## $$BUILD_TMPDIR$$/$$INSTALL_PREFIX$$")
+- script.append("{env_vars} {prefix}\"{configure}\" --prefix=$$BUILD_TMPDIR$$/$$INSTALL_PREFIX$$ {user_options}".format(
++ script.append("{env_vars} {prefix}\"{configure}\" {user_options} --prefix=$$BUILD_TMPDIR$$/$$INSTALL_PREFIX$$".format(
+ env_vars = get_make_env_vars(workspace_name, tools, flags, env_vars, deps, inputs),
+ prefix = configure_prefix,
+ configure = configure_path,
+
+
diff --git a/bazel/h2o/BUILD b/bazel/h2o/BUILD
new file mode 100644
index 00000000..1a555992
--- /dev/null
+++ b/bazel/h2o/BUILD
@@ -0,0 +1,45 @@
+load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
+
+package(default_visibility = ["//visibility:public"])
+
+filegroup(
+ name = "all_srcs",
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+CMAKE_CACHE_ENTRIES = {
+ "BUILD_SHARED_LIBS": "OFF",
+ "CMAKE_BUILD_TYPE": "Release",
+}
+
+CMAKE_MACOS_CACHE_ENTRIES = dict(CMAKE_CACHE_ENTRIES.items() + {}.items())
+
+CMAKE_LINUX_CACHE_ENTRIES = dict(CMAKE_CACHE_ENTRIES.items() + {
+ "CMAKE_C_FLAGS": "-fPIC",
+}.items())
+
+cmake(
+ name = "h2o",
+ build_args = ["-j8"],
+ cache_entries = select({
+ "@platforms//os:linux": CMAKE_LINUX_CACHE_ENTRIES,
+ "@platforms//os:macos": CMAKE_MACOS_CACHE_ENTRIES,
+ "//conditions:default": CMAKE_CACHE_ENTRIES,
+ }),
+ generate_args = [
+ "-DCMAKE_FIND_LIBRARY_SUFFIXES=.a",
+ "-DCMAKE_CXX_FLAGS=-DNDEBUG",
+ "-DCMAKE_C_FLAGS=-DNDEBUG",
+ "-DWITH_MRUBY=OFF",
+ "-DWITH_CCACHE=OFF",
+ ],
+ lib_source = "//:all_srcs",
+ out_lib_dir = "../h2o.build_tmpdir",
+ out_static_libs = ["libh2o-evloop.a"],
+ targets = ["libh2o-evloop"],
+ deps = [
+ "@picotls_openssl",
+ "@quicly",
+ ],
+)
diff --git a/bazel/h2o/h2o_1491a703195790278091fd7aee547fbba78e89af.patch b/bazel/h2o/h2o_1491a703195790278091fd7aee547fbba78e89af.patch
new file mode 100644
index 00000000..060308e7
--- /dev/null
+++ b/bazel/h2o/h2o_1491a703195790278091fd7aee547fbba78e89af.patch
@@ -0,0 +1,799 @@
+
+
+--- CMakeLists.txt
++++ CMakeLists.txt
+@@ -41,10 +41,6 @@ INCLUDE(CMakePushCheckState)
+ INCLUDE(ExternalProject)
+ INCLUDE(deps/picotls/cmake/dtrace-utils.cmake)
+
+-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/h2o/version.h)
+-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libh2o.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libh2o.pc @ONLY)
+-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libh2o-evloop.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libh2o-evloop.pc @ONLY)
+-
+ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+
+ FIND_PACKAGE(PkgConfig)
+@@ -714,13 +710,11 @@ SET_TARGET_PROPERTIES(examples-websocket-evloop PROPERTIES
+ TARGET_LINK_LIBRARIES(examples-websocket-evloop libh2o-evloop ${WSLAY_LIBRARIES} ${EXTRA_LIBS})
+
+ IF (LIBUV_FOUND AND BROTLI_FOUND AND NOT WITHOUT_LIBS)
+- INSTALL(TARGETS libh2o DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ ELSE ()
+ SET_TARGET_PROPERTIES(libh2o PROPERTIES EXCLUDE_FROM_ALL 1)
+ ENDIF ()
+ IF (BROTLI_FOUND AND NOT WITHOUT_LIBS)
+ INSTALL(TARGETS libh2o-evloop DESTINATION ${CMAKE_INSTALL_LIBDIR})
+- INSTALL(TARGETS h2o-httpclient DESTINATION ${CMAKE_INSTALL_BINDIR})
+ ELSE ()
+ SET_TARGET_PROPERTIES(libh2o-evloop PROPERTIES EXCLUDE_FROM_ALL 1)
+ SET_TARGET_PROPERTIES(h2o-httpclient PROPERTIES EXCLUDE_FROM_ALL 1)
+@@ -784,16 +778,10 @@ IF (WITH_MRUBY)
+ ENDIF (WITH_MRUBY)
+ TARGET_LINK_LIBRARIES(h2o ${EXTRA_LIBS})
+
+-INSTALL(TARGETS h2o
+- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+-
+ IF (NOT WITHOUT_LIBS)
+ INSTALL(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h")
+ IF (LIBUV_FOUND)
+- INSTALL(FILES "${CMAKE_BINARY_DIR}/libh2o.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+ ENDIF ()
+- INSTALL(FILES "${CMAKE_BINARY_DIR}/libh2o-evloop.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+ ENDIF ()
+
+ INSTALL(PROGRAMS share/h2o/annotate-backtrace-symbols share/h2o/fastcgi-cgi share/h2o/fetch-ocsp-response share/h2o/kill-on-close share/h2o/setuidgid share/h2o/start_server DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/h2o)
+@@ -1051,8 +1039,6 @@ IF (WITH_H2OLOG)
+ PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/h2olog"
+ PRIVATE "${LIBBCC_INCLUDE_DIRS}"
+ )
+-
+- INSTALL(TARGETS h2olog RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+ ENDIF (WITH_H2OLOG)
+
+ # gitrev
+
+
+
+--- deps/brotli/BUILD
++++ /dev/null
+@@ -1,224 +0,0 @@
+-# Description:
+-# Brotli is a generic-purpose lossless compression algorithm.
+-
+-package(
+- default_visibility = ["//visibility:public"],
+-)
+-
+-licenses(["notice"]) # MIT
+-
+-exports_files(["LICENSE"])
+-
+-# >>> JNI headers
+-
+-config_setting(
+- name = "darwin",
+- values = {"cpu": "darwin"},
+- visibility = ["//visibility:public"],
+-)
+-
+-config_setting(
+- name = "darwin_x86_64",
+- values = {"cpu": "darwin_x86_64"},
+- visibility = ["//visibility:public"],
+-)
+-
+-config_setting(
+- name = "windows",
+- values = {"cpu": "x64_windows"},
+- visibility = ["//visibility:public"],
+-)
+-
+-config_setting(
+- name = "windows_msvc",
+- values = {"cpu": "x64_windows_msvc"},
+- visibility = ["//visibility:public"],
+-)
+-
+-config_setting(
+- name = "windows_msys",
+- values = {"cpu": "x64_windows_msys"},
+- visibility = ["//visibility:public"],
+-)
+-
+-genrule(
+- name = "copy_link_jni_header",
+- srcs = ["@openjdk_linux//:jni_h"],
+- outs = ["jni/jni.h"],
+- cmd = "cp -f $< $@",
+-)
+-
+-genrule(
+- name = "copy_link_jni_md_header",
+- srcs = select({
+- ":darwin": ["@openjdk_macos//:jni_md_h"],
+- ":darwin_x86_64": ["@openjdk_macos//:jni_md_h"],
+- ":windows_msys": ["@openjdk_win//:jni_md_h"],
+- ":windows_msvc": ["@openjdk_win//:jni_md_h"],
+- ":windows": ["@openjdk_win//:jni_md_h"],
+- "//conditions:default": ["@openjdk_linux//:jni_md_h"],
+- }),
+- outs = ["jni/jni_md.h"],
+- cmd = "cp -f $< $@",
+-)
+-
+-cc_library(
+- name = "jni_inc",
+- hdrs = [
+- ":jni/jni.h",
+- ":jni/jni_md.h",
+- ],
+- includes = ["jni"],
+-)
+-
+-# <<< JNI headers
+-
+-STRICT_C_OPTIONS = [
+- "--pedantic-errors",
+- "-Wall",
+- "-Wconversion",
+- "-Werror",
+- "-Wextra",
+- "-Wlong-long",
+- "-Wmissing-declarations",
+- "-Wmissing-prototypes",
+- "-Wno-strict-aliasing",
+- "-Wshadow",
+- "-Wsign-compare",
+-]
+-
+-filegroup(
+- name = "public_headers",
+- srcs = glob(["c/include/brotli/*.h"]),
+-)
+-
+-filegroup(
+- name = "common_headers",
+- srcs = glob(["c/common/*.h"]),
+-)
+-
+-filegroup(
+- name = "common_sources",
+- srcs = glob(["c/common/*.c"]),
+-)
+-
+-filegroup(
+- name = "dec_headers",
+- srcs = glob(["c/dec/*.h"]),
+-)
+-
+-filegroup(
+- name = "dec_sources",
+- srcs = glob(["c/dec/*.c"]),
+-)
+-
+-filegroup(
+- name = "enc_headers",
+- srcs = glob(["c/enc/*.h"]),
+-)
+-
+-filegroup(
+- name = "enc_sources",
+- srcs = glob(["c/enc/*.c"]),
+-)
+-
+-cc_library(
+- name = "brotli_inc",
+- hdrs = [":public_headers"],
+- copts = STRICT_C_OPTIONS,
+- includes = ["c/include"],
+-)
+-
+-cc_library(
+- name = "brotlicommon",
+- srcs = [":common_sources"],
+- hdrs = [":common_headers"],
+- copts = STRICT_C_OPTIONS,
+- deps = [":brotli_inc"],
+-)
+-
+-cc_library(
+- name = "brotlidec",
+- srcs = [":dec_sources"],
+- hdrs = [":dec_headers"],
+- copts = STRICT_C_OPTIONS,
+- deps = [":brotlicommon"],
+-)
+-
+-cc_library(
+- name = "brotlienc",
+- srcs = [":enc_sources"],
+- hdrs = [":enc_headers"],
+- copts = STRICT_C_OPTIONS,
+- linkopts = ["-lm"],
+- deps = [":brotlicommon"],
+-)
+-
+-cc_binary(
+- name = "brotli",
+- srcs = ["c/tools/brotli.c"],
+- copts = STRICT_C_OPTIONS,
+- linkstatic = 1,
+- deps = [
+- ":brotlidec",
+- ":brotlienc",
+- ],
+-)
+-
+-########################################################
+-# WARNING: do not (transitively) depend on this target!
+-########################################################
+-cc_binary(
+- name = "brotli_jni.dll",
+- srcs = [
+- ":common_headers",
+- ":common_sources",
+- ":dec_headers",
+- ":dec_sources",
+- ":enc_headers",
+- ":enc_sources",
+- "//java/org/brotli/wrapper/common:jni_src",
+- "//java/org/brotli/wrapper/dec:jni_src",
+- "//java/org/brotli/wrapper/enc:jni_src",
+- ],
+- deps = [
+- ":brotli_inc",
+- ":jni_inc",
+- ],
+- linkshared = 1,
+-)
+-
+-########################################################
+-# WARNING: do not (transitively) depend on this target!
+-########################################################
+-cc_binary(
+- name = "brotli_jni_no_dictionary_data.dll",
+- srcs = [
+- ":common_headers",
+- ":common_sources",
+- ":dec_headers",
+- ":dec_sources",
+- ":enc_headers",
+- ":enc_sources",
+- "//java/org/brotli/wrapper/common:jni_src",
+- "//java/org/brotli/wrapper/dec:jni_src",
+- "//java/org/brotli/wrapper/enc:jni_src",
+- ],
+- defines = [
+- "BROTLI_EXTERNAL_DICTIONARY_DATA=",
+- ],
+- deps = [
+- ":brotli_inc",
+- ":jni_inc",
+- ],
+- linkshared = 1,
+-)
+-
+-filegroup(
+- name = "dictionary",
+- srcs = ["c/common/dictionary.bin"],
+-)
+-
+-load("@io_bazel_rules_go//go:def.bzl", "go_prefix")
+-
+-go_prefix("github.com/google/brotli")
+
+
+
+--- deps/brotli/go/cbrotli/BUILD
++++ /dev/null
+@@ -1,26 +0,0 @@
+-package(default_visibility = ["//visibility:public"])
+-
+-licenses(["notice"]) # MIT
+-
+-load("@io_bazel_rules_go//go:def.bzl", "go_prefix", "cgo_library", "go_test")
+-
+-go_prefix("github.com/google/brotli")
+-
+-cgo_library(
+- name = "cbrotli",
+- srcs = [
+- "reader.go",
+- "writer.go",
+- ],
+- cdeps = [
+- "//:brotlidec",
+- "//:brotlienc",
+- ],
+-)
+-
+-go_test(
+- name = "cbrotli_test",
+- size = "small",
+- srcs = ["cbrotli_test.go"],
+- library = ":cbrotli",
+-)
+
+
+
+--- deps/brotli/java/org/brotli/dec/BUILD
++++ /dev/null
+@@ -1,55 +0,0 @@
+-# Description:
+-# Java port of Brotli decoder.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-licenses(["notice"]) # MIT
+-
+-java_library(
+- name = "dec",
+- srcs = glob(
+- ["*.java"],
+- exclude = ["*Test*.java"],
+- ),
+- proguard_specs = ["proguard.cfg"],
+-)
+-
+-java_library(
+- name = "test_lib",
+- testonly = 1,
+- srcs = glob(["*Test*.java"]),
+- deps = [
+- ":dec",
+- "@junit_junit//jar",
+- ],
+-)
+-
+-java_test(
+- name = "BitReaderTest",
+- test_class = "org.brotli.dec.BitReaderTest",
+- runtime_deps = [":test_lib"],
+-)
+-
+-java_test(
+- name = "DecodeTest",
+- test_class = "org.brotli.dec.DecodeTest",
+- runtime_deps = [":test_lib"],
+-)
+-
+-java_test(
+- name = "DictionaryTest",
+- test_class = "org.brotli.dec.DictionaryTest",
+- runtime_deps = [":test_lib"],
+-)
+-
+-java_test(
+- name = "SynthTest",
+- test_class = "org.brotli.dec.SynthTest",
+- runtime_deps = [":test_lib"],
+-)
+-
+-java_test(
+- name = "TransformTest",
+- test_class = "org.brotli.dec.TransformTest",
+- runtime_deps = [":test_lib"],
+-)
+
+
+
+--- deps/brotli/java/org/brotli/integration/BUILD
++++ /dev/null
+@@ -1,73 +0,0 @@
+-# Description:
+-# Integration test runner + corpus for Java port of Brotli decoder.
+-
+-java_library(
+- name = "brotli_jni_test_base",
+- srcs = ["BrotliJniTestBase.java"],
+- visibility = [
+- "//java/org/brotli/wrapper/common:__pkg__",
+- "//java/org/brotli/wrapper/dec:__pkg__",
+- "//java/org/brotli/wrapper/enc:__pkg__",
+- ],
+-)
+-
+-java_library(
+- name = "bundle_helper",
+- srcs = ["BundleHelper.java"],
+- visibility = [
+- "//java/org/brotli/wrapper/dec:__pkg__",
+- "//java/org/brotli/wrapper/enc:__pkg__",
+- ],
+-)
+-
+-java_library(
+- name = "bundle_checker",
+- srcs = ["BundleChecker.java"],
+- deps = [
+- ":bundle_helper",
+- "//java/org/brotli/dec",
+- ],
+-)
+-
+-java_binary(
+- name = "bundle_checker_bin",
+- main_class = "org.brotli.integration.BundleChecker",
+- runtime_deps = [":bundle_checker"],
+-)
+-
+-java_test(
+- name = "bundle_checker_data_test",
+- args = ["java/org/brotli/integration/test_data.zip"],
+- data = ["test_data.zip"],
+- main_class = "org.brotli.integration.BundleChecker",
+- use_testrunner = 0,
+- runtime_deps = [":bundle_checker"],
+-)
+-
+-java_test(
+- name = "bundle_checker_fuzz_test",
+- args = [
+- "-s",
+- "java/org/brotli/integration/fuzz_data.zip",
+- ],
+- data = ["fuzz_data.zip"],
+- main_class = "org.brotli.integration.BundleChecker",
+- use_testrunner = 0,
+- runtime_deps = [":bundle_checker"],
+-)
+-
+-filegroup(
+- name = "test_data",
+- srcs = ["test_data.zip"],
+- visibility = [
+- "//java/org/brotli/wrapper/dec:__pkg__",
+- ],
+-)
+-
+-filegroup(
+- name = "test_corpus",
+- srcs = ["test_corpus.zip"],
+- visibility = [
+- "//java/org/brotli/wrapper/enc:__pkg__",
+- ],
+-)
+
+
+
+--- deps/brotli/java/org/brotli/wrapper/common/BUILD
++++ /dev/null
+@@ -1,64 +0,0 @@
+-package(default_visibility = ["//visibility:public"])
+-
+-licenses(["notice"]) # MIT
+-
+-filegroup(
+- name = "jni_src",
+- srcs = ["common_jni.cc"],
+-)
+-
+-filegroup(
+- name = "brotli_jni_no_dictionary_data",
+- srcs = ["//:brotli_jni_no_dictionary_data.dll"],
+-)
+-
+-java_library(
+- name = "common",
+- srcs = glob(
+- ["*.java"],
+- exclude = ["*Test*.java"],
+- ),
+-)
+-
+-java_test(
+- name = "SetZeroDictionaryTest",
+- size = "small",
+- srcs = ["SetZeroDictionaryTest.java"],
+- data = [
+- ":brotli_jni_no_dictionary_data", # Bazel JNI workaround
+- ],
+- jvm_flags = [
+- "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni_no_dictionary_data)",
+- ],
+- deps = [
+- ":common",
+- "//java/org/brotli/integration:brotli_jni_test_base",
+- "//java/org/brotli/wrapper/dec",
+- "@junit_junit//jar",
+- ],
+-)
+-
+-filegroup(
+- name = "rfc_dictionary",
+- srcs = ["//:dictionary"],
+-)
+-
+-java_test(
+- name = "SetRfcDictionaryTest",
+- size = "small",
+- srcs = ["SetRfcDictionaryTest.java"],
+- data = [
+- ":rfc_dictionary",
+- ":brotli_jni_no_dictionary_data", # Bazel JNI workaround
+- ],
+- jvm_flags = [
+- "-DRFC_DICTIONARY=$(location :rfc_dictionary)",
+- "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni_no_dictionary_data)",
+- ],
+- deps = [
+- ":common",
+- "//java/org/brotli/integration:brotli_jni_test_base",
+- "//java/org/brotli/wrapper/dec",
+- "@junit_junit//jar",
+- ],
+-)
+
+
+
+--- deps/brotli/java/org/brotli/wrapper/dec/BUILD
++++ /dev/null
+@@ -1,86 +0,0 @@
+-package(default_visibility = ["//visibility:public"])
+-
+-licenses(["notice"]) # MIT
+-
+-filegroup(
+- name = "jni_src",
+- srcs = ["decoder_jni.cc"],
+-)
+-
+-java_library(
+- name = "dec",
+- srcs = glob(
+- ["*.java"],
+- exclude = ["*Test*.java"],
+- ),
+-)
+-
+-filegroup(
+- name = "brotli_jni",
+- srcs = ["//:brotli_jni.dll"],
+-)
+-
+-filegroup(
+- name = "test_bundle",
+- srcs = ["//java/org/brotli/integration:test_data"],
+-)
+-
+-java_test(
+- name = "BrotliDecoderChannelTest",
+- size = "large",
+- srcs = ["BrotliDecoderChannelTest.java"],
+- data = [
+- ":brotli_jni", # Bazel JNI workaround
+- ":test_bundle",
+- ],
+- jvm_flags = [
+- "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
+- "-DTEST_BUNDLE=$(location :test_bundle)",
+- ],
+- deps = [
+- ":dec",
+- "//java/org/brotli/integration:brotli_jni_test_base",
+- "//java/org/brotli/integration:bundle_helper",
+- "@junit_junit//jar",
+- ],
+-)
+-
+-java_test(
+- name = "BrotliInputStreamTest",
+- size = "large",
+- srcs = ["BrotliInputStreamTest.java"],
+- data = [
+- ":brotli_jni", # Bazel JNI workaround
+- ":test_bundle",
+- ],
+- jvm_flags = [
+- "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
+- "-DTEST_BUNDLE=$(location :test_bundle)",
+- ],
+- deps = [
+- ":dec",
+- "//java/org/brotli/integration:brotli_jni_test_base",
+- "//java/org/brotli/integration:bundle_helper",
+- "@junit_junit//jar",
+- ],
+-)
+-
+-java_test(
+- name = "DecoderTest",
+- size = "large",
+- srcs = ["DecoderTest.java"],
+- data = [
+- ":brotli_jni", # Bazel JNI workaround
+- ":test_bundle",
+- ],
+- jvm_flags = [
+- "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
+- "-DTEST_BUNDLE=$(location :test_bundle)",
+- ],
+- deps = [
+- ":dec",
+- "//java/org/brotli/integration:brotli_jni_test_base",
+- "//java/org/brotli/integration:bundle_helper",
+- "@junit_junit//jar",
+- ],
+-)
+
+
+
+--- deps/brotli/java/org/brotli/wrapper/enc/BUILD
++++ /dev/null
+@@ -1,92 +0,0 @@
+-package(default_visibility = ["//visibility:public"])
+-
+-licenses(["notice"]) # MIT
+-
+-filegroup(
+- name = "jni_src",
+- srcs = ["encoder_jni.cc"],
+-)
+-
+-filegroup(
+- name = "brotli_jni",
+- srcs = ["//:brotli_jni.dll"],
+-)
+-
+-java_library(
+- name = "enc",
+- srcs = glob(
+- ["*.java"],
+- exclude = ["*Test*.java"],
+- ),
+-)
+-
+-filegroup(
+- name = "test_bundle",
+- srcs = ["//java/org/brotli/integration:test_corpus"],
+-)
+-
+-java_test(
+- name = "BrotliEncoderChannelTest",
+- size = "large",
+- srcs = ["BrotliEncoderChannelTest.java"],
+- data = [
+- ":brotli_jni", # Bazel JNI workaround
+- ":test_bundle",
+- ],
+- jvm_flags = [
+- "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
+- "-DTEST_BUNDLE=$(location :test_bundle)",
+- ],
+- shard_count = 15,
+- deps = [
+- ":enc",
+- "//java/org/brotli/integration:brotli_jni_test_base",
+- "//java/org/brotli/integration:bundle_helper",
+- "//java/org/brotli/wrapper/dec",
+- "@junit_junit//jar",
+- ],
+-)
+-
+-java_test(
+- name = "BrotliOutputStreamTest",
+- size = "large",
+- srcs = ["BrotliOutputStreamTest.java"],
+- data = [
+- ":brotli_jni", # Bazel JNI workaround
+- ":test_bundle",
+- ],
+- jvm_flags = [
+- "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
+- "-DTEST_BUNDLE=$(location :test_bundle)",
+- ],
+- shard_count = 15,
+- deps = [
+- ":enc",
+- "//java/org/brotli/integration:brotli_jni_test_base",
+- "//java/org/brotli/integration:bundle_helper",
+- "//java/org/brotli/wrapper/dec",
+- "@junit_junit//jar",
+- ],
+-)
+-
+-java_test(
+- name = "EncoderTest",
+- size = "large",
+- srcs = ["EncoderTest.java"],
+- data = [
+- ":brotli_jni", # Bazel JNI workaround
+- ":test_bundle",
+- ],
+- jvm_flags = [
+- "-DBROTLI_JNI_LIBRARY=$(location :brotli_jni)",
+- "-DTEST_BUNDLE=$(location :test_bundle)",
+- ],
+- shard_count = 15,
+- deps = [
+- ":enc",
+- "//java/org/brotli/integration:brotli_jni_test_base",
+- "//java/org/brotli/integration:bundle_helper",
+- "//java/org/brotli/wrapper/dec",
+- "@junit_junit//jar",
+- ],
+-)
+
+
+
+--- deps/brotli/js/BUILD
++++ /dev/null
+@@ -1,41 +0,0 @@
+-package(
+- default_visibility = ["//visibility:public"],
+-)
+-
+-licenses(["notice"]) # MIT
+-
+-load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
+-
+-# Not a real polyfill. Do NOT use for anything, but tests.
+-closure_js_library(
+- name = "polyfill",
+- srcs = ["polyfill.js"],
+- suppress = [
+- "JSC_MISSING_JSDOC",
+- "JSC_TYPE_MISMATCH",
+- "JSC_UNKNOWN_EXPR_TYPE",
+- ],
+-)
+-
+-# Do NOT use this artifact; it is for test purposes only.
+-closure_js_library(
+- name = "decode",
+- srcs = ["decode.js"],
+- suppress = [
+- "JSC_DUP_VAR_DECLARATION",
+- "JSC_USELESS_BLOCK",
+- ],
+- deps = [":polyfill"],
+-)
+-
+-load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_test")
+-
+-closure_js_test(
+- name = "all_tests",
+- srcs = ["decode_test.js"],
+- deps = [
+- ":decode",
+- ":polyfill",
+- "@io_bazel_rules_closure//closure/library:testing",
+- ],
+-)
+
+
+
+--- deps/brotli/research/BUILD
++++ /dev/null
+@@ -1,29 +0,0 @@
+-# Description: brotli research tools.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-licenses(["notice"]) # MIT
+-
+-cc_library(
+- name = "dm",
+- srcs = ["deorummolae.cc"],
+- hdrs = [
+- "deorummolae.h",
+- "esaxx/sais.hxx",
+- ],
+-)
+-
+-cc_library(
+- name = "sieve",
+- srcs = ["sieve.cc"],
+- hdrs = ["sieve.h"],
+-)
+-
+-cc_binary(
+- name = "dictionary_generator",
+- srcs = ["dictionary_generator.cc"],
+- deps = [
+- ":dm",
+- ":sieve",
+- ],
+-)
diff --git a/bazel/iconv.BUILD b/bazel/iconv.BUILD
new file mode 100644
index 00000000..02403be1
--- /dev/null
+++ b/bazel/iconv.BUILD
@@ -0,0 +1,27 @@
+load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
+
+package(default_visibility = ["//visibility:public"])
+
+filegroup(
+ name = "all_srcs",
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+configure_make(
+ name = "iconv",
+ configure_in_place = True,
+ configure_options = [
+ "--enable-static",
+ "--enable-shared=no",
+ ],
+ env = select({
+ # https://github.com/bazelbuild/rules_foreign_cc/issues/947#issuecomment-1208960469
+ "@platforms//os:macos": {
+ "AR": "",
+ },
+ "//conditions:default": {},
+ }),
+ lib_source = ":all_srcs",
+ out_static_libs = ["libiconv.a"],
+)
diff --git a/bazel/icu/BUILD b/bazel/icu/BUILD
new file mode 100644
index 00000000..d915096d
--- /dev/null
+++ b/bazel/icu/BUILD
@@ -0,0 +1,30 @@
+load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
+
+package(default_visibility = ["//visibility:public"])
+
+filegroup(
+ name = "all_srcs",
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+configure_make(
+ name = "icu",
+ args = ["-j8"],
+ configure_command = "icu4c/source/runConfigureICU",
+ configure_options = select({
+ "@platforms//os:linux": ["Linux"],
+ "@platforms//os:macos": ["MacOSX"],
+ }) + [
+ "--enable-static",
+ "--disable-shared",
+ ],
+ lib_source = ":all_srcs",
+ out_static_libs = [
+ "libicui18n.a",
+ "libicutu.a",
+ "libicuuc.a",
+ "libicudata.a",
+ "libicuio.a",
+ ],
+)
diff --git a/bazel/icu/icu.patch b/bazel/icu/icu.patch
new file mode 100644
index 00000000..a195a643
--- /dev/null
+++ b/bazel/icu/icu.patch
@@ -0,0 +1,1595 @@
+
+
+
+--- icu4c/source/common/BUILD.bazel
++++ /dev/null
+@@ -1,1213 +0,0 @@
+-# © 2021 and later: Unicode, Inc. and others.
+-# License & terms of use: http://www.unicode.org/copyright.html
+-
+-# This file defines Bazel targets for a subset of ICU4C "common" library header and source files.
+-# The configuration of dependencies among targets is strongly assisted by the
+-# file in depstest that maintains such information, at
+-# icu4c/source/test/depstest/dependencies.txt .
+-
+-load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
+-
+-package(
+- default_visibility = ["//visibility:public"],
+-)
+-
+-# When compiling code in the `common` dir, the constant
+-# `U_COMMON_IMPLEMENTATION` needs to be defined. See
+-# https://unicode-org.github.io/icu/userguide/howtouseicu#c-with-your-own-build-system .
+-
+-# If linker errors occur, then this may be a sign that the dependencies were
+-# not specified correctly. Use dependencies.txt in depstest for assistance. See
+-# https://stackoverflow.com/q/66111709/2077918 .
+-
+-cc_library(
+- name = "headers",
+- hdrs = glob([
+- "unicode/*.h", # public
+- "*.h", # internal
+- ],
+- # Instead of using these checked-in files, our Bazel build process
+- # regenerates them and then uses the new versions.
+- # Same list of .h files as in icu4c/source/data/unidata/clean.sh.
+- exclude = ["norm2_nfc_data.h", "propname_data.h", "*_props_data.h"],
+- ),
+- # We need to add includes in order to preserve existing source files'
+- # include directives that use traditional paths, not paths relative to
+- # Bazel workspace:
+- # https://stackoverflow.com/a/65635893/2077918
+- includes = ["."],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "platform",
+- srcs = [
+- "cmemory.cpp",
+- "uobject.cpp",
+- "cstring.cpp",
+- "cwchar.cpp",
+- "uinvchar.cpp",
+- "charstr.cpp",
+- "unistr.cpp",
+- "appendable.cpp",
+- "stringpiece.cpp",
+- "ustrtrns.cpp",
+- "ustring.cpp",
+- "ustrfmt.cpp",
+- "utf_impl.cpp",
+- "putil.cpp",
+- "ucln_cmn.cpp",
+- "udataswp.cpp",
+- "umath.cpp",
+- "umutex.cpp",
+- "sharedobject.cpp",
+- "utrace.cpp",
+- ],
+- deps = [
+- ":headers",
+- # omit other deps b/c they are sys symbols
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+- linkopts = ["-ldl"],
+-)
+-
+-cc_library(
+- name = "utrie",
+- srcs = ["utrie.cpp"],
+- deps = [":platform"],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "utrie2",
+- srcs = ["utrie2.cpp"],
+- deps = [":platform"],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "utrie2_builder",
+- srcs = ["utrie2_builder.cpp"],
+- deps = [
+- ":utrie",
+- ":utrie2",
+- ":platform",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "ucptrie",
+- srcs = ["ucptrie.cpp"],
+- deps = [":platform"],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "umutablecptrie",
+- srcs = ["umutablecptrie.cpp"],
+- deps = [":ucptrie"],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "bytestrie",
+- srcs = ["bytestrie.cpp"],
+- deps = [":platform"],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "bytestriebuilder",
+- srcs = ["bytestriebuilder.cpp"],
+- deps = [
+- ":bytestrie",
+- ":stringtriebuilder",
+- ":sort",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "stringtriebuilder",
+- srcs = ["stringtriebuilder.cpp"],
+- deps = [
+- ":uhash",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uhash",
+- hdrs = [
+- "uhash.h",
+- ],
+- srcs = [
+- "uhash.cpp",
+- ],
+- deps = [
+- ":headers",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "errorcode",
+- hdrs = [
+- ],
+- srcs = [
+- "errorcode.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":platform",
+- ":utypes",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "utypes",
+- srcs = [
+- "utypes.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uniset",
+- srcs = [
+- "uniset.cpp",
+- "unifilt.cpp",
+- "unisetspan.cpp",
+- "bmpset.cpp",
+- "util.cpp",
+- "unifunct.cpp",
+- "usetiter.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":patternprops",
+- ":uvector",
+- ":headers",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "patternprops",
+- srcs = [
+- "patternprops.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "propsvec",
+- srcs = [
+- "propsvec.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":sort",
+- ":utrie2_builder",
+- ":headers",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "propname",
+- srcs = [
+- "propname.cpp",
+- "propname_data.h",
+- ],
+- includes = ["."],
+- deps = [
+- ":bytestrie",
+- ":headers",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-# Note: The cc_library target names "uvector32" and "uvector64" match the
+-# dependencies.txt group names, but the filenames are "uvectr32.*"/"uvectr64.*".
+-cc_library(
+- name = "uvector32",
+- srcs = [
+- "uvectr32.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":platform",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uvector64",
+- srcs = [
+- "uvectr64.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":platform",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "sort",
+- srcs = [
+- "uarrsort.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uvector",
+- srcs = [
+- "uvector.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":platform",
+- ":sort",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "breakiterator",
+- srcs = [
+- "brkiter.cpp",
+- "brkeng.cpp",
+- "dictbe.cpp",
+- "dictionarydata.cpp",
+- "filteredbrk.cpp",
+- "lstmbe.cpp",
+- "rbbi.cpp",
+- "rbbi_cache.cpp",
+- "rbbidata.cpp",
+- "rbbinode.cpp",
+- "rbbirb.cpp",
+- "rbbiscan.cpp",
+- "rbbisetb.cpp",
+- "rbbistbl.cpp",
+- "rbbitblb.cpp",
+- "ubrk.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":bytestrie",
+- ":headers",
+- ":normlzr",
+- ":resourcebundle",
+- ":schriter",
+- ":service_registration",
+- ":ucharstrie",
+- ":ucharstriebuilder",
+- ":uhash",
+- ":uniset_core",
+- ":uniset_props",
+- ":ustack",
+- ":utext",
+- ":utrie2_builder",
+- ":uvector32",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "bytesinkutil",
+- srcs = [
+- "bytesinkutil.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":bytestream",
+- ":edits",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "bytestream",
+- srcs = [
+- "bytestream.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":platform",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "canonical_iterator",
+- srcs = [
+- "caniter.cpp",
+- ],
+- deps = [
+- ":normalizer2",
+- ":usetiter",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "characterproperties",
+- srcs = [
+- "characterproperties.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":emojiprops",
+- ":ucptrie",
+- ":umutablecptrie",
+- ":uniset_core",
+- ":uprops",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "chariter",
+- srcs = [
+- "chariter.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":platform",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "edits",
+- srcs = [
+- "edits.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":icu_utility",
+- ":platform",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "filterednormalizer2",
+- srcs = [
+- "filterednormalizer2.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":normalizer2",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "hashtable",
+- srcs = [
+- "uhash_us.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":uhash",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "icu_utility",
+- srcs = [
+- "util.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":patternprops",
+- ":platform",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "loadednormalizer2",
+- srcs = [
+- "loadednormalizer2impl.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":normalizer2",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "locale_display_names",
+- srcs = [
+- "locdispnames.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":locresdata",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "locresdata",
+- srcs = [
+- "locresdata.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":resourcebundle",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "normlzr",
+- srcs = [
+- "normlzr.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":filterednormalizer2",
+- ":headers",
+- ":schriter",
+- ":uniset_props",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "parsepos",
+- srcs = [
+- "parsepos.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":platform",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "resourcebundle",
+- srcs = [
+- "localebuilder.cpp",
+- "locavailable.cpp",
+- "locbased.cpp",
+- "locid.cpp",
+- "loclikely.cpp",
+- "locmap.cpp",
+- "resbund.cpp",
+- "resource.cpp",
+- "uloc.cpp",
+- "uloc_tag.cpp",
+- "uloc_keytype.cpp",
+- "uresbund.cpp",
+- "uresdata.cpp",
+- "wintz.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":bytesinkutil",
+- ":errorcode",
+- ":headers",
+- ":propname",
+- ":sort",
+- ":stringenumeration",
+- ":ucol_swp",
+- ":udata",
+- ":uhash",
+- ":uscript_props",
+- ":uvector",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "schriter",
+- srcs = [
+- "schriter.cpp",
+- "uchriter.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":chariter",
+- ":headers",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "service_registration",
+- srcs = [
+- "locutil.cpp",
+- "serv.cpp",
+- "servlk.cpp",
+- "servlkf.cpp",
+- "servls.cpp",
+- "servnotf.cpp",
+- "servrbf.cpp",
+- "servslkf.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":hashtable",
+- ":headers",
+- ":locale_display_names",
+- ":resourcebundle",
+- ":uvector",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "stringenumeration",
+- srcs = [
+- "uenum.cpp",
+- "ustrenum.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":platform",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "ubidi_props",
+- srcs = [
+- "ubidi_props.cpp",
+- "ubidi_props_data.h",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":utrie2",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "ucase",
+- srcs = [
+- "ucase.cpp",
+- "ucase_props_data.h",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":utrie2",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uchar",
+- srcs = [
+- "uchar.cpp",
+- "uchar_props_data.h",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":utrie2",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "emojiprops",
+- srcs = [
+- "emojiprops.cpp",
+- "emojiprops.h",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":ucharstrie",
+- ":ucharstrieiterator",
+- ":ucptrie",
+- ":udata",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "ucharstrie",
+- srcs = [
+- "ucharstrie.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":platform",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "ucharstriebuilder",
+- srcs = [
+- "ucharstriebuilder.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":sort",
+- ":stringtriebuilder",
+- ":ucharstrie",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "ucharstrieiterator",
+- srcs = [
+- "ucharstrieiterator.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":ucharstrie",
+- ":uvector32",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "ucol_swp",
+- srcs = [
+- "ucol_swp.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":utrie_swap",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "udata",
+- srcs = [
+- "restrace.cpp",
+- "ucmndata.cpp",
+- "udata.cpp",
+- "udatamem.cpp",
+- "umapfile.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":icu_utility",
+- ":platform",
+- ":uhash",
+- "//icu4c/source/stubdata",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uiter",
+- srcs = [
+- "uiter.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":platform",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "ulist",
+- srcs = [
+- "ulist.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":platform",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "unames",
+- srcs = [
+- "unames.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":uchar",
+- ":udata",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "unifiedcache",
+- srcs = [
+- "unifiedcache.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":platform",
+- ":uhash",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uniset_core",
+- srcs = [
+- "bmpset.cpp",
+- "unifilt.cpp",
+- "unifunct.cpp",
+- "uniset.cpp",
+- "unisetspan.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":icu_utility",
+- ":patternprops",
+- ":uvector",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uniset_closure",
+- srcs = [
+- "uniset_closure.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":uniset_core",
+- ":unistr_case_locale",
+- ":unistr_titlecase_brkiter",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uniset_props",
+- srcs = [
+- "uniset_props.cpp",
+- "ruleiter.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":characterproperties",
+- ":headers",
+- ":parsepos",
+- ":propname",
+- ":resourcebundle",
+- ":unames",
+- ":uniset_core",
+- ":unistr_case",
+- ":uprops",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "unistr_case",
+- srcs = [
+- "unistr_case.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":ustring_case",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "unistr_case_locale",
+- srcs = [
+- "unistr_case_locale.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":unistr_case",
+- ":ustring_case_locale",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "unistr_titlecase_brkiter",
+- srcs = [
+- "unistr_titlecase_brkiter.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":ustr_titlecase_brkiter",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uprops",
+- srcs = [
+- "uprops.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":emojiprops",
+- ":loadednormalizer2",
+- ":normalizer2",
+- ":ubidi_props",
+- ":ucase",
+- ":uchar",
+- ":unistr_case",
+- ":ustring_case",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uscript_props",
+- srcs = [
+- "uscript_props.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":platform",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uset",
+- srcs = [
+- "uset.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":platform",
+- ":uniset_core",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uset_props",
+- srcs = [
+- "uset_props.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":uniset_closure",
+- ":uniset_core",
+- ":uniset_props",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "usetiter",
+- srcs = [
+- "usetiter.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":platform",
+- ":uniset_core",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "ustack",
+- srcs = [
+- "ustack.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":uvector",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "ustr_titlecase_brkiter",
+- srcs = [
+- "ustr_titlecase_brkiter.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":breakiterator",
+- ":headers",
+- ":ucase",
+- ":ustring_case_locale",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "ustring_case",
+- srcs = [
+- "ustrcase.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":ucase",
+- ":uchar",
+- ":edits",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "ustring_case_locale",
+- srcs = [
+- "ustrcase_locale.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":resourcebundle",
+- ":ustring_case",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "utext",
+- srcs = [
+- "utext.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":ucase",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "utrie_swap",
+- srcs = [
+- "utrie_swap.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":udata",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+-
+-# This target depends on a header file that contains NFC/NFD normalization data.
+-# This header file is generated by a script (generate.sh) that invokes the gennorm2 binary.
+-# See the Unicode update change log (changes.txt).
+-cc_library(
+- name = "normalizer2",
+- srcs = [
+- "norm2_nfc_data.h", # generated by gennorm2
+- "normalizer2.cpp",
+- "normalizer2impl.cpp",
+- ],
+- includes = ["."],
+- hdrs = [
+- "normalizer2impl.h",
+- ],
+- deps = [
+- ":headers",
+- ],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+
+
+
+--- icu4c/source/data/unidata/norm2/BUILD.bazel
++++ /dev/null
+@@ -1,13 +0,0 @@
+-# © 2021 and later: Unicode, Inc. and others.
+-# License & terms of use: http://www.unicode.org/copyright.html
+-
+-# This Bazel build file is needed to declare targets for the files used as
+-# inputs to binary executables that are a part of other Bazel genrule targets.
+-
+-package(
+- default_visibility = ["//visibility:public"],
+-)
+-
+-exports_files([
+- "nfc.txt", "nfkc.txt", "nfkc_cf.txt", "uts46.txt",
+-])
+
+
+
+--- icu4c/source/i18n/BUILD.bazel
++++ /dev/null
+@@ -1,130 +0,0 @@
+-# © 2021 and later: Unicode, Inc. and others.
+-# License & terms of use: http://www.unicode.org/copyright.html
+-
+-# This file defines Bazel targets for a subset of the ICU4C "i18n" library header and source files.
+-# The configuration of dependencies among targets is strongly assisted by the
+-# file in depstest that maintains such information, at
+-# icu4c/source/test/depstest/dependencies.txt .
+-
+-load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
+-
+-package(
+- default_visibility = ["//visibility:public"],
+-)
+-
+-# When compiling code in the `common` dir, the constant
+-# `U_I18n_IMPLEMENTATION` needs to be defined. See
+-# https://unicode-org.github.io/icu/userguide/howtouseicu#c-with-your-own-build-system .
+-
+-# If linker errors occur, then this may be a sign that the dependencies were
+-# not specified correctly. Use dependencies.txt in depstest for assistance. See
+-# https://stackoverflow.com/q/66111709/2077918 .
+-
+-cc_library(
+- name = "headers",
+- hdrs = glob([
+- "unicode/*.h", # public
+- "*.h", # internal
+- ]),
+- # We need to add includes in order to preserve existing source files'
+- # include directives that use traditional paths, not paths relative to
+- # Bazel workspace:
+- # https://stackoverflow.com/a/65635893/2077918
+- includes = ["."],
+- local_defines = [
+- "U_I18N_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "collation",
+- srcs = [
+- "bocsu.cpp",
+- "coleitr.cpp",
+- "coll.cpp",
+- "collation.cpp",
+- "collationcompare.cpp",
+- "collationdata.cpp",
+- "collationdatareader.cpp",
+- "collationdatawriter.cpp",
+- "collationfastlatin.cpp",
+- # collationfcd.cpp is generated by genuca;
+- # probably hard to build genuca without depending on the old version.
+- "collationfcd.cpp",
+- "collationiterator.cpp",
+- "collationkeys.cpp",
+- "collationroot.cpp",
+- "collationrootelements.cpp",
+- "collationsets.cpp",
+- "collationsettings.cpp",
+- "collationtailoring.cpp",
+- "rulebasedcollator.cpp",
+- "sortkey.cpp",
+- "ucol.cpp",
+- "ucol_res.cpp",
+- "ucol_sit.cpp",
+- "ucoleitr.cpp",
+- "uitercollationiterator.cpp",
+- "utf16collationiterator.cpp",
+- "utf8collationiterator.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":headers",
+- ":uclean_i18n",
+- "//icu4c/source/common:bytestream",
+- "//icu4c/source/common:normalizer2",
+- "//icu4c/source/common:platform",
+- "//icu4c/source/common:propname",
+- "//icu4c/source/common:resourcebundle",
+- "//icu4c/source/common:service_registration",
+- "//icu4c/source/common:ucharstrieiterator",
+- "//icu4c/source/common:uiter",
+- "//icu4c/source/common:ulist",
+- "//icu4c/source/common:unifiedcache",
+- "//icu4c/source/common:uset",
+- "//icu4c/source/common:usetiter",
+- "//icu4c/source/common:utrie2",
+- "//icu4c/source/common:uvector32",
+- "//icu4c/source/common:uvector64",
+- ],
+- local_defines = [
+- "U_I18N_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "collation_builder",
+- srcs = [
+- "collationbuilder.cpp",
+- "collationdatabuilder.cpp",
+- "collationfastlatinbuilder.cpp",
+- "collationruleparser.cpp",
+- "collationweights.cpp",
+- ],
+- includes = ["."],
+- deps = [
+- ":collation",
+- "//icu4c/source/common:canonical_iterator",
+- "//icu4c/source/common:ucharstriebuilder",
+- "//icu4c/source/common:uset_props"
+- ],
+- local_defines = [
+- "U_I18N_IMPLEMENTATION",
+- ],
+-)
+-
+-cc_library(
+- name = "uclean_i18n",
+- srcs = [
+- "ucln_in.cpp",
+- ],
+- hdrs = ["ucln_in.h"],
+- includes = ["."],
+- deps = [
+- "//icu4c/source/common:platform",
+- ],
+- local_defines = [
+- "U_I18N_IMPLEMENTATION",
+- ],
+-)
+
+
+--- icu4c/source/icudefs.mk.in
++++ icu4c/source/icudefs.mk.in
+@@ -116,8 +116,8 @@ ENABLE_RELEASE = @ENABLE_RELEASE@
+ EXEEXT = @EXEEXT@
+ CC = @CC@
+ CXX = @CXX@
+-AR = @AR@
+-ARFLAGS = @ARFLAGS@ r
++AR = ar
++ARFLAGS = r
+ RANLIB = @RANLIB@
+ COMPILE_LINK_ENVVAR = @COMPILE_LINK_ENVVAR@
+ UCLN_NO_AUTO_CLEANUP = @UCLN_NO_AUTO_CLEANUP@
+
+
+
+--- icu4c/source/stubdata/BUILD.bazel
++++ /dev/null
+@@ -1,23 +0,0 @@
+-# © 2021 and later: Unicode, Inc. and others.
+-# License & terms of use: http://www.unicode.org/copyright.html
+-
+-# This file defines Bazel targets for the ICU4C "stubdata" library header and source files.
+-
+-load("@rules_cc//cc:defs.bzl", "cc_library")
+-
+-package(
+- default_visibility = ["//visibility:public"],
+-)
+-
+-# When compiling code in the `common` dir, the constant
+-# `U_COMMON_IMPLEMENTATION` needs to be defined. See
+-# https://unicode-org.github.io/icu/userguide/howtouseicu#c-with-your-own-build-system .
+-
+-cc_library(
+- name = "stubdata",
+- srcs = ["stubdata.cpp"],
+- deps = ["//icu4c/source/common:headers"],
+- local_defines = [
+- "U_COMMON_IMPLEMENTATION",
+- ],
+-)
+
+
+
+--- icu4c/source/tools/gennorm2/BUILD.bazel
++++ /dev/null
+@@ -1,39 +0,0 @@
+-# © 2021 and later: Unicode, Inc. and others.
+-# License & terms of use: http://www.unicode.org/copyright.html
+-
+-# This Bazel build file defines a target for the gennorm2 binary that generates
+-# headers needed for bootstrapping the ICU4C build process in a way that
+-# integrates the normalization data.
+-
+-load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
+-
+-package(
+- default_visibility = ["//visibility:public"],
+-)
+-
+-cc_binary(
+- name = "gennorm2",
+- srcs = glob([
+- "*.c",
+- "*.cpp",
+- "*.h", # cannot have hdrs section in cc_binary
+- ]),
+- deps = [
+- "//icu4c/source/common:uhash",
+- "//icu4c/source/common:umutablecptrie",
+- "//icu4c/source/common:ucptrie",
+- "//icu4c/source/common:errorcode",
+- "//icu4c/source/common:uniset",
+- "//icu4c/source/common:uvector32",
+-
+- "//icu4c/source/common:platform",
+- "//icu4c/source/common:headers",
+-
+- "//icu4c/source/tools/toolutil:toolutil",
+- "//icu4c/source/tools/toolutil:unewdata",
+- "//icu4c/source/tools/toolutil:writesrc",
+- "//icu4c/source/tools/toolutil:uoptions",
+- "//icu4c/source/tools/toolutil:uparse",
+- ],
+- linkopts = ["-pthread"],
+-)
+
+
+
+--- icu4c/source/tools/toolutil/BUILD.bazel
++++ /dev/null
+@@ -1,126 +0,0 @@
+-# © 2021 and later: Unicode, Inc. and others.
+-# License & terms of use: http://www.unicode.org/copyright.html
+-
+-# This Bazel build file defines targets that are dependencies for building
+-# the gennorm2 and genprops binaries.
+-
+-load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
+-
+-package(
+- default_visibility = ["//visibility:public"],
+-)
+-
+-cc_library(
+- name = "toolutil",
+- includes = ["."],
+- hdrs = ["toolutil.h"],
+- srcs = ["toolutil.cpp"],
+- local_defines = [
+- "U_TOOLUTIL_IMPLEMENTATION",
+- ],
+- deps = ["//icu4c/source/common:platform"],
+-)
+-
+-cc_library(
+- name = "unewdata",
+- includes = ["."],
+- hdrs = ["unewdata.h"],
+- srcs = ["unewdata.cpp"],
+- local_defines = [
+- "U_TOOLUTIL_IMPLEMENTATION",
+- ],
+- deps = [
+- ":filestrm",
+- "//icu4c/source/common:platform",
+- ],
+-)
+-
+-cc_library(
+- name = "uoptions",
+- includes = ["."],
+- hdrs = ["uoptions.h"],
+- srcs = ["uoptions.cpp"],
+- local_defines = [
+- "U_TOOLUTIL_IMPLEMENTATION",
+- ],
+- deps = ["//icu4c/source/common:platform"],
+-)
+-
+-cc_library(
+- name = "writesrc",
+- includes = ["."],
+- hdrs = ["writesrc.h"],
+- srcs = ["writesrc.cpp"],
+- local_defines = [
+- "U_TOOLUTIL_IMPLEMENTATION",
+- ],
+- deps = [
+- "//icu4c/source/common:bytestream",
+- "//icu4c/source/common:platform",
+- "//icu4c/source/common:uniset_core",
+- ],
+-)
+-
+-cc_library(
+- name = "uparse",
+- includes = ["."],
+- hdrs = ["uparse.h"],
+- srcs = ["uparse.cpp"],
+- local_defines = [
+- "U_TOOLUTIL_IMPLEMENTATION",
+- ],
+- deps = [
+- ":filestrm",
+- "//icu4c/source/common:platform",
+- ],
+-)
+-
+-cc_library(
+- name = "filestrm",
+- includes = ["."],
+- hdrs = ["filestrm.h"],
+- srcs = ["filestrm.cpp"],
+- local_defines = [
+- "U_TOOLUTIL_IMPLEMENTATION",
+- ],
+- deps = ["//icu4c/source/common:platform"],
+-)
+-
+-cc_library(
+- name = "ppucd",
+- includes = ["."],
+- hdrs = ["ppucd.h"],
+- srcs = ["ppucd.cpp"],
+- local_defines = [
+- "U_TOOLUTIL_IMPLEMENTATION",
+- ],
+- deps = [
+- ":uparse",
+- "//icu4c/source/common:platform",
+- ],
+-)
+-
+-cc_library(
+- name = "denseranges",
+- includes = ["."],
+- hdrs = ["denseranges.h"],
+- srcs = ["denseranges.cpp"],
+- local_defines = [
+- "U_TOOLUTIL_IMPLEMENTATION",
+- ],
+- deps = ["//icu4c/source/common:platform"],
+-)
+-
+-cc_library(
+- name = "collationinfo",
+- includes = ["."],
+- hdrs = ["collationinfo.h"],
+- srcs = ["collationinfo.cpp"],
+- local_defines = [
+- "U_TOOLUTIL_IMPLEMENTATION",
+- ],
+- deps = [
+- "//icu4c/source/common:platform",
+- "//icu4c/source/i18n:headers",
+- ],
+-)
diff --git a/bazel/jemalloc.BUILD b/bazel/jemalloc.BUILD
new file mode 100644
index 00000000..7bc067c4
--- /dev/null
+++ b/bazel/jemalloc.BUILD
@@ -0,0 +1,24 @@
+load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
+
+package(default_visibility = ["//visibility:public"])
+
+filegroup(
+ name = "all_srcs",
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+configure_make(
+ name = "jemalloc",
+ args = ["-j8"],
+ env = select({
+ # https://github.com/bazelbuild/rules_foreign_cc/issues/947#issuecomment-1208960469
+ "@platforms//os:macos": {
+ "AR": "",
+ },
+ "//conditions:default": {},
+ }),
+ lib_source = ":all_srcs",
+ out_include_dir = "include/jemalloc",
+ out_static_libs = ["libjemalloc.a"],
+)
diff --git a/bazel/kakasi.BUILD b/bazel/kakasi.BUILD
new file mode 100644
index 00000000..6e3037a7
--- /dev/null
+++ b/bazel/kakasi.BUILD
@@ -0,0 +1,35 @@
+load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
+
+filegroup(
+ name = "all_srcs",
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "kakasi_data",
+ srcs = ["data/japanese_data.cpp"],
+ hdrs = ["data/japanese_data.h"],
+ includes = ["data"],
+ visibility = ["//visibility:public"],
+)
+
+configure_make(
+ name = "kakasi",
+ configure_in_place = True,
+ configure_options = ["--enable-shared=no"],
+ env = select({
+ # https://github.com/bazelbuild/rules_foreign_cc/issues/947#issuecomment-1208960469
+ "@platforms//os:macos": {
+ "AR": "",
+ },
+ "//conditions:default": {},
+ }),
+ lib_source = "@kakasi//:all_srcs",
+ out_static_libs = ["libkakasi.a"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@iconv",
+ "@kakasi//:kakasi_data",
+ ],
+)
diff --git a/bazel/klib/BUILD b/bazel/klib/BUILD
new file mode 100644
index 00000000..781c98c9
--- /dev/null
+++ b/bazel/klib/BUILD
@@ -0,0 +1,7 @@
+package(default_visibility = ["//visibility:public"])
+
+cc_library(
+ name = "klib",
+ hdrs = ["khash.h"],
+ includes = ["."],
+)
diff --git a/bazel/leveldb/BUILD.bazel b/bazel/leveldb/BUILD.bazel
new file mode 100644
index 00000000..ea0c1091
--- /dev/null
+++ b/bazel/leveldb/BUILD.bazel
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+exports_files(
+ [
+ "port_config.h",
+ "port.h",
+ ],
+)
diff --git a/bazel/leveldb/leveldb.BUILD b/bazel/leveldb/leveldb.BUILD
new file mode 100644
index 00000000..a7f9c78c
--- /dev/null
+++ b/bazel/leveldb/leveldb.BUILD
@@ -0,0 +1,72 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("@rules_cc//cc:defs.bzl", "cc_library")
+load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
+
+copy_file(
+ name = "port_config_h",
+ src = "@//bazel/leveldb:port_config.h",
+ out = "port/port_config.h",
+ allow_symlink = True,
+)
+
+copy_file(
+ name = "port_h",
+ src = "@//bazel/leveldb:port.h",
+ out = "port/port.h",
+ allow_symlink = True,
+)
+
+cc_library(
+ name = "leveldb",
+ srcs = glob(
+ [
+ "db/**/*.cc",
+ "db/**/*.h",
+ "helpers/**/*.cc",
+ "helpers/**/*.h",
+ "port/**/*.cc",
+ "port/**/*.h",
+ "table/**/*.cc",
+ "table/**/*.h",
+ "util/**/*.cc",
+ "util/**/*.h",
+ ],
+ exclude = [
+ "**/*_test.cc",
+ "**/testutil.*",
+ "**/*_bench.cc",
+ "**/*_windows*",
+ "db/leveldbutil.cc",
+ ],
+ ),
+ hdrs = glob(
+ ["include/**/*.h"],
+ exclude = ["doc/**"],
+ ) + [
+ ":port_h",
+ ":port_config_h",
+ ],
+ includes = [
+ ".",
+ "include",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@com_github_google_crc32c//:crc32c",
+ "@com_github_google_snappy//:snappy",
+ ],
+)
diff --git a/bazel/leveldb/port.h b/bazel/leveldb/port.h
new file mode 100644
index 00000000..8c9a4eaf
--- /dev/null
+++ b/bazel/leveldb/port.h
@@ -0,0 +1,34 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file. See the AUTHORS file for names of contributors.
+
+#ifndef STORAGE_LEVELDB_PORT_PORT_H_
+#define STORAGE_LEVELDB_PORT_PORT_H_
+
+#include <string.h>
+
+#define LEVELDB_HAS_PORT_CONFIG_H 1
+
+// Include the appropriate platform specific file below. If you are
+// porting to a new platform, see "port_example.h" for documentation
+// of what the new port_<platform>.h file must provide.
+#include "port/port_stdcxx.h"
+
+#endif // STORAGE_LEVELDB_PORT_PORT_H_
diff --git a/bazel/leveldb/port_config.h b/bazel/leveldb/port_config.h
new file mode 100644
index 00000000..4ccdebfb
--- /dev/null
+++ b/bazel/leveldb/port_config.h
@@ -0,0 +1,38 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// Copyright 2017 The LevelDB Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file. See the AUTHORS file for names of contributors.
+
+#ifndef STORAGE_LEVELDB_PORT_PORT_CONFIG_H_
+#define STORAGE_LEVELDB_PORT_PORT_CONFIG_H_
+
+// Define to 1 if you have a definition for fdatasync() in <unistd.h>.
+#define HAVE_FUNC_FDATASYNC 1
+
+// Define to 1 if you have Google CRC32C.
+#define HAVE_CRC32C 1
+
+// Define to 1 if you have Google Snappy.
+#define HAVE_SNAPPY 1
+
+// Define to 1 if your processor stores words with the most significant byte
+// first (like Motorola and SPARC, unlike Intel and VAX).
+#define LEVELDB_IS_BIG_ENDIAN 0
+
+#endif // STORAGE_LEVELDB_PORT_PORT_CONFIG_H_
diff --git a/bazel/libart.BUILD b/bazel/libart.BUILD
new file mode 100644
index 00000000..9a382e87
--- /dev/null
+++ b/bazel/libart.BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//visibility:public"])
+
+filegroup(
+ name = "data",
+ srcs = glob([ "**/*.txt" ]),
+)
diff --git a/bazel/libfor.BUILD b/bazel/libfor.BUILD
new file mode 100644
index 00000000..b6ffd383
--- /dev/null
+++ b/bazel/libfor.BUILD
@@ -0,0 +1,22 @@
+package(default_visibility = ["//visibility:public"])
+
+genrule(
+ name = "gen_for-gen.c",
+ srcs = [ "//:gen.pl" ],
+ outs = [ "for-gen.c" ],
+ cmd = "perl $< > $@",
+)
+
+cc_library(
+ name = "for_gen",
+ hdrs = [ ":gen_for-gen.c" ],
+)
+
+cc_library(
+ name = "for",
+ srcs = [ "for.c" ],
+ hdrs = [ "for.h" ],
+ include_prefix = "third_party/libfor",
+ includes = [ "." ],
+ deps = [ ":for_gen" ],
+)
diff --git a/bazel/lrucache.BUILD b/bazel/lrucache.BUILD
new file mode 100644
index 00000000..d7e9143d
--- /dev/null
+++ b/bazel/lrucache.BUILD
@@ -0,0 +1,9 @@
+load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
+
+package(default_visibility = ["//visibility:public"])
+
+cc_library(
+ name = "lrucache",
+ hdrs = glob(["include/**/*.hpp"]),
+ includes = ["include"],
+)
diff --git a/bazel/openssl3.BUILD b/bazel/openssl3.BUILD
new file mode 100644
index 00000000..717c9527
--- /dev/null
+++ b/bazel/openssl3.BUILD
@@ -0,0 +1,62 @@
+load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
+
+filegroup(
+ name = "all_srcs",
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+configure_make(
+ name = "openssl",
+ configure_command = "config",
+ configure_in_place = True,
+ configure_options = [
+ "enable-rfc3779",
+ "enable-cms",
+ "enable-ec_nistp_64_gcc_128",
+ "--libdir=lib",
+ "no-shared",
+ "--with-zlib-include=$$EXT_BUILD_DEPS$$",
+ "--with-zlib-lib=$$EXT_BUILD_DEPS$$",
+ # https://stackoverflow.com/questions/36220341/struct-in6-addr-has-no-member-named-s6-addr32-with-ansi
+ "-D_DEFAULT_SOURCE=1",
+ "-DPEDANTIC",
+ ],
+ env = select({
+ "@platforms//os:macos": {
+ "AR": "",
+ "PERL": "$$EXT_BUILD_ROOT$$/$(PERL)",
+ },
+ "//conditions:default": {
+ "PERL": "$$EXT_BUILD_ROOT$$/$(PERL)",
+ },
+ }),
+ lib_name = "openssl",
+ lib_source = ":all_srcs",
+ out_lib_dir = "../openssl.build_tmpdir/openssl/lib",
+ out_static_libs = [
+ "libssl.a",
+ "libcrypto.a",
+ ],
+ targets = [
+ "build_libs",
+ "install_dev",
+ ],
+ toolchains = ["@rules_perl//:current_toolchain"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@com_github_madler_zlib//:zlib",
+ ],
+)
+
+alias(
+ name = "crypto",
+ actual = "openssl",
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "ssl",
+ actual = "openssl",
+ visibility = ["//visibility:public"],
+)
diff --git a/bazel/picotls_openssl/0001.patch b/bazel/picotls_openssl/0001.patch
new file mode 100644
index 00000000..61eb8416
--- /dev/null
+++ b/bazel/picotls_openssl/0001.patch
@@ -0,0 +1,24 @@
+
+
+--- lib/picotls.c
++++ lib/picotls.c
+@@ -1282,7 +1282,7 @@ static int commission_handshake_secret(ptls_t *tls)
+ static void log_client_random(ptls_t *tls)
+ {
+ PTLS_PROBE(CLIENT_RANDOM, tls,
+- ptls_hexdump(alloca(sizeof(tls->client_random) * 2 + 1), tls->client_random, sizeof(tls->client_random)));
++ ptls_hexdump(__builtin_alloca(sizeof(tls->client_random) * 2 + 1), tls->client_random, sizeof(tls->client_random)));
+ }
+
+ #define SESSION_IDENTIFIER_MAGIC "ptls0001" /* the number should be changed upon incompatible format change */
+@@ -3894,7 +3894,7 @@ static int server_handle_hello(ptls_t *tls, ptls_message_emitter_t *emitter, ptl
+
+ /* use cookie to check the integrity of the handshake, and update the context */
+ size_t sigsize = tls->ctx->cipher_suites[0]->hash->digest_size;
+- uint8_t *sig = alloca(sigsize);
++ uint8_t *sig = __builtin_alloca(sigsize);
+ if ((ret = calc_cookie_signature(tls, properties, key_share.algorithm, ch->cookie.tbs, sig)) != 0)
+ goto Exit;
+ if (!(ch->cookie.signature.len == sigsize && ptls_mem_equal(ch->cookie.signature.base, sig, sigsize))) {
+
+
diff --git a/bazel/picotls_openssl/BUILD b/bazel/picotls_openssl/BUILD
new file mode 100644
index 00000000..15a77bdd
--- /dev/null
+++ b/bazel/picotls_openssl/BUILD
@@ -0,0 +1,18 @@
+package(default_visibility = ["//visibility:public"])
+
+cc_library(
+ name = "picotls_openssl",
+ srcs = [
+ "lib/openssl.c",
+ "lib/pembase64.c",
+ "lib/picotls.c",
+ ],
+ hdrs = glob(["include/**/*.h"]),
+ copts = [
+ "-std=c99",
+ ],
+ includes = ["include"],
+ deps = [
+ "@openssl",
+ ],
+)
diff --git a/bazel/quicly/0001.patch b/bazel/quicly/0001.patch
new file mode 100644
index 00000000..8de20bbd
--- /dev/null
+++ b/bazel/quicly/0001.patch
@@ -0,0 +1,16 @@
+
+
+--- include/quicly/loss.h
++++ include/quicly/loss.h
+@@ -250,8 +250,8 @@ inline void quicly_loss_init(quicly_loss_t *r, const quicly_loss_conf_t *conf, u
+ *r = (quicly_loss_t){.conf = conf,
+ .max_ack_delay = max_ack_delay,
+ .ack_delay_exponent = ack_delay_exponent,
+- .pto_count = 0,
+ .thresholds = {.use_packet_based = 1, .time_based_percentile = 1024 / 8 /* start from 1/8 RTT */},
++ .pto_count = 0,
+ .time_of_last_packet_sent = 0,
+ .largest_acked_packet_plus1 = {0},
+ .total_bytes_sent = 0,
+
+
diff --git a/bazel/quicly/BUILD b/bazel/quicly/BUILD
new file mode 100644
index 00000000..182e8758
--- /dev/null
+++ b/bazel/quicly/BUILD
@@ -0,0 +1,33 @@
+package(default_visibility = ["//visibility:public"])
+
+cc_library(
+ name = "quicly",
+ srcs = [
+ "lib/cc-cubic.c",
+ "lib/cc-pico.c",
+ "lib/cc-reno.c",
+ "lib/defaults.c",
+ "lib/frame.c",
+ "lib/local_cid.c",
+ "lib/loss.c",
+ "lib/quicly.c",
+ "lib/ranges.c",
+ "lib/rate.c",
+ "lib/recvstate.c",
+ "lib/remote_cid.c",
+ "lib/retire_cid.c",
+ "lib/sendstate.c",
+ "lib/sentmap.c",
+ "lib/streambuf.c",
+ ],
+ hdrs = glob(["include/**/*.h"]),
+ copts = [
+ "-std=c99",
+ ],
+ includes = ["include"],
+ linkopts = ["-lm"],
+ deps = [
+ "@klib",
+ "@picotls_openssl",
+ ],
+)
diff --git a/bazel/rocksdb.BUILD b/bazel/rocksdb.BUILD
new file mode 100644
index 00000000..39b128d3
--- /dev/null
+++ b/bazel/rocksdb.BUILD
@@ -0,0 +1,41 @@
+load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
+
+package(default_visibility = ["//visibility:public"])
+
+filegroup(
+ name = "all_srcs",
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+CMAKE_CACHE_ENTRIES = {
+ "BUILD_SHARED_LIBS": "OFF",
+ "CMAKE_BUILD_TYPE": "Release",
+}
+
+CMAKE_MACOS_CACHE_ENTRIES = dict(CMAKE_CACHE_ENTRIES.items() + {}.items())
+
+CMAKE_LINUX_CACHE_ENTRIES = dict(CMAKE_CACHE_ENTRIES.items() + {
+ "CMAKE_C_FLAGS": "-fPIC",
+}.items())
+
+cmake(
+ name = "rocksdb",
+ build_args = ["-j8"],
+ cache_entries = select({
+ "@platforms//os:linux": CMAKE_LINUX_CACHE_ENTRIES,
+ "@platforms//os:macos": CMAKE_MACOS_CACHE_ENTRIES,
+ "//conditions:default": CMAKE_CACHE_ENTRIES,
+ }),
+ generate_args = [
+ "-DWITH_GFLAGS=OFF",
+ "-DWITH_ALL_TESTS=OFF",
+ "-DPORTABLE=1",
+ "-DROCKSDB_BUILD_SHARED=OFF",
+ "-DWITH_TESTS=OFF",
+ "-DWITH_TOOLS=OFF",
+ "-DUSE_RTTI=1",
+ ],
+ lib_source = "//:all_srcs",
+ out_static_libs = ["librocksdb.a"],
+)
diff --git a/bazel/s2geometry/0001.patch b/bazel/s2geometry/0001.patch
new file mode 100644
index 00000000..b6045a89
--- /dev/null
+++ b/bazel/s2geometry/0001.patch
@@ -0,0 +1,30 @@
+--- CMakeLists.txt
++++ CMakeLists.txt
+@@ -211,10 +211,12 @@ add_library(s2
+ src/s2/util/math/exactfloat/exactfloat.cc
+ src/s2/util/math/mathutil.cc
+ src/s2/util/units/length-units.cc)
+-add_library(s2testing STATIC
+- src/s2/s2builderutil_testing.cc
+- src/s2/s2shapeutil_testing.cc
+- src/s2/s2testing.cc)
++
++#add_library(s2testing STATIC
++# src/s2/s2builderutil_testing.cc
++# src/s2/s2shapeutil_testing.cc
++# src/s2/s2testing.cc)
++
+ target_link_libraries(
+ s2
+ ${GFLAGS_LIBRARIES} ${GLOG_LIBRARIES} ${OPENSSL_LIBRARIES}
+@@ -425,7 +427,7 @@ install(FILES src/s2/util/math/mathutil.h
+ install(FILES src/s2/util/units/length-units.h
+ src/s2/util/units/physical-units.h
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/s2/util/units")
+-install(TARGETS s2 s2testing
++install(TARGETS s2
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+
+
diff --git a/bazel/s2geometry/BUILD b/bazel/s2geometry/BUILD
new file mode 100644
index 00000000..9abde6c3
--- /dev/null
+++ b/bazel/s2geometry/BUILD
@@ -0,0 +1,43 @@
+load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
+
+package(default_visibility = ["//visibility:public"])
+
+CMAKE_CACHE_ENTRIES = {
+ "BUILD_SHARED_LIBS": "OFF",
+ "CMAKE_BUILD_TYPE": "Release",
+ "CMAKE_USE_OPENSSL": "ON",
+ "OPENSSL_ROOT_DIR": "$$EXT_BUILD_DEPS$$/openssl",
+}
+
+CMAKE_MACOS_CACHE_ENTRIES = CMAKE_CACHE_ENTRIES
+
+CMAKE_LINUX_CACHE_ENTRIES = dict(CMAKE_CACHE_ENTRIES.items() + {
+ "CMAKE_C_FLAGS": "-fPIC",
+}.items())
+
+filegroup(
+ name = "all_srcs",
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+cmake(
+ name = "s2geometry",
+ build_args = ["-j8"],
+ cache_entries = select({
+ "@platforms//os:linux": CMAKE_LINUX_CACHE_ENTRIES,
+ "@platforms//os:macos": CMAKE_MACOS_CACHE_ENTRIES,
+ "//conditions:default": CMAKE_CACHE_ENTRIES,
+ }),
+ defines = ["S2_USE_GLOG"],
+ generate_args = [
+ "-DCMAKE_FIND_LIBRARY_SUFFIXES=.a",
+ "-DBUILD_SHARED_LIBS=OFF",
+ ],
+ lib_source = ":all_srcs",
+ out_static_libs = ["libs2.a"],
+ targets = ["s2"],
+ deps = [
+ "@openssl",
+ ],
+)
diff --git a/bazel/snappy.BUILD b/bazel/snappy.BUILD
new file mode 100644
index 00000000..9cfb1ade
--- /dev/null
+++ b/bazel/snappy.BUILD
@@ -0,0 +1,122 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Copied from https://github.com/tensorflow/tensorflow/blob/bdd8bf316e4ab7d699127d192d30eb614a158462/third_party/snappy.BUILD
+
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+cc_library(
+ name = "snappy",
+ srcs = [
+ "config.h",
+ "snappy.cc",
+ "snappy.h",
+ "snappy-internal.h",
+ "snappy-sinksource.cc",
+ "snappy-stubs-internal.cc",
+ "snappy-stubs-internal.h",
+ "snappy-stubs-public.h",
+ ],
+ hdrs = [
+ "snappy.h",
+ "snappy-sinksource.h",
+ ],
+ copts = [
+ "-DHAVE_CONFIG_H",
+ "-fno-exceptions",
+ "-Wno-sign-compare",
+ "-Wno-shift-negative-value",
+ ],
+ includes = ["."],
+ visibility = ["//visibility:public"],
+)
+
+genrule(
+ name = "config_h",
+ outs = ["config.h"],
+ cmd = "\n".join([
+ "cat <<'EOF' >$@",
+ "#define HAVE_STDDEF_H 1",
+ "#define HAVE_STDINT_H 1",
+ "",
+ "#ifdef __has_builtin",
+ "# if !defined(HAVE_BUILTIN_EXPECT) && __has_builtin(__builtin_expect)",
+ "# define HAVE_BUILTIN_EXPECT 1",
+ "# endif",
+ "# if !defined(HAVE_BUILTIN_CTZ) && __has_builtin(__builtin_ctzll)",
+ "# define HAVE_BUILTIN_CTZ 1",
+ "# endif",
+ "#elif defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 4)",
+ "# ifndef HAVE_BUILTIN_EXPECT",
+ "# define HAVE_BUILTIN_EXPECT 1",
+ "# endif",
+ "# ifndef HAVE_BUILTIN_CTZ",
+ "# define HAVE_BUILTIN_CTZ 1",
+ "# endif",
+ "#endif",
+ "",
+ "#ifdef __has_include",
+ "# if !defined(HAVE_BYTESWAP_H) && __has_include(<byteswap.h>)",
+ "# define HAVE_BYTESWAP_H 1",
+ "# endif",
+ "# if !defined(HAVE_UNISTD_H) && __has_include(<unistd.h>)",
+ "# define HAVE_UNISTD_H 1",
+ "# endif",
+ "# if !defined(HAVE_SYS_ENDIAN_H) && __has_include(<sys/endian.h>)",
+ "# define HAVE_SYS_ENDIAN_H 1",
+ "# endif",
+ "# if !defined(HAVE_SYS_MMAN_H) && __has_include(<sys/mman.h>)",
+ "# define HAVE_SYS_MMAN_H 1",
+ "# endif",
+ "# if !defined(HAVE_SYS_UIO_H) && __has_include(<sys/uio.h>)",
+ "# define HAVE_SYS_UIO_H 1",
+ "# endif",
+ "#endif",
+ "",
+ "#ifndef SNAPPY_IS_BIG_ENDIAN",
+ "# ifdef __s390x__",
+ "# define SNAPPY_IS_BIG_ENDIAN 1",
+ "# elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__",
+ "# define SNAPPY_IS_BIG_ENDIAN 1",
+ "# endif",
+ "#endif",
+ "EOF",
+ ]),
+)
+
+genrule(
+ name = "snappy_stubs_public_h",
+ srcs = ["snappy-stubs-public.h.in"],
+ outs = ["snappy-stubs-public.h"],
+ cmd = ("sed " +
+ "-e 's/$${\\(.*\\)_01}/\\1/g' " +
+ "-e 's/$${SNAPPY_MAJOR}/1/g' " +
+ "-e 's/$${SNAPPY_MINOR}/1/g' " +
+ "-e 's/$${SNAPPY_PATCHLEVEL}/7/g' " +
+ "$< >$@"),
+)
diff --git a/bazel/zlib.BUILD b/bazel/zlib.BUILD
new file mode 100644
index 00000000..d8139b63
--- /dev/null
+++ b/bazel/zlib.BUILD
@@ -0,0 +1,111 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Copyright 2008 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Copied from https://github.com/protocolbuffers/protobuf/blob/v3.9.1/third_party/zlib.BUILD
+
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+_ZLIB_HEADERS = [
+ "crc32.h",
+ "deflate.h",
+ "gzguts.h",
+ "inffast.h",
+ "inffixed.h",
+ "inflate.h",
+ "inftrees.h",
+ "trees.h",
+ "zconf.h",
+ "zlib.h",
+ "zutil.h",
+]
+
+_ZLIB_PREFIXED_HEADERS = ["zlib/include/" + hdr for hdr in _ZLIB_HEADERS]
+
+# In order to limit the damage from the `includes` propagation
+# via `:zlib`, copy the public headers to a subdirectory and
+# expose those.
+genrule(
+ name = "copy_public_headers",
+ srcs = _ZLIB_HEADERS,
+ outs = _ZLIB_PREFIXED_HEADERS,
+ cmd = "cp $(SRCS) $(@D)/zlib/include/",
+ visibility = ["//visibility:private"],
+)
+
+cc_library(
+ name = "zlib",
+ srcs = [
+ "adler32.c",
+ "compress.c",
+ "crc32.c",
+ "deflate.c",
+ "gzclose.c",
+ "gzlib.c",
+ "gzread.c",
+ "gzwrite.c",
+ "infback.c",
+ "inffast.c",
+ "inflate.c",
+ "inftrees.c",
+ "trees.c",
+ "uncompr.c",
+ "zutil.c",
+ ],
+ hdrs = _ZLIB_PREFIXED_HEADERS,
+ copts = select({
+ ":windows": [],
+ "//conditions:default": [
+ "-Wno-unused-variable",
+ "-Wno-implicit-function-declaration",
+ ],
+ }),
+ includes = ["zlib/include/"],
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "windows",
+ constraint_values = [
+ "@platforms//os:windows",
+ ],
+)
diff --git a/docker/bazel.Dockerfile b/docker/bazel.Dockerfile
new file mode 100644
index 00000000..f1e4e975
--- /dev/null
+++ b/docker/bazel.Dockerfile
@@ -0,0 +1,9 @@
+FROM gcc:12.2.0
+
+RUN apt update && apt install -y apt-transport-https curl gnupg
+RUN curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg
+RUN mv bazel-archive-keyring.gpg /usr/share/keyrings
+RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
+RUN apt update && apt install bazel
+
+# docker run -it -v ${PWD}:/typesense bazel_typesense:latest sh -c "cd /typesense && bazel build //:search //:typesense-server //:benchmark //:typesense-test"
diff --git a/include/app_metrics.h b/include/app_metrics.h
index 8606dab4..1ab2a6f9 100644
--- a/include/app_metrics.h
+++ b/include/app_metrics.h
@@ -4,6 +4,7 @@
#include "json.hpp"
#include "logger.h"
#include "config.h"
+#include <mutex>
#include <string>
#include <shared_mutex>
#include <fstream>
diff --git a/include/http_server.h b/include/http_server.h
index ba4421ac..55390ab1 100644
--- a/include/http_server.h
+++ b/include/http_server.h
@@ -235,7 +235,7 @@ private:
static int send_response(h2o_req_t *req, int status_code, const std::string & message);
- static int async_req_cb(void *ctx, h2o_iovec_t chunk, int is_end_stream);
+ static int async_req_cb(void *ctx, int is_end_stream);
static bool is_write_request(const std::string& root_resource, const std::string& http_method);
diff --git a/include/store.h b/include/store.h
index d695c9e7..bb37bf73 100644
--- a/include/store.h
+++ b/include/store.h
@@ -5,6 +5,7 @@
#include <string>
#include <sstream>
#include <memory>
+#include <mutex>
#include <thread>
#include <shared_mutex>
#include <option.h>
diff --git a/src/http_server.cpp b/src/http_server.cpp
index c6c53d36..775a8a71 100644
--- a/src/http_server.cpp
+++ b/src/http_server.cpp
@@ -507,7 +507,7 @@ int HttpServer::catch_all_handler(h2o_handler_t *_h2o_handler, h2o_req_t *req) {
req->write_req.cb = async_req_cb;
req->write_req.ctx = custom_gen;
- req->proceed_req(req, req->entity.len, H2O_SEND_STATE_IN_PROGRESS);
+ req->proceed_req(req, NULL);
}
return 0;
@@ -529,7 +529,7 @@ bool HttpServer::is_write_request(const std::string& root_resource, const std::s
return false;
}
-int HttpServer::async_req_cb(void *ctx, h2o_iovec_t chunk, int is_end_stream) {
+int HttpServer::async_req_cb(void *ctx, int is_end_stream) {
// NOTE: this callback is triggered multiple times by HTTP 2 but only once by HTTP 1
// This quirk is because of the underlying buffer/window sizes. We will have to deal with both cases.
h2o_custom_generator_t* custom_generator = static_cast<h2o_custom_generator_t*>(ctx);
@@ -537,6 +537,8 @@ int HttpServer::async_req_cb(void *ctx, h2o_iovec_t chunk, int is_end_stream) {
const std::shared_ptr<http_req>& request = custom_generator->req();
const std::shared_ptr<http_res>& response = custom_generator->res();
+ h2o_iovec_t chunk = request->_req->entity;
+
/*
LOG(INFO) << "async_req_cb, chunk.len=" << chunk.len
<< ", request->req->entity.len=" << request->req->entity.len
@@ -630,15 +632,13 @@ int HttpServer::async_req_cb(void *ctx, h2o_iovec_t chunk, int is_end_stream) {
if(request->is_http_v1) {
// http v1 callbacks fire on small chunk sizes, so fetch more to match window size of http v2 buffer
- size_t written = chunk.len;
- request->_req->proceed_req(request->_req, written, H2O_SEND_STATE_IN_PROGRESS);
+ request->_req->proceed_req(request->_req, NULL);
}
if(!async_req) {
// progress ONLY non-streaming type request body since
// streaming requests will call proceed_req in an async fashion
- size_t written = chunk.len;
- request->_req->proceed_req(request->_req, written, H2O_SEND_STATE_IN_PROGRESS);
+ request->_req->proceed_req(request->_req, NULL);
}
return 0;
@@ -987,7 +987,7 @@ bool HttpServer::on_request_proceed_message(void *data) {
req_res->req->chunk_len = 0;
if(req_res->req->_req && req_res->req->_req->proceed_req) {
- req_res->req->_req->proceed_req(req_res->req->_req, written, stream_state);
+ req_res->req->_req->proceed_req(req_res->req->_req, NULL);
}
}
diff --git a/test/art_test.cpp b/test/art_test.cpp
index ae900fcc..9c9ac9c3 100644
--- a/test/art_test.cpp
+++ b/test/art_test.cpp
@@ -8,10 +8,10 @@
#include <chrono>
#include <posting.h>
-#define words_file_path std::string(std::string(ROOT_DIR)+"/build/test_resources/words.txt").c_str()
-#define uuid_file_path std::string(std::string(ROOT_DIR)+"/build/test_resources/uuid.txt").c_str()
-#define skus_file_path std::string(std::string(ROOT_DIR)+"/test/skus.txt").c_str()
-#define ill_file_path std::string(std::string(ROOT_DIR)+"/test/ill.txt").c_str()
+#define words_file_path std::string("external/libart/tests/words.txt").c_str()
+#define uuid_file_path std::string("external/libart/tests/uuid.txt").c_str()
+#define skus_file_path std::string("test/skus.txt").c_str()
+#define ill_file_path std::string("test/ill.txt").c_str()
art_document get_document(uint32_t id) {
art_document document(id, id, {0});
diff --git a/test/collection_all_fields_test.cpp b/test/collection_all_fields_test.cpp
index f3542b49..4b307f66 100644
--- a/test/collection_all_fields_test.cpp
+++ b/test/collection_all_fields_test.cpp
@@ -38,7 +38,7 @@ protected:
TEST_F(CollectionAllFieldsTest, IndexDocsWithoutSchema) {
Collection *coll1;
- std::ifstream infile(std::string(ROOT_DIR)+"test/multi_field_documents.jsonl");
+ std::ifstream infile("test/multi_field_documents.jsonl");
std::vector<field> fields = {};
std::vector<sort_by> sort_fields = { sort_by("points", "DESC") };
diff --git a/test/collection_faceting_test.cpp b/test/collection_faceting_test.cpp
index a26a78da..6c382657 100644
--- a/test/collection_faceting_test.cpp
+++ b/test/collection_faceting_test.cpp
@@ -38,7 +38,7 @@ protected:
TEST_F(CollectionFacetingTest, FacetCounts) {
Collection *coll_array_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/numeric_array_documents.jsonl");
+ std::ifstream infile("test/numeric_array_documents.jsonl");
std::vector<field> fields = {field("name", field_types::STRING, false),
field("name_facet", field_types::STRING, true),
field("age", field_types::INT32, true),
@@ -585,7 +585,7 @@ TEST_F(CollectionFacetingTest, FacetCountsHighlighting) {
TEST_F(CollectionFacetingTest, FacetStatOnFloatFields) {
Collection *coll_float_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/float_documents.jsonl");
+ std::ifstream infile("test/float_documents.jsonl");
std::vector<field> fields = {
field("title", field_types::STRING, false),
field("score", field_types::FLOAT, false),
diff --git a/test/collection_filtering_test.cpp b/test/collection_filtering_test.cpp
index 5f1d3a09..26fd7278 100644
--- a/test/collection_filtering_test.cpp
+++ b/test/collection_filtering_test.cpp
@@ -38,7 +38,7 @@ protected:
TEST_F(CollectionFilteringTest, FilterOnTextFields) {
Collection *coll_array_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/numeric_array_documents.jsonl");
+ std::ifstream infile("test/numeric_array_documents.jsonl");
std::vector<field> fields = {
field("name", field_types::STRING, false),
field("age", field_types::INT32, false),
@@ -140,7 +140,7 @@ TEST_F(CollectionFilteringTest, FilterOnTextFields) {
TEST_F(CollectionFilteringTest, FacetFieldStringFiltering) {
Collection *coll_str;
- std::ifstream infile(std::string(ROOT_DIR)+"test/multi_field_documents.jsonl");
+ std::ifstream infile("test/multi_field_documents.jsonl");
std::vector<field> fields = {
field("title", field_types::STRING, false),
field("starring", field_types::STRING, true),
@@ -208,7 +208,7 @@ TEST_F(CollectionFilteringTest, FacetFieldStringFiltering) {
TEST_F(CollectionFilteringTest, FacetFieldStringArrayFiltering) {
Collection *coll_array_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/numeric_array_documents.jsonl");
+ std::ifstream infile("test/numeric_array_documents.jsonl");
std::vector<field> fields = {field("name", field_types::STRING, false),
field("name_facet", field_types::STRING, true),
field("age", field_types::INT32, true),
@@ -325,7 +325,7 @@ TEST_F(CollectionFilteringTest, HandleBadlyFormedFilterQuery) {
// should not crash when filter query is malformed!
Collection *coll_array_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/numeric_array_documents.jsonl");
+ std::ifstream infile("test/numeric_array_documents.jsonl");
std::vector<field> fields = {field("name", field_types::STRING, false), field("age", field_types::INT32, false),
field("years", field_types::INT32_ARRAY, false),
field("timestamps", field_types::INT64_ARRAY, false),
@@ -393,7 +393,7 @@ TEST_F(CollectionFilteringTest, HandleBadlyFormedFilterQuery) {
TEST_F(CollectionFilteringTest, FilterAndQueryFieldRestrictions) {
Collection *coll_mul_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/multi_field_documents.jsonl");
+ std::ifstream infile("test/multi_field_documents.jsonl");
std::vector<field> fields = {
field("title", field_types::STRING, false),
field("starring", field_types::STRING, false),
@@ -502,7 +502,7 @@ TEST_F(CollectionFilteringTest, FilterAndQueryFieldRestrictions) {
TEST_F(CollectionFilteringTest, FilterOnNumericFields) {
Collection *coll_array_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/numeric_array_documents.jsonl");
+ std::ifstream infile("test/numeric_array_documents.jsonl");
std::vector<field> fields = {
field("name", field_types::STRING, false),
field("rating", field_types::FLOAT, false),
@@ -701,7 +701,7 @@ TEST_F(CollectionFilteringTest, FilterOnNumericFields) {
TEST_F(CollectionFilteringTest, FilterOnFloatFields) {
Collection *coll_array_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/numeric_array_documents.jsonl");
+ std::ifstream infile("test/numeric_array_documents.jsonl");
std::vector<field> fields = {
field("name", field_types::STRING, false),
field("age", field_types::INT32, false),
@@ -897,7 +897,7 @@ TEST_F(CollectionFilteringTest, FilterOnNegativeNumericalFields) {
TEST_F(CollectionFilteringTest, ComparatorsOnMultiValuedNumericalField) {
Collection *coll_array_fields;
- std::ifstream infile(std::string(ROOT_DIR) + "test/numeric_array_documents.jsonl");
+ std::ifstream infile("test/numeric_array_documents.jsonl");
std::vector<field> fields = {
field("name", field_types::STRING, false),
field("age", field_types::INT32, false),
@@ -1937,7 +1937,7 @@ TEST_F(CollectionFilteringTest, RangeFilterOnTimestamp) {
TEST_F(CollectionFilteringTest, QueryBoolFields) {
Collection *coll_bool;
- std::ifstream infile(std::string(ROOT_DIR)+"test/bool_documents.jsonl");
+ std::ifstream infile("test/bool_documents.jsonl");
std::vector<field> fields = {
field("popular", field_types::BOOL, false),
field("title", field_types::STRING, false),
diff --git a/test/collection_grouping_test.cpp b/test/collection_grouping_test.cpp
index 9c9bef92..ff234e93 100644
--- a/test/collection_grouping_test.cpp
+++ b/test/collection_grouping_test.cpp
@@ -35,7 +35,7 @@ protected:
coll_group = collectionManager.create_collection("coll_group", 4, fields, "rating").get();
}
- std::ifstream infile(std::string(ROOT_DIR)+"test/group_documents.jsonl");
+ std::ifstream infile("test/group_documents.jsonl");
std::string json_line;
diff --git a/test/collection_manager_test.cpp b/test/collection_manager_test.cpp
index 6b997430..fdd3b4d4 100644
--- a/test/collection_manager_test.cpp
+++ b/test/collection_manager_test.cpp
@@ -168,7 +168,7 @@ TEST_F(CollectionManagerTest, GetAllCollections) {
}
TEST_F(CollectionManagerTest, RestoreRecordsOnRestart) {
- std::ifstream infile(std::string(ROOT_DIR)+"test/multi_field_documents.jsonl");
+ std::ifstream infile("test/multi_field_documents.jsonl");
std::string json_line;
while (std::getline(infile, json_line)) {
@@ -386,7 +386,7 @@ TEST_F(CollectionManagerTest, VerifyEmbeddedParametersOfScopedAPIKey) {
TEST_F(CollectionManagerTest, RestoreAutoSchemaDocsOnRestart) {
Collection *coll1;
- std::ifstream infile(std::string(ROOT_DIR)+"test/optional_fields.jsonl");
+ std::ifstream infile("test/optional_fields.jsonl");
std::vector<field> fields = {
field("max", field_types::INT32, false)
};
@@ -493,7 +493,7 @@ TEST_F(CollectionManagerTest, RestoreAutoSchemaDocsOnRestart) {
}
TEST_F(CollectionManagerTest, DropCollectionCleanly) {
- std::ifstream infile(std::string(ROOT_DIR)+"test/multi_field_documents.jsonl");
+ std::ifstream infile("test/multi_field_documents.jsonl");
std::string json_line;
while (std::getline(infile, json_line)) {
diff --git a/test/collection_override_test.cpp b/test/collection_override_test.cpp
index f318dde6..a989690d 100644
--- a/test/collection_override_test.cpp
+++ b/test/collection_override_test.cpp
@@ -22,7 +22,7 @@ protected:
collectionManager.init(store, 1.0, "auth_key", quit);
collectionManager.load(8, 1000);
- std::ifstream infile(std::string(ROOT_DIR)+"test/multi_field_documents.jsonl");
+ std::ifstream infile("test/multi_field_documents.jsonl");
std::vector<field> fields = {
field("title", field_types::STRING, false),
field("starring", field_types::STRING, true),
diff --git a/test/collection_sorting_test.cpp b/test/collection_sorting_test.cpp
index 0091d165..1c336bf5 100644
--- a/test/collection_sorting_test.cpp
+++ b/test/collection_sorting_test.cpp
@@ -38,7 +38,7 @@ protected:
TEST_F(CollectionSortingTest, SortingOrder) {
Collection *coll_mul_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/multi_field_documents.jsonl");
+ std::ifstream infile("test/multi_field_documents.jsonl");
std::vector<field> fields = {field("title", field_types::STRING, false),
field("starring", field_types::STRING, false),
field("points", field_types::INT32, false),
@@ -145,7 +145,7 @@ TEST_F(CollectionSortingTest, DefaultSortingFieldValidations) {
TEST_F(CollectionSortingTest, NoDefaultSortingField) {
Collection *coll1;
- std::ifstream infile(std::string(ROOT_DIR)+"test/documents.jsonl");
+ std::ifstream infile("test/documents.jsonl");
std::vector<field> fields = {field("title", field_types::STRING, false),
field("points", field_types::INT32, false)};
@@ -281,7 +281,7 @@ TEST_F(CollectionSortingTest, TokenOrderingOnFloatValue) {
TEST_F(CollectionSortingTest, Int64AsDefaultSortingField) {
Collection *coll_mul_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/multi_field_documents.jsonl");
+ std::ifstream infile("test/multi_field_documents.jsonl");
std::vector<field> fields = {field("title", field_types::STRING, false),
field("starring", field_types::STRING, false),
field("points", field_types::INT64, false),
@@ -337,7 +337,7 @@ TEST_F(CollectionSortingTest, Int64AsDefaultSortingField) {
TEST_F(CollectionSortingTest, SortOnFloatFields) {
Collection *coll_float_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/float_documents.jsonl");
+ std::ifstream infile("test/float_documents.jsonl");
std::vector<field> fields = {
field("title", field_types::STRING, false),
field("score", field_types::FLOAT, false),
diff --git a/test/collection_synonyms_test.cpp b/test/collection_synonyms_test.cpp
index db83f288..f5e5c8d8 100644
--- a/test/collection_synonyms_test.cpp
+++ b/test/collection_synonyms_test.cpp
@@ -22,7 +22,7 @@ protected:
collectionManager.init(store, 1.0, "auth_key", quit);
collectionManager.load(8, 1000);
- std::ifstream infile(std::string(ROOT_DIR)+"test/multi_field_documents.jsonl");
+ std::ifstream infile("test/multi_field_documents.jsonl");
std::vector<field> fields = {
field("title", field_types::STRING, false),
field("starring", field_types::STRING, true),
diff --git a/test/collection_test.cpp b/test/collection_test.cpp
index e7ef8baa..f3340247 100644
--- a/test/collection_test.cpp
+++ b/test/collection_test.cpp
@@ -27,7 +27,7 @@ protected:
collectionManager.init(store, 1.0, "auth_key", quit);
collectionManager.load(8, 1000);
- std::ifstream infile(std::string(ROOT_DIR)+"test/documents.jsonl");
+ std::ifstream infile("test/documents.jsonl");
std::vector<field> search_fields = {
field("title", field_types::STRING, false),
field("points", field_types::INT32, false)
@@ -53,7 +53,7 @@ protected:
infile.close();
- std::ifstream words_file(std::string(ROOT_DIR)+"test/resources/common100_english.txt");
+ std::ifstream words_file("test/resources/common100_english.txt");
std::stringstream strstream;
strstream << words_file.rdbuf();
words_file.close();
@@ -712,7 +712,7 @@ TEST_F(CollectionTest, MultiOccurrenceString) {
TEST_F(CollectionTest, ArrayStringFieldHighlight) {
Collection *coll_array_text;
- std::ifstream infile(std::string(ROOT_DIR) + "test/array_text_documents.jsonl");
+ std::ifstream infile("test/array_text_documents.jsonl");
std::vector<field> fields = {
field("title", field_types::STRING, false),
field("tags", field_types::STRING_ARRAY, false),
@@ -890,7 +890,7 @@ TEST_F(CollectionTest, ArrayStringFieldHighlight) {
TEST_F(CollectionTest, MultipleFields) {
Collection *coll_mul_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/multi_field_documents.jsonl");
+ std::ifstream infile("test/multi_field_documents.jsonl");
std::vector<field> fields = {
field("title", field_types::STRING, false),
field("starring", field_types::STRING, false),
@@ -1010,7 +1010,7 @@ TEST_F(CollectionTest, MultipleFields) {
TEST_F(CollectionTest, KeywordQueryReturnsResultsBasedOnPerPageParam) {
Collection *coll_mul_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/multi_field_documents.jsonl");
+ std::ifstream infile("test/multi_field_documents.jsonl");
std::vector<field> fields = {
field("title", field_types::STRING, false),
field("starring", field_types::STRING, false),
@@ -1086,7 +1086,7 @@ std::vector<nlohmann::json> import_res_to_json(const std::vector<std::string>& i
TEST_F(CollectionTest, ImportDocumentsUpsert) {
Collection *coll_mul_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/multi_field_documents.jsonl");
+ std::ifstream infile("test/multi_field_documents.jsonl");
std::stringstream strstream;
strstream << infile.rdbuf();
infile.close();
@@ -1509,7 +1509,7 @@ TEST_F(CollectionTest, ImportDocumentsUpsertOptional) {
TEST_F(CollectionTest, ImportDocuments) {
Collection *coll_mul_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/multi_field_documents.jsonl");
+ std::ifstream infile("test/multi_field_documents.jsonl");
std::stringstream strstream;
strstream << infile.rdbuf();
infile.close();
@@ -1648,7 +1648,7 @@ TEST_F(CollectionTest, SearchingWithMissingFields) {
// return error without crashing when searching for fields that do not conform to the schema
Collection *coll_array_fields;
- std::ifstream infile(std::string(ROOT_DIR)+"test/numeric_array_documents.jsonl");
+ std::ifstream infile("test/numeric_array_documents.jsonl");
std::vector<field> fields = {field("name", field_types::STRING, false),
field("age", field_types::INT32, false),
field("years", field_types::INT32_ARRAY, false),
@@ -1872,7 +1872,7 @@ TEST_F(CollectionTest, AnIntegerCanBePassedToAFloatField) {
TEST_F(CollectionTest, DeletionOfADocument) {
collectionManager.drop_collection("collection");
- std::ifstream infile(std::string(ROOT_DIR)+"test/documents.jsonl");
+ std::ifstream infile("test/documents.jsonl");
std::vector<field> search_fields = {field("title", field_types::STRING, false),
field("points", field_types::INT32, false)};
@@ -2106,7 +2106,7 @@ TEST_F(CollectionTest, SearchLargeTextField) {
}
std::string json_line;
- std::ifstream infile(std::string(ROOT_DIR)+"test/large_text_field.jsonl");
+ std::ifstream infile("test/large_text_field.jsonl");
while (std::getline(infile, json_line)) {
coll_large_text->add(json_line);
@@ -2722,7 +2722,7 @@ TEST_F(CollectionTest, OptionalFields) {
coll1 = collectionManager.create_collection("coll1", 4, fields, "max").get();
}
- std::ifstream infile(std::string(ROOT_DIR)+"test/optional_fields.jsonl");
+ std::ifstream infile("test/optional_fields.jsonl");
std::string json_line;
diff --git a/test/config_test.cpp b/test/config_test.cpp
index c93e3aeb..9fd9506b 100644
--- a/test/config_test.cpp
+++ b/test/config_test.cpp
@@ -78,7 +78,7 @@ TEST(ConfigTest, LoadConfigFile) {
std::vector<std::string> args = {
"./typesense-server",
- std::string("--config=") + std::string(ROOT_DIR)+"test/valid_config.ini"
+ std::string("--config=") + "test/valid_config.ini"
};
std::vector<char*> argv = get_argv(args);
init_cmdline_options(options, argv.size() - 1, argv.data());
@@ -102,7 +102,7 @@ TEST(ConfigTest, LoadIncompleteConfigFile) {
std::vector<std::string> args = {
"./typesense-server",
- std::string("--config=") + std::string(ROOT_DIR)+"test/valid_sparse_config.ini"
+ std::string("--config=") + "test/valid_sparse_config.ini"
};
std::vector<char*> argv = get_argv(args);
init_cmdline_options(options, argv.size() - 1, argv.data());
@@ -121,7 +121,7 @@ TEST(ConfigTest, LoadBadConfigFile) {
std::vector<std::string> args = {
"./typesense-server",
- std::string("--config=") + std::string(ROOT_DIR)+"test/bad_config.ini"
+ std::string("--config=") + "test/bad_config.ini"
};
std::vector<char*> argv = get_argv(args);
init_cmdline_options(options, argv.size() - 1, argv.data());
@@ -144,7 +144,7 @@ TEST(ConfigTest, CmdLineArgsOverrideConfigFileAndEnvVars) {
"--api-key=abcd",
"--listen-address=192.168.10.10",
"--cors-domains=http://localhost:8108",
- std::string("--config=") + std::string(ROOT_DIR)+"test/valid_sparse_config.ini"
+ std::string("--config=") + "test/valid_sparse_config.ini"
};
putenv((char*)"TYPESENSE_DATA_DIR=/tmp/ts");
@@ -182,7 +182,7 @@ TEST(ConfigTest, CorsDefaults) {
"--data-dir=/tmp/data",
"--api-key=abcd",
"--listen-address=192.168.10.10",
- std::string("--config=") + std::string(ROOT_DIR)+"test/valid_sparse_config.ini"
+ std::string("--config=") + "test/valid_sparse_config.ini"
};
std::vector<char*> argv = get_argv(args);
diff --git a/test/sorted_array_test.cpp b/test/sorted_array_test.cpp
index d1883a7c..826b333c 100644
--- a/test/sorted_array_test.cpp
+++ b/test/sorted_array_test.cpp
@@ -208,7 +208,7 @@ TEST(SortedArrayTest, RemoveValues) {
}
TEST(SortedArrayTest, BulkIndexOf) {
- std::ifstream infile(std::string(ROOT_DIR)+"test/ids.txt");
+ std::ifstream infile("test/ids.txt");
sorted_array ids;
diff --git a/test/system_metrics_test.cpp b/test/system_metrics_test.cpp
index 0d0e95e5..134ef931 100644
--- a/test/system_metrics_test.cpp
+++ b/test/system_metrics_test.cpp
@@ -2,7 +2,7 @@
#include "system_metrics.h"
TEST(SystemMetricsTest, ParsingNetworkStats) {
- std::string proc_net_dev_path = std::string(ROOT_DIR)+"test/resources/proc_net_dev.txt";
+ std::string proc_net_dev_path = "test/resources/proc_net_dev.txt";
uint64_t received_bytes, sent_bytes;
SystemMetrics::linux_get_network_data(proc_net_dev_path, received_bytes, sent_bytes);
ASSERT_EQ(324278716, received_bytes);
diff --git a/test/topster_test.cpp b/test/topster_test.cpp
index 858448c3..c580491c 100644
--- a/test/topster_test.cpp
+++ b/test/topster_test.cpp
@@ -62,7 +62,7 @@ TEST(TopsterTest, MaxIntValues) {
TEST(TopsterTest, StableSorting) {
// evaluate if the positions of the documents in Topster<1000> is the same in Topster 250, 500 and 750
- std::ifstream infile(std::string(ROOT_DIR)+"test/resources/record_values.txt");
+ std::ifstream infile("test/resources/record_values.txt");
std::string line;
std::vector<std::pair<uint64_t, int64_t>> records;