Skip to content

Commit

Permalink
Use new @jsonhpp//:singleheader-json also available in 3.11.3.bcr.1
Browse files Browse the repository at this point in the history
We used to patch the module to allow the single header version of
the library to be available. Not needed anymore thanks to
@lromor who added it in BCR in
bazelbuild/bazel-central-registry#2865

Now, use the same name for the old-WORKSPACE based build and the
new MODULE based build; for that the name we provide in
bazel/jsonhpp.BUILD, and all uses in the repo, had to be changed.

While at it: fix formatting in MODULE.bazel.
  • Loading branch information
hzeller committed Oct 11, 2024
1 parent 32b2456 commit efd6695
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/bin/run-clang-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ find . -name "*.h" -o -name "*.cc" \
# If we have buildifier installed, use that on BUILD files
if command -v ${BUILDIFIER} >/dev/null; then
echo "Run $(buildifier --version)"
${BUILDIFIER} -lint=fix WORKSPACE $(find . -name BUILD -o -name "*.bzl")
${BUILDIFIER} -lint=fix WORKSPACE MODULE.bazel $(find . -name BUILD -o -name "*.bzl")
fi

# Check if we got any diff
Expand Down
32 changes: 15 additions & 17 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,74 +4,72 @@ module(

bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "bazel_skylib", version = "1.5.0")

bazel_dep(name = "rules_license", version = "0.0.8")
bazel_dep(name = "rules_proto", version = "6.0.0-rc2")
bazel_dep(name = "rules_cc", version = "0.0.9")

# Register m4 rules and toolchain.
bazel_dep(name = "rules_m4", version = "0.2.3")

m4 = use_extension(
"@rules_m4//m4/extensions:m4_repository_ext.bzl",
"m4_repository_ext",
)
m4.repository(
name = "m4",
version = "1.4.18",
extra_copts = ["-O3"],
version = "1.4.18",
)
use_repo(m4, "m4")

register_toolchains("@m4//:toolchain")

# Register bison rules and toolchain.
bazel_dep(name = "rules_bison", version = "0.2.2")

bison = use_extension(
"@rules_bison//bison/extensions:bison_repository_ext.bzl",
"bison_repository_ext",
)
bison.repository(
name = "bison",
version = "3.3.2",
extra_copts = ["-O3"],
version = "3.3.2",
)
use_repo(bison, "bison")

register_toolchains("@bison//:toolchain")

# Register flex rules and toolchain.
bazel_dep(name = "rules_flex", version = "0.2.1")

flex = use_extension(
"@rules_flex//flex/extensions:flex_repository_ext.bzl",
"flex_repository_ext",
)
flex.repository(
name = "flex",
version = "2.6.4",
extra_copts = ["-O3"],
version = "2.6.4",
)
use_repo(flex, "flex")

register_toolchains("@flex//:toolchain")

# abseil-cpp can not be updated beyond the following curringly, as newer
# ones use googletest that is not compatible with bazel 6 anymore.
bazel_dep(name = "abseil-cpp", version = "20240116.2", repo_name="com_google_absl")
bazel_dep(name = "abseil-cpp", version = "20240116.2", repo_name = "com_google_absl")
single_version_override(
module_name = "abseil-cpp",
patch_strip = 1,
version = "20240116.2",
patches = ["//bazel:absl.patch"],
version = "20240116.2",
)

# Json module only provide the multi-header target, but that will
# make misc-inlude-cleaner complain about not direct includes.
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name="jsonhpp")
single_version_override(
module_name = "nlohmann_json",
patches = ["//bazel:nlohmann_module.patch"],
)

bazel_dep(name = "re2", version = "2023-09-01", repo_name="com_googlesource_code_re2")
bazel_dep(name = "nlohmann_json", version = "3.11.3.bcr.1", repo_name = "jsonhpp")
bazel_dep(name = "re2", version = "2023-09-01", repo_name = "com_googlesource_code_re2")

