From 7441ea1a65839fc4b01e007f22a81996a5d0bd52 Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Mon, 18 Sep 2023 15:41:38 -0700 Subject: [PATCH] feat: bzlmodify --- .bazelrc | 18 +---- MODULE.bazel | 21 ++++-- WORKSPACE.bazel | 145 +++++++++++++----------------------- bazel/platforms/BUILD.bazel | 19 ----- commands/BUILD.bazel | 14 ++-- commands/benchmark.cc | 2 +- commands/codegen.cc | 6 +- 7 files changed, 77 insertions(+), 148 deletions(-) delete mode 100644 bazel/platforms/BUILD.bazel diff --git a/.bazelrc b/.bazelrc index b6e73fc..f4bc8c0 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,21 +1,7 @@ -common --enable_bzlmod -build --enable_platform_specific_config -build --incompatible_use_platforms_repo_for_constraints -build --incompatible_enable_cc_toolchain_resolution -build --incompatible_strict_action_env -build --enable_runfiles +import %workspace%/bazel/common.bazelrc -build:windows --platforms=//bazel/platforms:windows -build:windows --host_platform=//bazel/platforms:windows +common --@boost.dll//:use_std_fs build:windows --workspace_status_command=bazel/tools/wsc.cmd - -build:linux --platforms=//bazel/platforms:linux -build:linux --host_platform=//bazel/platforms:linux -build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux build:linux --workspace_status_command=bazel/tools/wsc.sh -common:ci --announce_rc -common:ci --disk_cache=~/.cache/bazel-disk-cache -build:ci -c opt - try-import %workspace%/user.bazelrc diff --git a/MODULE.bazel b/MODULE.bazel index 151f2c2..434a365 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,7 +1,14 @@ -module(name = "ecsact_cli") - -bazel_dep(name = "nlohmann_json", version = "3.11.2") -bazel_dep(name = "rules_cc", version = "0.0.8") -bazel_dep(name = "platforms", version = "0.0.7") -bazel_dep(name = "rules_pkg", version = "0.9.1") -bazel_dep(name = "bazel_skylib", version = "1.4.2") +module(name = "ecsact_cli") + +bazel_dep(name = "nlohmann_json", version = "3.11.2") +bazel_dep(name = "rules_cc", version = "0.0.8") +bazel_dep(name = "platforms", version = "0.0.7") +bazel_dep(name = "rules_pkg", version = "0.9.1") +bazel_dep(name = "bazel_skylib", version = "1.4.2") +bazel_dep(name = "ecsact_parse", version = "0.3.0") +bazel_dep(name = "ecsact_runtime", version = "0.5.0") +bazel_dep(name = "ecsact_interpret", version = "0.5.0") +bazel_dep(name = "ecsact_codegen", version = "0.1.1") +bazel_dep(name = "boost.dll", version = "1.83.0.bzl.2") +bazel_dep(name = "magic_enum", version = "0.9.3") +bazel_dep(name = "docopt.cpp", version = "0.6.2") diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 142712c..29b383b 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -1,95 +1,50 @@ -workspace(name = "ecsact_cli") - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file") - -http_archive( - name = "bazelregistry_docopt_cpp", - sha256 = "a06e705978b1c09427f130a187cb361916c1e7d66b69e91b865ebcd5390a6774", - strip_prefix = "docopt.cpp-1e38ceb67655f576814ae1c95f138eb8b61453c9", - url = "https://github.com/bazelregistry/docopt.cpp/archive/1e38ceb67655f576814ae1c95f138eb8b61453c9.zip", -) - -http_archive( - name = "boost", - sha256 = "4a79c389add7e3d54d0e12c83098d471d24536ba2d6b8593d3a95f151f25eebb", - strip_prefix = "boost-da62319c330d81ef032517cbe13b6f35d97387cb", - urls = ["https://github.com/bazelboost/boost/archive/da62319c330d81ef032517cbe13b6f35d97387cb.zip"], -) - -load("@boost//:index.bzl", "boost_http_archives") - -boost_http_archives() - -http_archive( - name = "rules_cc_stamp", - strip_prefix = "rules_cc_stamp-63d4861f4d420b574fa0f112599aae2b8aee785e", - urls = ["https://github.com/zaucy/rules_cc_stamp/archive/63d4861f4d420b574fa0f112599aae2b8aee785e.zip"], - sha256 = "f469a3b97eeabeb850c655f59ea17799ff40badd3a0b3e9de38534c89ad2f87d", -) - -http_archive( - name = "ecsact_si_wasm", - sha256 = "e208a94d4f4a9c09f32b8a9ea91a4f799492e11c7c852b0329b4a3595a45cee6", - strip_prefix = "ecsact_si_wasm-0.1.0", - urls = ["https://github.com/seaube/ecsact_si_wasm/archive/refs/tags/0.1.0.tar.gz"], -) - -http_archive( - name = "ecsact_parse", - sha256 = "706066e8870aa07f6937ca5f3187c7f3bb970255d028790b5f441e24e22d37f6", - strip_prefix = "ecsact_parse-0.2.1", - urls = ["https://github.com/ecsact-dev/ecsact_parse/archive/refs/tags/0.2.1.tar.gz"], -) - -http_archive( - name = "ecsact_runtime", - sha256 = "35b03aaef0925fda5b5aefb2d6a6e2c9593f31d6414ab157091f9ca26a992da3", - strip_prefix = "ecsact_runtime-0.3.0", - urls = ["https://github.com/ecsact-dev/ecsact_runtime/archive/refs/tags/0.3.0.tar.gz"], -) - -http_archive( - name = "ecsact_interpret", - sha256 = "27c42403d6dc9a435346ca94ac6cd385246c22caa2388e1283ca1dbb679167e1", - strip_prefix = "ecsact_interpret-0.3.0", - urls = ["https://github.com/ecsact-dev/ecsact_interpret/archive/refs/tags/0.3.0.tar.gz"], -) - -load("@ecsact_parse//:repositories.bzl", "ecsact_parse_dependencies") - -ecsact_parse_dependencies() - -http_archive( - name = "hedron_compile_commands", - sha256 = "ed5aea1dc87856aa2029cb6940a51511557c5cac3dbbcb05a4abd989862c36b4", - strip_prefix = "bazel-compile-commands-extractor-e16062717d9b098c3c2ac95717d2b3e661c50608", - url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/e16062717d9b098c3c2ac95717d2b3e661c50608.tar.gz", -) - -load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup") - -hedron_compile_commands_setup() - -http_archive( - name = "com_grail_bazel_toolchain", - sha256 = "4ea958dc114d3e02df2dd7864ce4b67b5151f863a0a81d8e66f481c23d94b6f7", - strip_prefix = "bazel-toolchain-edc058a175b93d38db312549b7d93a9a683aa748", - url = "https://github.com/grailbio/bazel-toolchain/archive/edc058a175b93d38db312549b7d93a9a683aa748.zip", -) - -load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies") - -bazel_toolchain_dependencies() - -load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain") - -llvm_toolchain( - name = "llvm_toolchain", - cxx_standard = {"linux": "c++20"}, - distribution = "clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz", - llvm_version = "15.0.6", -) - -load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains") - -llvm_register_toolchains() +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file") + +http_archive( + name = "rules_cc_stamp", + strip_prefix = "rules_cc_stamp-63d4861f4d420b574fa0f112599aae2b8aee785e", + urls = ["https://github.com/zaucy/rules_cc_stamp/archive/63d4861f4d420b574fa0f112599aae2b8aee785e.zip"], + sha256 = "f469a3b97eeabeb850c655f59ea17799ff40badd3a0b3e9de38534c89ad2f87d", +) + +http_archive( + name = "ecsact_si_wasm", + sha256 = "e208a94d4f4a9c09f32b8a9ea91a4f799492e11c7c852b0329b4a3595a45cee6", + strip_prefix = "ecsact_si_wasm-0.1.0", + urls = ["https://github.com/seaube/ecsact_si_wasm/archive/refs/tags/0.1.0.tar.gz"], +) + +http_archive( + name = "hedron_compile_commands", + sha256 = "ed5aea1dc87856aa2029cb6940a51511557c5cac3dbbcb05a4abd989862c36b4", + strip_prefix = "bazel-compile-commands-extractor-e16062717d9b098c3c2ac95717d2b3e661c50608", + url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/e16062717d9b098c3c2ac95717d2b3e661c50608.tar.gz", +) + +load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup") + +hedron_compile_commands_setup() + +http_archive( + name = "com_grail_bazel_toolchain", + sha256 = "4ea958dc114d3e02df2dd7864ce4b67b5151f863a0a81d8e66f481c23d94b6f7", + strip_prefix = "bazel-toolchain-edc058a175b93d38db312549b7d93a9a683aa748", + url = "https://github.com/grailbio/bazel-toolchain/archive/edc058a175b93d38db312549b7d93a9a683aa748.zip", +) + +load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies") + +bazel_toolchain_dependencies() + +load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain") + +llvm_toolchain( + name = "llvm_toolchain", + cxx_standard = {"linux": "c++20"}, + distribution = "clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz", + llvm_version = "15.0.6", +) + +load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains") + +llvm_register_toolchains() diff --git a/bazel/platforms/BUILD.bazel b/bazel/platforms/BUILD.bazel deleted file mode 100644 index dae4bb2..0000000 --- a/bazel/platforms/BUILD.bazel +++ /dev/null @@ -1,19 +0,0 @@ -package(default_visibility = ["//:__subpackages__"]) - -platform( - name = "windows", - constraint_values = [ - "@platforms//cpu:x86_64", - "@platforms//os:windows", - "@bazel_tools//tools/cpp:msvc", - ], -) - -platform( - name = "linux", - constraint_values = [ - "@platforms//cpu:x86_64", - "@platforms//os:linux", - "@bazel_tools//tools/cpp:clang", - ], -) diff --git a/commands/BUILD.bazel b/commands/BUILD.bazel index 556ee76..f9afa36 100644 --- a/commands/BUILD.bazel +++ b/commands/BUILD.bazel @@ -18,8 +18,8 @@ cc_library( ":command", "//executable_path", "@magic_enum", - "@bazelregistry_docopt_cpp//:docopt", - "@boost//libs/dll", + "@docopt.cpp//:docopt", + "@boost.dll", "@ecsact_runtime//:core", "@ecsact_runtime//:async", "@ecsact_runtime//:serialize", @@ -37,11 +37,11 @@ cc_library( ":command", "//executable_path", "@magic_enum", - "@bazelregistry_docopt_cpp//:docopt", - "@boost//libs/dll", + "@docopt.cpp//:docopt", + "@boost.dll", "@ecsact_interpret", - "@ecsact_runtime//:codegen_plugin", - "@ecsact_runtime//:codegen_plugin_validate", + "@ecsact_codegen//:plugin", + "@ecsact_codegen//:plugin_validate", "@ecsact_runtime//:dylib", "@ecsact_runtime//:meta", ], @@ -55,7 +55,7 @@ cc_library( deps = [ ":command", "//executable_path", - "@bazelregistry_docopt_cpp//:docopt", + "@docopt.cpp//:docopt", "@nlohmann_json//:json", ], ) diff --git a/commands/benchmark.cc b/commands/benchmark.cc index a63c6a2..4a2cde8 100644 --- a/commands/benchmark.cc +++ b/commands/benchmark.cc @@ -606,7 +606,7 @@ int ecsact::cli::detail::benchmark_command(int argc, char* argv[]) { ); auto reporter = stdout_json_benchmark_reporter{}; - auto ec = boost::system::error_code{}; + auto ec = std::error_code{}; auto runtime = boost::dll::shared_library(); exists_or_exit(runtime_path); diff --git a/commands/codegen.cc b/commands/codegen.cc index 29b27a9..862f8d2 100644 --- a/commands/codegen.cc +++ b/commands/codegen.cc @@ -12,7 +12,7 @@ #include "ecsact/interpret/eval.hh" #include "ecsact/runtime/meta.h" #include "ecsact/runtime/dylib.h" -#include "ecsact/codegen_plugin.h" +#include "ecsact/codegen/plugin.h" #include "ecsact/codegen/plugin_validate.hh" #include "magic_enum.hpp" @@ -135,8 +135,8 @@ int ecsact::cli::detail::codegen_command(int argc, char* argv[]) { ); if(plugin_path) { - boost::system::error_code ec; - auto& plugin = plugins.emplace_back(); + std::error_code ec; + auto& plugin = plugins.emplace_back(); plugin.load(plugin_path->string(), ec); auto validate_result = ecsact::codegen::plugin_validate(*plugin_path); if(validate_result.ok()) {