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>
diff --git a/BUILD.bazel b/BUILD.bazel
index 2227fee..45f7a21 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -1,6 +1,7 @@
-licenses(["unencumbered"])  # Public Domain or MIT
-
 load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
+load("@rules_cc//cc:cc_library.bzl", "cc_library")
+
+licenses(["unencumbered"])  # Public Domain or MIT
 
 exports_files(["LICENSE"])
 
@@ -36,9 +37,9 @@
         "include/json/allocator.h",
         "include/json/assertions.h",
         "include/json/config.h",
-        "include/json/json_features.h",
         "include/json/forwards.h",
         "include/json/json.h",
+        "include/json/json_features.h",
         "include/json/reader.h",
         "include/json/value.h",
         "include/json/version.h",
diff --git a/MODULE.bazel b/MODULE.bazel
index e60fa06..e29304f 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -17,3 +17,11 @@
     name = "bazel_skylib",
     version = "1.7.1",
 )
+bazel_dep(
+    name = "rules_cc",
+    version = "0.0.17",
+)
+bazel_dep(
+    name = "rules_python",
+    version = "1.0.0",
+)
diff --git a/example/BUILD.bazel b/example/BUILD.bazel
index 38e7dfc..ebbd0b5 100644
--- a/example/BUILD.bazel
+++ b/example/BUILD.bazel
@@ -1,17 +1,19 @@
+load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
+
 cc_binary(
     name = "readFromStream_ok",
     srcs = ["readFromStream/readFromStream.cpp"],
-    deps = ["//:jsoncpp"],
     args = ["$(location :readFromStream/withComment.json)"],
     data = ["readFromStream/withComment.json"],
+    deps = ["//:jsoncpp"],
 )
 
 cc_binary(
     name = "readFromStream_err",
     srcs = ["readFromStream/readFromStream.cpp"],
-    deps = ["//:jsoncpp"],
     args = ["$(location :readFromStream/errorFormat.json)"],
     data = ["readFromStream/errorFormat.json"],
+    deps = ["//:jsoncpp"],
 )
 
 cc_binary(
diff --git a/src/jsontestrunner/BUILD.bazel b/src/jsontestrunner/BUILD.bazel
index 543bc5d..fa1f395 100644
--- a/src/jsontestrunner/BUILD.bazel
+++ b/src/jsontestrunner/BUILD.bazel
@@ -1,6 +1,8 @@
+load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
+
 cc_binary(
     name = "jsontestrunner",
     srcs = ["main.cpp"],
-    deps = ["//:jsoncpp"],
     visibility = ["//test:__pkg__"],
+    deps = ["//:jsoncpp"],
 )
diff --git a/src/test_lib_json/BUILD.bazel b/src/test_lib_json/BUILD.bazel
index 7e83f52..18b2a18 100644
--- a/src/test_lib_json/BUILD.bazel
+++ b/src/test_lib_json/BUILD.bazel
@@ -1,11 +1,13 @@
+load("@rules_cc//cc:cc_test.bzl", "cc_test")
+
 cc_test(
     name = "jsoncpp_test",
     srcs = [
+        "fuzz.cpp",
+        "fuzz.h",
         "jsontest.cpp",
         "jsontest.h",
         "main.cpp",
-        "fuzz.h",
-        "fuzz.cpp",
-        ],
+    ],
     deps = ["//:jsoncpp"],
 )
diff --git a/test/BUILD.bazel b/test/BUILD.bazel
index 269cd86..c1a3623 100644
--- a/test/BUILD.bazel
+++ b/test/BUILD.bazel
@@ -1,20 +1,29 @@
+load("@rules_python//python:defs.bzl", "py_test")
+
 filegroup(
     name = "expected",
-    srcs = glob(["data/**", "jsonchecker/**"], exclude=["**/*.json"]),
+    srcs = glob(
+        [
+            "data/**",
+            "jsonchecker/**",
+        ],
+        exclude = ["**/*.json"],
+    ),
 )
 
 [py_test(
     name = "runjson_%s_test" % "_".join(f.split("/")),
     srcs = ["runjsontests.py"],
-    main = "runjsontests.py",
     args = [
         "--with-json-checker",
         "$(location //src/jsontestrunner:jsontestrunner)",
         "$(location :%s)" % f,
     ],
     data = [
-        "//src/jsontestrunner:jsontestrunner",
         ":expected",
+        "//src/jsontestrunner",
         ":%s" % f,
     ],
+    main = "runjsontests.py",
+    tags = ["no-sandbox"],
 ) for f in glob(["**/*.json"])]