From 67750f1c6a8a2864ced5711401a7881e810ad077 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Fri, 13 Sep 2024 09:28:12 -0700 Subject: [PATCH] First step towards using bzlmod * Move projects that are available already in https://registry.bazel.build/ from from load_external to MODULE.bazel. * This is not complete: there are probably more steps to simplify and clean-up after the first submit. * Switching to bzlmod broke making the compilation-db as the action hooks don't seem to work anymore ( xls/dev_tools//make-compilation-db.sh ). The used com_grail_bazel_compdb is not maintained anymore, so this needs to be updated to something more modern (hedronvision?). Since this is not actively needed in daily development (and I am the only one really using it), postponed for later. * Clean out things not needed anymore in dependency_support/$(various-dirs) Issues: #931 Also, needed to make Python rules to work well with --incompatible_default_to_explicit_init_py (bazelbuild/bazel#10076) --- .bazelrc | 8 +- .gitignore | 1 + MODULE.bazel | 40 ++++ WORKSPACE | 52 +---- .../0001-Add-absl-status-to-deps.patch | 24 -- .../com_github_grpc_grpc/BUILD.bazel | 15 -- .../com_google_absl/BUILD.bazel | 15 -- .../com_google_benchmark/BUILD.bazel | 15 -- .../com_grail_bazel_toolchain/BUILD.bazel | 15 -- dependency_support/initialize_external.bzl | 11 +- dependency_support/load_external.bzl | 219 ++---------------- dependency_support/pybind11_bazel/BUILD.bazel | 15 -- .../pybind11_bazel/sysconfig_fix.patch | 15 -- dependency_support/zlib/BUILD.bazel | 15 -- dependency_support/zlib/bundled.BUILD.bazel | 74 ------ xls/dev_tools/make-compilation-db.sh | 23 +- 16 files changed, 72 insertions(+), 485 deletions(-) create mode 100644 MODULE.bazel delete mode 100644 dependency_support/com_github_grpc_grpc/0001-Add-absl-status-to-deps.patch delete mode 100644 dependency_support/com_github_grpc_grpc/BUILD.bazel delete mode 100644 dependency_support/com_google_absl/BUILD.bazel delete mode 100644 dependency_support/com_google_benchmark/BUILD.bazel delete mode 100644 dependency_support/com_grail_bazel_toolchain/BUILD.bazel delete mode 100644 dependency_support/pybind11_bazel/BUILD.bazel delete mode 100644 dependency_support/pybind11_bazel/sysconfig_fix.patch delete mode 100644 dependency_support/zlib/BUILD.bazel delete mode 100755 dependency_support/zlib/bundled.BUILD.bazel diff --git a/.bazelrc b/.bazelrc index 0381d4a993..7ee6175b81 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,10 +1,14 @@ -# We use bazel >= 6, but no bzlmod yet. -common --noenable_bzlmod +common --enable_bzlmod # Disable rules_python Starlark rules for Bazel 7+. # See https://github.com/bazelbuild/rules_python/issues/1069#issuecomment-1942053014. build --action_env=RULES_PYTHON_ENABLE_PYSTAR=0 +# Disable automatic generation of __init__.py files. This allows +# namespace packages (such as `google`) to work correctly. +# https://github.com/bazelbuild/bazel/issues/10076 +build --incompatible_default_to_explicit_init_py=true + # Minimium c++ standard used. build --cxxopt "-std=c++20" --host_cxxopt "-std=c++20" build --action_env=BAZEL_CXXOPTS=-std=c++20 diff --git a/.gitignore b/.gitignore index 11e040bb54..e480093082 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ user.bazelrc .vscode .cache docs/ +MODULE.bazel.lock diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000000..6b8f159af8 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,40 @@ +module( + name = "xls", + repo_name = "com_google_xls", +) + +# Compiler toolchain +bazel_dep(name = "toolchains_llvm", version = "1.1.2") + +# Configure and register the toolchain. +llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm") +llvm.toolchain( + llvm_version = "17.0.6", +) +use_repo(llvm, "llvm_toolchain") + +register_toolchains("@llvm_toolchain//:all") + +# +bazel_dep(name = "abseil-cpp", version = "20240722.0.bcr.2", repo_name = "com_google_absl") +bazel_dep(name = "abseil-py", version = "2.1.0", repo_name = "com_google_absl_py") +bazel_dep(name = "bazel_skylib", version = "1.7.1") +bazel_dep(name = "boringssl", version = "0.20241209.0") +bazel_dep(name = "cppitertools", version = "2.1") +bazel_dep(name = "google_benchmark", version = "1.8.5", repo_name = "com_google_benchmark") +bazel_dep(name = "googleapis", version = "0.0.0-20240819-fe8ba054a", repo_name = "com_google_googleapis") +bazel_dep(name = "googletest", version = "1.15.2", repo_name = "com_google_googletest") +bazel_dep(name = "grpc", version = "1.68.0", repo_name = "com_github_grpc_grpc") +bazel_dep(name = "nlohmann_json", version = "3.11.3.bcr.1", repo_name="jsonhpp") +bazel_dep(name = "platforms", version = "0.0.10") +bazel_dep(name = "protobuf", version = "29.1", repo_name = "com_google_protobuf") +bazel_dep(name = "re2", version = "2024-07-02.bcr.1", repo_name = "com_googlesource_code_re2") +bazel_dep(name = "riegeli", version = "0.0.0-20240927-cdfb25a", repo_name = "com_google_riegeli") +bazel_dep(name = "rules_cc", version = "0.1.0") +bazel_dep(name = "rules_license", version = "1.0.0") +bazel_dep(name = "rules_pkg", version = "1.0.1") + +# Not all external projects we directly need are available yet. +# This how to find what we use for further work on this file: +# find xls -name BUILD -o -name "*.bzl" | xargs sed 's/.*"\(@[_a-z0-9]*\).*/\1/p;d' | sort -u +# Once added here, remove from the {load,initialize}_external.bzl. diff --git a/WORKSPACE b/WORKSPACE index 595ce818c8..e568cf19f3 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -12,45 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -workspace(name = "com_google_xls") - -# Load and configure a hermetic LLVM based C/C++ toolchain. This is done here -# and not in load_external.bzl because it requires several sequential steps of -# declaring archives and using things in them, which is awkward to do in .bzl -# files because it's not allowed to use `load` inside of a function. -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -# Released 2023-09-20, current as of 2024-06-26 (but there is already a 0.0.10rc1) -# Needs to be loaded first, as llvm toolchain has an ancient version of this. -http_archive( - name = "rules_cc", - urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"], - sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf", - strip_prefix = "rules_cc-0.0.9", -) - -# Commit on 2024-07-19, current as of 2024-07-21. -http_archive( - name = "toolchains_llvm", - integrity = "sha256-RVp0bZsDrelQAtxswWOLB4j8zCXQy/cSe1m3wL/E2PU=", - strip_prefix = "toolchains_llvm-01132cfdae7d7187a885cf79d5a3ac1ed8a02e5a", - url = "https://github.com/bazel-contrib/toolchains_llvm/archive/01132cfdae7d7187a885cf79d5a3ac1ed8a02e5a.tar.gz", -) - -load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies") - -bazel_toolchain_dependencies() - -load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain") +# TODO(https://github.com/google/xls/issues/931): Everything here should go away and migrate to MODULE.bazel -llvm_toolchain( - name = "llvm_toolchain", - llvm_version = "17.0.6", -) - -load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains") - -llvm_register_toolchains() +workspace(name = "com_google_xls") load("//dependency_support:load_external.bzl", "load_external_repositories") @@ -75,12 +39,6 @@ python_register_toolchains( ignore_root_user_error = True, ) -# gRPC deps should be loaded before initializing other repos. Otherwise, various -# errors occur during repo loading and initialization. -load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") - -grpc_deps() - load("//dependency_support:initialize_external.bzl", "initialize_external_repositories") initialize_external_repositories() @@ -88,9 +46,3 @@ initialize_external_repositories() load("@xls_pip_deps//:requirements.bzl", xls_pip_install_deps = "install_deps") xls_pip_install_deps() - -# Loading the extra deps must be called after initialize_eternal_repositories or -# the call to pip_parse fails. -load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps") - -grpc_extra_deps() diff --git a/dependency_support/com_github_grpc_grpc/0001-Add-absl-status-to-deps.patch b/dependency_support/com_github_grpc_grpc/0001-Add-absl-status-to-deps.patch deleted file mode 100644 index a83a80d46e..0000000000 --- a/dependency_support/com_github_grpc_grpc/0001-Add-absl-status-to-deps.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 160a546da6ce0a76b160b57e6350f610ccf8b808 Mon Sep 17 00:00:00 2001 -From: Paul Rigge -Date: Mon, 22 Jul 2024 20:59:04 -0700 -Subject: [PATCH] Add absl:status to deps. - ---- - src/core/BUILD | 1 + - 1 file changed, 1 insertion(+) - -diff --git src/core/BUILD src/core/BUILD -index e76dc300ac..0688bb9dcc 100644 ---- src/core/BUILD -+++ src/core/BUILD -@@ -2563,6 +2563,7 @@ grpc_cc_library( - external_deps = [ - "absl/container:flat_hash_map", - "absl/log:check", -+ "absl/status", - "absl/strings", - "absl/strings:str_format", - ], --- -2.45.2 - diff --git a/dependency_support/com_github_grpc_grpc/BUILD.bazel b/dependency_support/com_github_grpc_grpc/BUILD.bazel deleted file mode 100644 index bde7573e93..0000000000 --- a/dependency_support/com_github_grpc_grpc/BUILD.bazel +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2020 The XLS Authors -# -# 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. - -# Needed to make this a package. diff --git a/dependency_support/com_google_absl/BUILD.bazel b/dependency_support/com_google_absl/BUILD.bazel deleted file mode 100644 index a5bf9b8384..0000000000 --- a/dependency_support/com_google_absl/BUILD.bazel +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2021 The XLS Authors -# -# 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. - -# Needed to make this a package. diff --git a/dependency_support/com_google_benchmark/BUILD.bazel b/dependency_support/com_google_benchmark/BUILD.bazel deleted file mode 100644 index a1f21e7338..0000000000 --- a/dependency_support/com_google_benchmark/BUILD.bazel +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2022 The XLS Authors -# -# 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. - -# Needed to make this a package. diff --git a/dependency_support/com_grail_bazel_toolchain/BUILD.bazel b/dependency_support/com_grail_bazel_toolchain/BUILD.bazel deleted file mode 100644 index bde7573e93..0000000000 --- a/dependency_support/com_grail_bazel_toolchain/BUILD.bazel +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2020 The XLS Authors -# -# 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. - -# Needed to make this a package. diff --git a/dependency_support/initialize_external.bzl b/dependency_support/initialize_external.bzl index c88b6bebb9..19a207944a 100644 --- a/dependency_support/initialize_external.bzl +++ b/dependency_support/initialize_external.bzl @@ -14,10 +14,9 @@ """Provides helper that initializes external repositories with third-party code.""" -load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") -load("@com_google_benchmark//:bazel/benchmark_deps.bzl", "benchmark_deps") -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -load("@com_grail_bazel_compdb//:deps.bzl", "bazel_compdb_deps") +# TODO(https://github.com/google/xls/issues/931): with MODULE.bazel, probably some of these can be removed now, with the +# eventual goal that none of this is needed anymore and the file can be removed. + load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies", "rules_closure_toolchains") load("@project_python//:defs.bzl", python_interpreter_target = "interpreter") load("@rules_7zip//:setup.bzl", "setup_7zip") # needed by rules_hdl @@ -33,8 +32,6 @@ load("//dependency_support/llvm:initialize.bzl", initialize_llvm = "initialize") def initialize_external_repositories(): """Calls set-up methods for external repositories that require that.""" - bazel_skylib_workspace() - protobuf_deps() rules_hdl_init(python_interpreter_target = python_interpreter_target) rules_hdl_dependency_support() setup_7zip() @@ -51,6 +48,4 @@ def initialize_external_repositories(): ) initialize_boost() initialize_llvm() - bazel_compdb_deps() - benchmark_deps() rules_pkg_dependencies() diff --git a/dependency_support/load_external.bzl b/dependency_support/load_external.bzl index 592d257dc6..69a440bfdf 100644 --- a/dependency_support/load_external.bzl +++ b/dependency_support/load_external.bzl @@ -14,6 +14,10 @@ """Provides helper that loads external repositories with third-party code.""" +# TODO(https://github.com/google/xls/issues/931): all the remaining toplevel projects we need should move to MODULE.bazel, +# somewhat dependent on what becomes available in https://registry.bazel.build/. +# Eventual goal that none of this is needed anymore and the file can be removed. + load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("//dependency_support/boost:workspace.bzl", repo_boost = "repo") load("//dependency_support/llvm:workspace.bzl", repo_llvm = "repo") @@ -38,113 +42,6 @@ def load_external_repositories(): repo_llvm() repo_rules_hdl() - # Release 2024-01-22, current as of 2024-06-26 - # zlib is added automatically by gRPC, but the zlib BUILD file used by gRPC - # does not include all the source code (e.g., gzread is missing) which - # breaks other users of zlib like iverilog. So add zlib explicitly here with - # a working BUILD file. - # Needs to be early in this file to make sure this is the version - # picked -- Version 1.3.x fixes function prototype warnings in c++20. - http_archive( - name = "zlib", - sha256 = "50b24b47bf19e1f35d2a21ff36d2a366638cdf958219a66f30ce0861201760e6", - strip_prefix = "zlib-1.3.1", - urls = [ - "https://github.com/madler/zlib/archive/v1.3.1.zip", - ], - build_file = "//dependency_support/zlib:bundled.BUILD.bazel", - ) - - # V 1.15.2 (released 2024-07-31, current as of 2024-10-16) - http_archive( - name = "com_google_googletest", - urls = ["https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip"], - strip_prefix = "googletest-1.15.2", - integrity = "sha256-8XnsIX+bOz88bosC0+ftqZe0nkzibWsjXJBTvsnAv58=", - ) - - # LTS 20240722.0 (released 2024-07-22, current as of 2024-10-16) - http_archive( - name = "com_google_absl", - urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/20240722.0.tar.gz"], - strip_prefix = "abseil-cpp-20240722.0", - integrity = "sha256-9Q5awxGoE4Laf6dblzEOS5AGR0+VYKxG9UqZZ/B9SuM=", - ) - - # Released 2024-06-03, current as of 2024-06-26 - # Protobuf depends on Skylib - # Load bazel skylib as per - # https://github.com/bazelbuild/bazel-skylib/releases - http_archive( - name = "bazel_skylib", - urls = [ - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", - ], - sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f", - ) - - http_archive( - name = "boringssl", - # Commit date: 2024-06-24 - # Note for updating: we need to use a commit from the main-with-bazel branch. - strip_prefix = "boringssl-e6b03733628149a89a1d18b3ef8f39aa1055aba8", - sha256 = "006596f84d9cc142d9d6c48600cf6208f9d24426943b05e8bcda06e523f69dc8", - urls = ["https://github.com/google/boringssl/archive/e6b03733628149a89a1d18b3ef8f39aa1055aba8.tar.gz"], - ) - - # Commit on 2023-02-09 - http_archive( - name = "pybind11_bazel", - strip_prefix = "pybind11_bazel-fc56ce8a8b51e3dd941139d329b63ccfea1d304b", - urls = ["https://github.com/pybind/pybind11_bazel/archive/fc56ce8a8b51e3dd941139d329b63ccfea1d304b.tar.gz"], - sha256 = "150e2105f9243c445d48f3820b5e4e828ba16c41f91ab424deae1fa81d2d7ac6", - ) - - http_archive( - name = "six_archive", - build_file_content = """py_library( - name = "six", - visibility = ["//visibility:public"], - srcs = glob(["*.py"]) - )""", - sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", - strip_prefix = "six-1.10.0", - urls = [ - "https://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz", - "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz", - ], - ) - - # Version release tag 2023-01-11 - http_archive( - name = "com_google_absl_py", - strip_prefix = "abseil-py-1.4.0", - urls = ["https://github.com/abseil/abseil-py/archive/refs/tags/v1.4.0.tar.gz"], - sha256 = "0fb3a4916a157eb48124ef309231cecdfdd96ff54adf1660b39c0d4a9790a2c0", - ) - - # Released on 2024-06-01, current as of 2024-06-26 - http_archive( - name = "com_googlesource_code_re2", - strip_prefix = "re2-2024-06-01", - sha256 = "7326c74cddaa90b12090fcfc915fe7b4655723893c960ee3c2c66e85c5504b6c", - urls = [ - "https://github.com/google/re2/archive/refs/tags/2024-06-01.tar.gz", - ], - repo_mapping = { - "@abseil-cpp": "@com_google_absl", - }, - ) - - # Release on 2024-09-13, current as of 2024-10-01 - http_archive( - name = "bazel_features", - sha256 = "bdc12fcbe6076180d835c9dd5b3685d509966191760a0eb10b276025fcb76158", - strip_prefix = "bazel_features-1.17.0", - url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.17.0/bazel_features-v1.17.0.tar.gz", - ) - - # Release on 2024-06-17, current as of 2024-10-01 http_archive( name = "rules_proto", sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295", @@ -189,14 +86,6 @@ def load_external_repositories(): build_file = "//dependency_support/linenoise:bundled.BUILD.bazel", ) - # Commit from 2024-06-26 - http_archive( - name = "com_google_riegeli", - sha256 = "38fd4b6bc24958ae51e1a5a0eb57ce9c3dbbaf5034a78453a4d133597fbf31e4", - strip_prefix = "riegeli-cb68d579f108c96831b6a7815da43ff24b4e5242", - url = "https://github.com/google/riegeli/archive/cb68d579f108c96831b6a7815da43ff24b4e5242.tar.gz", - ) - # Needed by fuzztest. Release 2024-05-21, current as of 2024-06-26 http_archive( name = "snappy", @@ -223,55 +112,6 @@ def load_external_repositories(): urls = ["https://github.com/google/highwayhash/archive/f8381f3331d9c56a9792f9b4a35f61c41108c39e.tar.gz"], ) - # Released 2024-06-07, current as of 2024-06-26. - http_archive( - name = "com_github_grpc_grpc", - urls = ["https://github.com/grpc/grpc/archive/v1.64.2.tar.gz"], - patches = ["//dependency_support/com_github_grpc_grpc:0001-Add-absl-status-to-deps.patch"], - sha256 = "c682fc39baefc6e804d735e6b48141157b7213602cc66dbe0bf375b904d8b5f9", - strip_prefix = "grpc-1.64.2", - repo_mapping = { - "@local_config_python": "@project_python", - "@system_python": "@project_python", - }, - ) - - # Used by xlscc. Tagged 2024-02-16 (note: release is lagging tag), current as of 2024-06-26 - http_archive( - name = "com_github_hlslibs_ac_types", - urls = ["https://github.com/hlslibs/ac_types/archive/refs/tags/4.8.0.tar.gz"], - sha256 = "238197203f8c6254a1d6ac6884e89e6f4c060bffb7473d336df4a1fb53ba7fab", - strip_prefix = "ac_types-4.8.0", - build_file = "//dependency_support/com_github_hlslibs_ac_types:bundled.BUILD.bazel", - ) - - # Released 2024-04-25, current as of 2024-06-26 - http_archive( - name = "platforms", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", - "https://github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", - ], - sha256 = "218efe8ee736d26a3572663b374a253c012b716d8af0c07e842e82f238a0a7ee", - ) - - # Released 2024-09-13, current as of 2024-10-16. - ORTOOLS_VERSION = "9.11" - http_archive( - name = "com_google_ortools", - urls = ["https://github.com/google/or-tools/archive/refs/tags/v{tag}.tar.gz".format(tag = ORTOOLS_VERSION)], - integrity = "sha256-9qC9W58wWKoagUt5jbXTk8Meycu2EDSGcomXtJqxJ7w=", - strip_prefix = "or-tools-" + ORTOOLS_VERSION, - ) - - # Released 2024-05-23, current as of 2024-06-26. - http_archive( - name = "com_google_benchmark", - urls = ["https://github.com/google/benchmark/archive/refs/tags/v1.8.4.tar.gz"], - sha256 = "3e7059b6b11fb1bbe28e33e02519398ca94c1818874ebed18e504dc6f709be45", - strip_prefix = "benchmark-1.8.4", - ) - # Updated to head on 2024-03-14 FUZZTEST_COMMIT = "393ae75c0fca5f9892e73969da5d6bce453ad318" http_archive( @@ -283,21 +123,22 @@ def load_external_repositories(): patches = ["//dependency_support/com_google_fuzztest:e317d5277e34948ae7048cb5e48309e0288e8df3.patch"], ) - # Released 2024-01-24, current as of 2024-06-26 + # Used by xlscc. Tagged 2024-02-16 (note: release is lagging tag), current as of 2024-06-26 http_archive( - name = "rules_license", - urls = [ - "https://github.com/bazelbuild/rules_license/releases/download/0.0.8/rules_license-0.0.8.tar.gz", - ], - sha256 = "241b06f3097fd186ff468832150d6cc142247dc42a32aaefb56d0099895fd229", + name = "com_github_hlslibs_ac_types", + urls = ["https://github.com/hlslibs/ac_types/archive/refs/tags/4.8.0.tar.gz"], + sha256 = "238197203f8c6254a1d6ac6884e89e6f4c060bffb7473d336df4a1fb53ba7fab", + strip_prefix = "ac_types-4.8.0", + build_file = "//dependency_support/com_github_hlslibs_ac_types:bundled.BUILD.bazel", ) - # 2022-09-19 + # Released 2024-05-08, current as of 2024-06-26. + ORTOOLS_VERSION = "9.10" http_archive( - name = "com_grail_bazel_compdb", - sha256 = "a3ff6fe238eec8202270dff75580cba3d604edafb8c3408711e82633c153efa8", - strip_prefix = "bazel-compilation-database-940cedacdb8a1acbce42093bf67f3a5ca8b265f7", - urls = ["https://github.com/grailbio/bazel-compilation-database/archive/940cedacdb8a1acbce42093bf67f3a5ca8b265f7.tar.gz"], + name = "com_google_ortools", + urls = ["https://github.com/google/or-tools/archive/refs/tags/v{}.tar.gz".format(ORTOOLS_VERSION)], + sha256 = "e7c27a832f3595d4ae1d7e53edae595d0347db55c82c309c8f24227e675fd378", + strip_prefix = "or-tools-" + ORTOOLS_VERSION, ) # Tagged 2024-11-23, current as of 2024-11-25 @@ -309,37 +150,13 @@ def load_external_repositories(): urls = ["https://github.com/chipsalliance/verible/archive/refs/tags/" + VERIBLE_TAG + ".tar.gz"], ) - # Used by Verible; current as of 2024-11-25 - http_archive( - name = "jsonhpp", - build_file = "@verible//bazel:jsonhpp.BUILD", - sha256 = "0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406", - strip_prefix = "json-3.11.3", - urls = [ - "https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz", - ], - ) - - # Released 2024-06-03, current as of 2024-06-26 - http_archive( - name = "rules_pkg", - urls = ["https://github.com/bazelbuild/rules_pkg/releases/download/1.0.0/rules_pkg-1.0.0.tar.gz"], - sha256 = "cad05f864a32799f6f9022891de91ac78f30e0fa07dc68abac92a628121b5b11", - ) - - # HEAD as of 2024-10-11 on https://github.com/ryanhaining/cppitertools - http_archive( - name = "cppitertools", - urls = ["https://github.com/ryanhaining/cppitertools/archive/3f454640b491bc13b314deddbf53b3534f6d7f1f.zip"], - strip_prefix = "cppitertools-3f454640b491bc13b314deddbf53b3534f6d7f1f", - integrity = "sha256-49xFSGD2D0equ6mOPApSfEuiObp4W1iwnQjxHahGz0Y=", - ) - # Used in C++ tests of the ZSTD Module # Transitive dependency of fuzztest (required by riegeli in fuzztest workspace) # Version fdfb2aff released on 2024-07-31 # https://github.com/facebook/zstd/commit/fdfb2aff39dc498372d8c9e5f2330b692fea9794 # Updated 2024-08-08 + # This does exist already in https://registry.bazel.build/ - NB: when moving to MODULE.bazel, + # we probably need to use our local bundled.BUILD.bazel as it provides the decodecorpus. http_archive( name = "zstd", sha256 = "9ace5a1b3c477048c6e034fe88d2abb5d1402ced199cae8e9eef32fdc32204df", diff --git a/dependency_support/pybind11_bazel/BUILD.bazel b/dependency_support/pybind11_bazel/BUILD.bazel deleted file mode 100644 index a1f21e7338..0000000000 --- a/dependency_support/pybind11_bazel/BUILD.bazel +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2022 The XLS Authors -# -# 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. - -# Needed to make this a package. diff --git a/dependency_support/pybind11_bazel/sysconfig_fix.patch b/dependency_support/pybind11_bazel/sysconfig_fix.patch deleted file mode 100644 index 1c1ab9914c..0000000000 --- a/dependency_support/pybind11_bazel/sysconfig_fix.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git python_configure.bzl python_configure.bzl -index 1f5bffa..4225255 100644 ---- python_configure.bzl -+++ python_configure.bzl -@@ -252,8 +252,8 @@ def _get_python_include(repository_ctx, python_bin): - python_bin, - "-c", - "from __future__ import print_function;" + -- "from distutils import sysconfig;" + -- "print(sysconfig.get_python_inc())", -+ "import sysconfig; import os; " + -+ "print(os.path.dirname(sysconfig.get_config_h_filename()))", - ], - error_msg = "Problem getting python include path.", - error_details = ("Is the Python binary path set up right? " + diff --git a/dependency_support/zlib/BUILD.bazel b/dependency_support/zlib/BUILD.bazel deleted file mode 100644 index f957489a3b..0000000000 --- a/dependency_support/zlib/BUILD.bazel +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2020 The XLS Authors -# -# 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. - -# Required to make this a package. diff --git a/dependency_support/zlib/bundled.BUILD.bazel b/dependency_support/zlib/bundled.BUILD.bazel deleted file mode 100755 index cb849cdee0..0000000000 --- a/dependency_support/zlib/bundled.BUILD.bazel +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright 2020 The XLS Authors -# -# 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. - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) # BSD/MIT-like license (for zlib) - -_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", - # Include the un-prefixed headers in srcs to work - # around the fact that zlib isn't consistent in its - # choice of <> or "" delimiter when including itself. - ] + _ZLIB_HEADERS, - hdrs = _ZLIB_PREFIXED_HEADERS, - copts = [ - "-Wno-unused-variable", - "-Wno-implicit-function-declaration", - ], - includes = ["zlib/include/"], -) diff --git a/xls/dev_tools/make-compilation-db.sh b/xls/dev_tools/make-compilation-db.sh index d65522e5bd..8953528d77 100755 --- a/xls/dev_tools/make-compilation-db.sh +++ b/xls/dev_tools/make-compilation-db.sh @@ -13,24 +13,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -u -set -e - -readonly OUTPUT_BASE="$(bazel info output_base)" - -readonly COMPDB_SCRIPT="${OUTPUT_BASE}/external/com_grail_bazel_compdb/generate.py" -[ -r "${COMPDB_SCRIPT}" ] || bazel fetch @com_grail_bazel_compdb//... - -python3 "${COMPDB_SCRIPT}" - -# Massage the output so that clang-tidy fully undestands the compile commands: -# remove flags where it gets confused. -# Also, make sure that the command also contains -xc++ (bazel sometimes does -# not add that in libraries that don't have a *.cc file but only *.h or *.inc) -sed -i compile_commands.json -f - <