Skip to content

Commit

Permalink
chore: bzlmod tests (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Sep 14, 2023
1 parent f4dcc5e commit e42381c
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 96 deletions.
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
18 changes: 1 addition & 17 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -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
15 changes: 5 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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/
17 changes: 3 additions & 14 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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")
12 changes: 0 additions & 12 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
19 changes: 0 additions & 19 deletions bazel/platforms/BUILD.bazel

This file was deleted.

20 changes: 0 additions & 20 deletions repositories.bzl

This file was deleted.

3 changes: 3 additions & 0 deletions test/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import %workspace%/../bazel/common.bazelrc

try-import %workspace%/user.bazelrc
8 changes: 4 additions & 4 deletions test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -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]
10 changes: 10 additions & 0 deletions test/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -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 = "..",
)
34 changes: 34 additions & 0 deletions test/WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit e42381c

Please sign in to comment.