Skip to content

Commit 3455302

Browse files
keithbaylesj
andauthored
Update bazel config for 9.x (#1655)
* Update bazel config for 9.x Bazel 9.x+ requires explicit load statements for things that were previously included in bazel. I automatically added these with `buildifier` and added some reasonable minimum versions to the MODULE.bazel file. * Fix tests for Bazel 9.x sandbox --------- Co-authored-by: Jordan Bayles <jophba@chromium.org> Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
1 parent ce757be commit 3455302

File tree

6 files changed

+36
-12
lines changed

6 files changed

+36
-12
lines changed

BUILD.bazel

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
licenses(["unencumbered"]) # Public Domain or MIT
2-
31
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
2+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
3+
4+
licenses(["unencumbered"]) # Public Domain or MIT
45

56
exports_files(["LICENSE"])
67

@@ -36,9 +37,9 @@ cc_library(
3637
"include/json/allocator.h",
3738
"include/json/assertions.h",
3839
"include/json/config.h",
39-
"include/json/json_features.h",
4040
"include/json/forwards.h",
4141
"include/json/json.h",
42+
"include/json/json_features.h",
4243
"include/json/reader.h",
4344
"include/json/value.h",
4445
"include/json/version.h",

MODULE.bazel

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@ bazel_dep(
1717
name = "bazel_skylib",
1818
version = "1.7.1",
1919
)
20+
bazel_dep(
21+
name = "rules_cc",
22+
version = "0.0.17",
23+
)
24+
bazel_dep(
25+
name = "rules_python",
26+
version = "1.0.0",
27+
)

example/BUILD.bazel

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1+
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
2+
13
cc_binary(
24
name = "readFromStream_ok",
35
srcs = ["readFromStream/readFromStream.cpp"],
4-
deps = ["//:jsoncpp"],
56
args = ["$(location :readFromStream/withComment.json)"],
67
data = ["readFromStream/withComment.json"],
8+
deps = ["//:jsoncpp"],
79
)
810

911
cc_binary(
1012
name = "readFromStream_err",
1113
srcs = ["readFromStream/readFromStream.cpp"],
12-
deps = ["//:jsoncpp"],
1314
args = ["$(location :readFromStream/errorFormat.json)"],
1415
data = ["readFromStream/errorFormat.json"],
16+
deps = ["//:jsoncpp"],
1517
)
1618

1719
cc_binary(

src/jsontestrunner/BUILD.bazel

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
2+
13
cc_binary(
24
name = "jsontestrunner",
35
srcs = ["main.cpp"],
4-
deps = ["//:jsoncpp"],
56
visibility = ["//test:__pkg__"],
7+
deps = ["//:jsoncpp"],
68
)

src/test_lib_json/BUILD.bazel

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
load("@rules_cc//cc:cc_test.bzl", "cc_test")
2+
13
cc_test(
24
name = "jsoncpp_test",
35
srcs = [
6+
"fuzz.cpp",
7+
"fuzz.h",
48
"jsontest.cpp",
59
"jsontest.h",
610
"main.cpp",
7-
"fuzz.h",
8-
"fuzz.cpp",
9-
],
11+
],
1012
deps = ["//:jsoncpp"],
1113
)

test/BUILD.bazel

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1+
load("@rules_python//python:defs.bzl", "py_test")
2+
13
filegroup(
24
name = "expected",
3-
srcs = glob(["data/**", "jsonchecker/**"], exclude=["**/*.json"]),
5+
srcs = glob(
6+
[
7+
"data/**",
8+
"jsonchecker/**",
9+
],
10+
exclude = ["**/*.json"],
11+
),
412
)
513

614
[py_test(
715
name = "runjson_%s_test" % "_".join(f.split("/")),
816
srcs = ["runjsontests.py"],
9-
main = "runjsontests.py",
1017
args = [
1118
"--with-json-checker",
1219
"$(location //src/jsontestrunner:jsontestrunner)",
1320
"$(location :%s)" % f,
1421
],
1522
data = [
16-
"//src/jsontestrunner:jsontestrunner",
1723
":expected",
24+
"//src/jsontestrunner",
1825
":%s" % f,
1926
],
27+
main = "runjsontests.py",
28+
tags = ["no-sandbox"],
2029
) for f in glob(["**/*.json"])]

0 commit comments

Comments
 (0)