Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Bazel #312

Merged
merged 2 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//bazel:copts.bzl", "COPTS")

licenses(["notice"])

exports_files(["LICENSE"])
Expand All @@ -10,6 +7,5 @@ package(default_visibility = ["//visibility:public"])
cc_library(
name = "magic_enum",
hdrs = glob(["include/magic_enum/*.hpp"]),
copts = COPTS,
includes = ["include/magic_enum"],
)
3 changes: 0 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ module(
version = "0.9.4",
compatibility_level = 0,
)

bazel_dep(name = "rules_cc", version = "0.0.8")
bazel_dep(name = "bazel_skylib", version = "1.4.2")
Empty file removed bazel/BUILD.bazel
Empty file.
11 changes: 0 additions & 11 deletions bazel/copts.bzl

This file was deleted.

28 changes: 15 additions & 13 deletions test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
load("@magic_enum//bazel:copts.bzl", "COPTS")

# bazel central registry has a catch2 module, but is newer than the one included
# in this repository
cc_library(
name = "catch2",
includes = ["3rdparty/Catch2/include"],
hdrs = ["3rdparty/Catch2/include/catch2/catch.hpp"],
copts = COPTS,
)

_TESTS = [
"test",
"test_flags",
]

_MSVC_FLAGS = ["/std:c++17", "/permissive-"]
_COPTS = select({
"//conditions:default": ["-std=c++17"],
"@rules_cc//cc/compiler:msvc-cl": _MSVC_FLAGS,
"@rules_cc//cc/compiler:clang-cl": _MSVC_FLAGS,
})
[cc_test(
name = test,
srcs = ["{}.cpp".format(test)],
deps = ["@magic_enum", ":catch2"],
copts = COPTS,
copts = _COPTS,
) for test in _TESTS]

# bazel central registry has a catch2 module, but is newer than the one included
# in this repository
cc_library(
name = "catch2",
includes = ["3rdparty/Catch2/include"],
hdrs = ["3rdparty/Catch2/include/catch2/catch.hpp"],
)
4 changes: 2 additions & 2 deletions test/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module(name = "magic_enum_tests")

bazel_dep(name = "magic_enum")
bazel_dep(name = "rules_cc", version = "0.0.8")

local_path_override(module_name = "magic_enum", path = "..")

bazel_dep(name = "rules_cc", version = "0.0.8")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe put the bazel dep back up top? :P

Copy link
Contributor Author

@cpsauer cpsauer Nov 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd reordered intentionally, thinking we might want the magic-enum dependency configuration all together for clarity that it's being overridden and quick-skimmability.

But I don't feel super strongly or anything--feel free to change if you feel strongly the other way? Or generally lmk if you think there's a different principle I should be absorbing here.

(I'm assuming from the approval that you don't want to block merging on this, yeah? Still v interested in what you have to say, ofc.)