# Newer versions require bazel 7, so this is the last we can use currently.
bazel_dep(name = "googletest", version = "1.14.0.bcr.1", repo_name="com_google_googletest")
bazel_dep(name = "protobuf", version = "26.0", repo_name="com_google_protobuf")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1", repo_name = "com_google_googletest")
bazel_dep(name = "protobuf", version = "26.0", repo_name = "com_google_protobuf")
bazel_dep(name = "zlib", version = "1.3.1")
2 changes: 1 addition & 1 deletion bazel/jsonhpp.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ licenses(["unencumbered"]) # Public Domain or MIT
exports_files(["LICENSE"])

cc_library(
name = "json",
name = "singleheader-json",
hdrs = [
"single_include/nlohmann/json.hpp",
],
Expand Down
23 changes: 0 additions & 23 deletions bazel/nlohmann_module.patch

This file was deleted.

14 changes: 7 additions & 7 deletions common/lsp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ cc_library(
deps = [
"//common/util:logging",
"@com_google_absl//absl/strings:string_view",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand All @@ -70,7 +70,7 @@ cc_test(
"@com_google_absl//absl/strings:string_view",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand All @@ -85,7 +85,7 @@ genrule(
cc_library(
name = "lsp-protocol",
hdrs = ["lsp-protocol.h"],
deps = ["@jsonhpp//:json"],
deps = ["@jsonhpp//:singleheader-json"],
)

cc_library(
Expand Down Expand Up @@ -167,7 +167,7 @@ cc_binary(
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:string_view",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand All @@ -181,7 +181,7 @@ cc_binary(
":message-stream-splitter",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings:string_view",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand Down Expand Up @@ -224,7 +224,7 @@ genrule(
cc_library(
name = "jcxxgen-testfile",
hdrs = ["jcxxgen-testfile.h"],
deps = ["@jsonhpp//:json"],
deps = ["@jsonhpp//:singleheader-json"],
)

cc_test(
Expand All @@ -240,6 +240,6 @@ cc_test(
"@com_google_absl//absl/strings",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)
4 changes: 2 additions & 2 deletions common/text/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ cc_library(
hdrs = ["token_info_json.h"],
deps = [
":token-info",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand Down Expand Up @@ -415,7 +415,7 @@ cc_test(
"@com_google_absl//absl/strings:string_view",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand Down
4 changes: 2 additions & 2 deletions verilog/CST/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ cc_library(
"//verilog/parser:verilog-token-classifications",
"//verilog/parser:verilog-token-enum",
"@com_google_absl//absl/strings:string_view",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand Down Expand Up @@ -955,6 +955,6 @@ cc_test(
"//verilog/analysis:verilog-analyzer",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)
4 changes: 2 additions & 2 deletions verilog/analysis/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ cc_library(
"//common/analysis:file-analyzer",
"//common/strings:line-column-map",
"@com_google_absl//absl/strings:string_view",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand Down Expand Up @@ -132,7 +132,7 @@ cc_test(
"//common/util:logging",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand Down
10 changes: 5 additions & 5 deletions verilog/tools/ls/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ cc_library(
"//verilog/parser:verilog-token-enum",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:string_view",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand Down Expand Up @@ -138,7 +138,7 @@ cc_library(
"//verilog/CST:package",
"//verilog/CST:seq-block",
"//verilog/CST:verilog-nonterminals",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand Down Expand Up @@ -239,7 +239,7 @@ cc_library(
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings:string_view",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand All @@ -260,7 +260,7 @@ cc_test(
"@com_google_absl//absl/strings:string_view",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand Down Expand Up @@ -312,6 +312,6 @@ cc_test(
"@com_google_absl//absl/strings:string_view",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)
2 changes: 1 addition & 1 deletion verilog/tools/syntax/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ cc_binary(
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:string_view",
"@jsonhpp//:json",
"@jsonhpp//:singleheader-json",
],
)

Expand Down

0 comments on commit efd6695

Please sign in to comment.