From 745bf36a64962aa113bd04fb9d2d377e7878d2ef Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Wed, 23 Aug 2023 02:40:03 -0700 Subject: [PATCH] bazel updates (#291) --- .bazelignore | 5 +++++ .bazelrc | 9 --------- .bazelversion | 2 +- .github/workflows/macos.yml | 1 + .github/workflows/ubuntu.yml | 1 + .github/workflows/windows.yml | 1 + MODULE.bazel | 16 ++++++++-------- bazel/copts.bzl | 15 +++++++++++---- bazel/platforms/BUILD.bazel | 25 ------------------------- test/MODULE.bazel | 13 ++++++------- 10 files changed, 34 insertions(+), 54 deletions(-) create mode 100644 .bazelignore delete mode 100644 bazel/platforms/BUILD.bazel diff --git a/.bazelignore b/.bazelignore new file mode 100644 index 0000000..c9ae943 --- /dev/null +++ b/.bazelignore @@ -0,0 +1,5 @@ +.git +.github +test +doc +cmake \ No newline at end of file diff --git a/.bazelrc b/.bazelrc index 88375a4..276886d 100644 --- a/.bazelrc +++ b/.bazelrc @@ -4,15 +4,6 @@ build --incompatible_use_platforms_repo_for_constraints build --enable_runfiles build --incompatible_strict_action_env -build:linux --host_platform=@magic_enum//bazel/platforms:linux -build:linux --platforms=@magic_enum//bazel/platforms:linux - -build:macos --host_platform=@magic_enum//bazel/platforms:macos -build:macos --platforms=@magic_enum//bazel/platforms:macos - -build:windows --host_platform=@magic_enum//bazel/platforms:windows -build:windows --platforms=@magic_enum//bazel/platforms:windows - common:ci --announce_rc test:ci --test_output=errors build:ci --curses=no diff --git a/.bazelversion b/.bazelversion index db795d2..0c80254 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.1.2 +6.3.2 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index f7ba5db..f9501a5 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -38,4 +38,5 @@ jobs: - name: Bazel Test continue-on-error: true + working-directory: test run: bazelisk test //... --config=ci diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 2f5625d..2334514 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -75,4 +75,5 @@ jobs: - name: Bazel Test continue-on-error: true + working-directory: test run: bazelisk test //... --config=ci diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 6ca7dca..5108385 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -44,4 +44,5 @@ jobs: - name: Bazel Test continue-on-error: true + working-directory: test run: bazelisk test //... --config=ci diff --git a/MODULE.bazel b/MODULE.bazel index c0fe64a..39c6bbc 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,8 +1,8 @@ -module( - name = "magic_enum", - version = "0.9.3", - compatibility_level = 0, -) - -bazel_dep(name = "platforms", version = "0.0.6") -bazel_dep(name = "rules_cc", version = "0.0.6") +module( + name = "magic_enum", + version = "0.9.3", + compatibility_level = 0, +) + +bazel_dep(name = "rules_cc", version = "0.0.8") +bazel_dep(name = "bazel_skylib", version = "1.4.2") diff --git a/bazel/copts.bzl b/bazel/copts.bzl index 1faee13..cc072e7 100644 --- a/bazel/copts.bzl +++ b/bazel/copts.bzl @@ -1,4 +1,11 @@ -COPTS = select({ - "@bazel_tools//tools/cpp:msvc": ["/std:c++17", "/permissive-"], - "//conditions:default": ["-std=c++17"], -}) +load("@bazel_skylib//lib:selects.bzl", "selects") + +COPTS = selects.with_or({ + ("@rules_cc//cc/compiler:clang", "@rules_cc//cc/compiler:gcc", "@rules_cc//cc/compiler:mingw-gcc"): [ + "-std=c++17", + ], + ("@rules_cc//cc/compiler:msvc-cl", "@rules_cc//cc/compiler:clang-cl"): [ + "/std:c++17", + "/permissive-", + ], +}) diff --git a/bazel/platforms/BUILD.bazel b/bazel/platforms/BUILD.bazel deleted file mode 100644 index ea8a807..0000000 --- a/bazel/platforms/BUILD.bazel +++ /dev/null @@ -1,25 +0,0 @@ -package(default_visibility = ["//:__subpackages__"]) - -platform( - name = "linux", - constraint_values = [ - "@platforms//os:linux", - "@bazel_tools//tools/cpp:clang", - ], -) - -platform( - name = "macos", - constraint_values = [ - "@platforms//os:macos", - "@bazel_tools//tools/cpp:clang", - ], -) - -platform( - name = "windows", - constraint_values = [ - "@platforms//os:windows", - "@bazel_tools//tools/cpp:msvc", - ], -) diff --git a/test/MODULE.bazel b/test/MODULE.bazel index 2535c43..647799f 100644 --- a/test/MODULE.bazel +++ b/test/MODULE.bazel @@ -1,7 +1,6 @@ -module(name = "magic_enum_tests") - -bazel_dep(name = "magic_enum") -bazel_dep(name = "platforms", version = "0.0.6") -bazel_dep(name = "rules_cc", version = "0.0.6") - -local_path_override(module_name = "magic_enum", path = "..") +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 = "..")