diff --git a/.bazelignore b/.bazelignore new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/.bazelignore @@ -0,0 +1 @@ +test diff --git a/.bazelrc b/.bazelrc index 7128875..7cddb69 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,19 +1,3 @@ -startup --windows_enable_symlinks -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 -build --noincompatible_remove_rule_name_parameter -query --noincompatible_remove_rule_name_parameter - -# Temporary until https://github.com/grailbio/bazel-toolchain/pull/198 is merged -build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux - -common:ci --announce_rc -common:ci --verbose_failures -common:ci --keep_going -common:ci --disk_cache=~/.cache/bazel-disk-cache +import %workspace%/bazel/common.bazelrc try-import %workspace%/user.bazelrc diff --git a/.gitignore b/.gitignore index 793fa8b..16b226c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,5 @@ -# bazel -/bazel-* -/user.bazelrc - -# https://github.com/hedronvision/bazel-compile-commands-extractor -/compile_commands.json -/external - -# clangd -/.cache/ +bazel-*/ +user.bazelrc +compile_commands.json +external/ +.cache/ diff --git a/MODULE.bazel b/MODULE.bazel index 273bfeb..086b642 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -2,17 +2,6 @@ module(name = "ecsact_parse") bazel_dep(name = "rules_cc", version = "0.0.8") bazel_dep(name = "bazel_skylib", version = "1.4.2") -bazel_dep(name = "lexy") -bazel_dep(name = "magic_enum") - -git_override( - module_name = "lexy", - remote = "https://github.com/zaucy/lexy", - commit = "6be29cc1b26f93c35b987979ab304ade7a506400", -) - -git_override( - module_name = "magic_enum", - remote = "https://github.com/Neargye/magic_enum", - commit = "745bf36a64962aa113bd04fb9d2d377e7878d2ef", -) +bazel_dep(name = "ecsact_runtime", version = "0.4.1") +bazel_dep(name = "lexy", version = "2022.05.1") +bazel_dep(name = "magic_enum", version = "0.9.3") diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 57a9fc7..de68140 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -1,16 +1,4 @@ -workspace(name = "ecsact_parse") - load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("//:repositories.bzl", "ecsact_parse_dependencies") - -ecsact_parse_dependencies() - -http_archive( - name = "com_google_googletest", - sha256 = "d4cb2430eb82495a49a24310a609b99726726bf126c2fbfa92fd04c14f6a3b31", - strip_prefix = "googletest-d1a0039b97291dd1dc14f123b906bb7622ffe07c", - url = "https://github.com/google/googletest/archive/d1a0039b97291dd1dc14f123b906bb7622ffe07c.zip", -) http_archive( name = "hedron_compile_commands", 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/repositories.bzl b/repositories.bzl deleted file mode 100644 index cb2acdd..0000000 --- a/repositories.bzl +++ /dev/null @@ -1,20 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_archive = "http_archive") -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") - -def http_archive(name, **kwargs): - maybe(_http_archive, name = name, **kwargs) - -def ecsact_parse_dependencies(): - http_archive( - name = "bazel_sundry", - sha256 = "4ee3c8e29eb3d4f34b1ca7d2374437b5c6f0fd62316f90e38e9f32119421466d", - strip_prefix = "bazel_sundry-de785e9f424948949cafed3ee8bee9689dc84a80", - url = "https://github.com/seaube/bazel_sundry/archive/de785e9f424948949cafed3ee8bee9689dc84a80.zip", - ) - - http_archive( - name = "ecsact_runtime", - sha256 = "219ce161deeb4865d3c190eac300dd257671e2b2ca0ec8752091506ccfa554a2", - strip_prefix = "ecsact_runtime-5cbf7257d7cbc42762d22e7604bc5bc0efb837fe", - url = "https://github.com/ecsact-dev/ecsact_runtime/archive/5cbf7257d7cbc42762d22e7604bc5bc0efb837fe.zip", - ) diff --git a/test/.bazelrc b/test/.bazelrc new file mode 100644 index 0000000..9977a1b --- /dev/null +++ b/test/.bazelrc @@ -0,0 +1,3 @@ +import %workspace%/../bazel/common.bazelrc + +try-import %workspace%/user.bazelrc diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 48bc686..2572890 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -1,5 +1,5 @@ load("@rules_cc//cc:defs.bzl", "cc_test") -load("//bazel:copts.bzl", "copts") +load("@ecsact_parse//bazel:copts.bzl", "copts") # keep sorted _TESTS = [ @@ -24,8 +24,8 @@ _TESTS = [ srcs = ["parse_test_{}.cc".format(test)], copts = copts, deps = [ - "//:ecsact_parse", - "@com_google_googletest//:gtest", - "@com_google_googletest//:gtest_main", + "@ecsact_parse", + "@googletest//:gtest", + "@googletest//:gtest_main", ], ) for test in _TESTS] diff --git a/test/MODULE.bazel b/test/MODULE.bazel new file mode 100644 index 0000000..08c28d1 --- /dev/null +++ b/test/MODULE.bazel @@ -0,0 +1,10 @@ +module(name = "ecsact_parse_test") + +bazel_dep(name = "rules_cc", version = "0.0.8") +bazel_dep(name = "googletest", version = "1.14.0") +bazel_dep(name = "ecsact_parse") + +local_path_override( + module_name = "ecsact_parse", + path = "..", +) diff --git a/test/WORKSPACE.bazel b/test/WORKSPACE.bazel new file mode 100644 index 0000000..470a70b --- /dev/null +++ b/test/WORKSPACE.bazel @@ -0,0 +1,34 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +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 = "c53acf847fb52198758635490c5e987aacc7c64a5731a4027824762ba4e3f961", + strip_prefix = "bazel-toolchain-c217c03479717279035906273702b8bc3309bbb4", + url = "https://github.com/grailbio/bazel-toolchain/archive/c217c03479717279035906273702b8bc3309bbb4.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", + llvm_version = "16.0.4", +) + +load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains") + +llvm_register_toolchains()