From 623c6237f76bb22cbd987fb7cfe8f01dc6fcb997 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 5 Dec 2024 08:21:45 -0800 Subject: [PATCH] Load java rules from rules_java. (#186) Signed-off-by: Benjamin Peterson --- .bazelversion | 2 +- MODULE.bazel | 1 + .../com/engflow/bazel/invocation/analyzer/bazelprofile/BUILD | 2 ++ .../java/com/engflow/bazel/invocation/analyzer/core/BUILD | 2 ++ .../com/engflow/bazel/invocation/analyzer/dataproviders/BUILD | 2 ++ .../invocation/analyzer/dataproviders/remoteexecution/BUILD | 2 ++ .../bazel/invocation/analyzer/suggestionproviders/BUILD | 2 ++ .../java/com/engflow/bazel/invocation/analyzer/time/BUILD | 2 ++ .../engflow/bazel/invocation/analyzer/traceeventformat/BUILD | 2 ++ .../javatests/com/engflow/bazel/invocation/analyzer/BUILD | 4 +++- .../com/engflow/bazel/invocation/analyzer/bazelprofile/BUILD | 2 ++ .../com/engflow/bazel/invocation/analyzer/core/BUILD | 2 ++ .../com/engflow/bazel/invocation/analyzer/dataproviders/BUILD | 2 ++ .../invocation/analyzer/dataproviders/remoteexecution/BUILD | 2 ++ .../engflow/bazel/invocation/analyzer/integrationtests/BUILD | 2 ++ .../bazel/invocation/analyzer/suggestionproviders/BUILD | 2 ++ .../com/engflow/bazel/invocation/analyzer/time/BUILD | 2 ++ .../engflow/bazel/invocation/analyzer/traceeventformat/BUILD | 2 ++ cli/BUILD | 2 ++ cli/java/com/engflow/bazel/invocation/analyzer/BUILD | 2 ++ .../com/engflow/bazel/invocation/analyzer/consoleoutput/BUILD | 2 ++ cli/java/com/engflow/bazel/invocation/analyzer/options/BUILD | 2 ++ .../com/engflow/bazel/invocation/analyzer/consoleoutput/BUILD | 2 ++ proto/BUILD | 1 + third_party/buildifier/BUILD | 4 ++-- third_party/commons-cli/BUILD | 2 ++ third_party/google-java-format/BUILD | 2 ++ third_party/gson/BUILD | 2 ++ third_party/guava/BUILD | 2 ++ third_party/jsr305/BUILD | 2 ++ third_party/junit/BUILD | 2 ++ third_party/mockito/BUILD | 2 ++ third_party/truth/BUILD | 2 ++ 33 files changed, 64 insertions(+), 4 deletions(-) diff --git a/.bazelversion b/.bazelversion index b26a34e..815da58 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.2.1 +7.4.1 diff --git a/MODULE.bazel b/MODULE.bazel index 779bc3c..84415b6 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -11,6 +11,7 @@ module( bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "buildifier_prebuilt", version = "6.4.0") bazel_dep(name = "platforms", version = "0.0.10") +bazel_dep(name = "rules_java", version = "8.6.1") bazel_dep(name = "rules_jvm_external", version = "6.2") bazel_dep(name = "rules_proto", version = "6.0.2") bazel_dep(name = "protobuf", version = "27.2") diff --git a/analyzer/java/com/engflow/bazel/invocation/analyzer/bazelprofile/BUILD b/analyzer/java/com/engflow/bazel/invocation/analyzer/bazelprofile/BUILD index 19e6a0b..216cf65 100644 --- a/analyzer/java/com/engflow/bazel/invocation/analyzer/bazelprofile/BUILD +++ b/analyzer/java/com/engflow/bazel/invocation/analyzer/bazelprofile/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + TYPES = [ "BazelProfileConstants.java", "BazelProfilePhase.java", diff --git a/analyzer/java/com/engflow/bazel/invocation/analyzer/core/BUILD b/analyzer/java/com/engflow/bazel/invocation/analyzer/core/BUILD index 72ef531..7421813 100644 --- a/analyzer/java/com/engflow/bazel/invocation/analyzer/core/BUILD +++ b/analyzer/java/com/engflow/bazel/invocation/analyzer/core/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "core", srcs = glob(["*.java"]), diff --git a/analyzer/java/com/engflow/bazel/invocation/analyzer/dataproviders/BUILD b/analyzer/java/com/engflow/bazel/invocation/analyzer/dataproviders/BUILD index 30c9d32..c8138d9 100644 --- a/analyzer/java/com/engflow/bazel/invocation/analyzer/dataproviders/BUILD +++ b/analyzer/java/com/engflow/bazel/invocation/analyzer/dataproviders/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + TYPES = [ "ActionStats.java", "BazelPhaseDescription.java", diff --git a/analyzer/java/com/engflow/bazel/invocation/analyzer/dataproviders/remoteexecution/BUILD b/analyzer/java/com/engflow/bazel/invocation/analyzer/dataproviders/remoteexecution/BUILD index d1d36c0..3740608 100644 --- a/analyzer/java/com/engflow/bazel/invocation/analyzer/dataproviders/remoteexecution/BUILD +++ b/analyzer/java/com/engflow/bazel/invocation/analyzer/dataproviders/remoteexecution/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + TYPES = [ "CriticalPathQueuingDuration.java", "QueuingObserved.java", diff --git a/analyzer/java/com/engflow/bazel/invocation/analyzer/suggestionproviders/BUILD b/analyzer/java/com/engflow/bazel/invocation/analyzer/suggestionproviders/BUILD index 04c5573..aa31442 100644 --- a/analyzer/java/com/engflow/bazel/invocation/analyzer/suggestionproviders/BUILD +++ b/analyzer/java/com/engflow/bazel/invocation/analyzer/suggestionproviders/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "suggestionproviders", srcs = glob(["*.java"]), diff --git a/analyzer/java/com/engflow/bazel/invocation/analyzer/time/BUILD b/analyzer/java/com/engflow/bazel/invocation/analyzer/time/BUILD index 4f471dd..bae8770 100644 --- a/analyzer/java/com/engflow/bazel/invocation/analyzer/time/BUILD +++ b/analyzer/java/com/engflow/bazel/invocation/analyzer/time/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + package(default_visibility = ["//visibility:public"]) java_library( diff --git a/analyzer/java/com/engflow/bazel/invocation/analyzer/traceeventformat/BUILD b/analyzer/java/com/engflow/bazel/invocation/analyzer/traceeventformat/BUILD index bd3ec43..248fe67 100644 --- a/analyzer/java/com/engflow/bazel/invocation/analyzer/traceeventformat/BUILD +++ b/analyzer/java/com/engflow/bazel/invocation/analyzer/traceeventformat/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "traceeventformat", srcs = glob(["*.java"]), diff --git a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/BUILD b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/BUILD index 24ec251..cb80c49 100644 --- a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/BUILD +++ b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "test_base", testonly = True, @@ -14,7 +16,7 @@ java_library( "//third_party/jsr305", "//third_party/junit", "//third_party/mockito", - "@bazel_tools//tools/java/runfiles", + "@rules_java//java/runfiles", ], ) diff --git a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/bazelprofile/BUILD b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/bazelprofile/BUILD index dcd91d5..7aec094 100644 --- a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/bazelprofile/BUILD +++ b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/bazelprofile/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_test") + java_test( name = "bazelprofile", srcs = glob(["**/*.java"]), diff --git a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/core/BUILD b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/core/BUILD index 6e6f128..41c5ad5 100644 --- a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/core/BUILD +++ b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/core/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library", "java_test") + TYPES = [ "TestDatum.java", ] diff --git a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/dataproviders/BUILD b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/dataproviders/BUILD index a841d74..cfa94d9 100644 --- a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/dataproviders/BUILD +++ b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/dataproviders/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library", "java_test") + java_test( name = "dataproviders", srcs = glob( diff --git a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/dataproviders/remoteexecution/BUILD b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/dataproviders/remoteexecution/BUILD index 5fc3c88..d077eab 100644 --- a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/dataproviders/remoteexecution/BUILD +++ b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/dataproviders/remoteexecution/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_test") + java_test( name = "remoteexecution", srcs = glob(["**/*.java"]), diff --git a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/integrationtests/BUILD b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/integrationtests/BUILD index 82ec08a..3706e9a 100644 --- a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/integrationtests/BUILD +++ b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/integrationtests/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_test") + java_test( name = "integrationtests", srcs = glob(["**/*.java"]), diff --git a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/suggestionproviders/BUILD b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/suggestionproviders/BUILD index abc9c87..8736ecf 100644 --- a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/suggestionproviders/BUILD +++ b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/suggestionproviders/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_test") + java_test( name = "suggestionproviders", srcs = glob(["**/*.java"]), diff --git a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/time/BUILD b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/time/BUILD index 62d2017..73d1d6e 100644 --- a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/time/BUILD +++ b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/time/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_test") + java_test( name = "time", srcs = glob(["**/*.java"]), diff --git a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/traceeventformat/BUILD b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/traceeventformat/BUILD index 1a937be..ce9eca9 100644 --- a/analyzer/javatests/com/engflow/bazel/invocation/analyzer/traceeventformat/BUILD +++ b/analyzer/javatests/com/engflow/bazel/invocation/analyzer/traceeventformat/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_test") + java_test( name = "traceeventformat", srcs = glob(["**/*.java"]), diff --git a/cli/BUILD b/cli/BUILD index 2c53151..e1f620c 100644 --- a/cli/BUILD +++ b/cli/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_binary") + java_binary( name = "cli", main_class = "com.engflow.bazel.invocation.analyzer.Main", diff --git a/cli/java/com/engflow/bazel/invocation/analyzer/BUILD b/cli/java/com/engflow/bazel/invocation/analyzer/BUILD index c5d18c1..fc2a0d9 100644 --- a/cli/java/com/engflow/bazel/invocation/analyzer/BUILD +++ b/cli/java/com/engflow/bazel/invocation/analyzer/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "analyzer", srcs = glob(["*.java"]), diff --git a/cli/java/com/engflow/bazel/invocation/analyzer/consoleoutput/BUILD b/cli/java/com/engflow/bazel/invocation/analyzer/consoleoutput/BUILD index d9d3381..03ec097 100644 --- a/cli/java/com/engflow/bazel/invocation/analyzer/consoleoutput/BUILD +++ b/cli/java/com/engflow/bazel/invocation/analyzer/consoleoutput/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "consoleoutput", srcs = glob( diff --git a/cli/java/com/engflow/bazel/invocation/analyzer/options/BUILD b/cli/java/com/engflow/bazel/invocation/analyzer/options/BUILD index fa9db7b..66cbcb8 100644 --- a/cli/java/com/engflow/bazel/invocation/analyzer/options/BUILD +++ b/cli/java/com/engflow/bazel/invocation/analyzer/options/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "options", srcs = glob( diff --git a/cli/javatests/com/engflow/bazel/invocation/analyzer/consoleoutput/BUILD b/cli/javatests/com/engflow/bazel/invocation/analyzer/consoleoutput/BUILD index b692f2c..76008cb 100644 --- a/cli/javatests/com/engflow/bazel/invocation/analyzer/consoleoutput/BUILD +++ b/cli/javatests/com/engflow/bazel/invocation/analyzer/consoleoutput/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_test") + java_test( name = "consoleoutput", srcs = glob(["*.java"]), diff --git a/proto/BUILD b/proto/BUILD index 361ed6c..3b6821e 100644 --- a/proto/BUILD +++ b/proto/BUILD @@ -1,3 +1,4 @@ +load("@rules_java//java:defs.bzl", "java_proto_library") load("@rules_proto//proto:defs.bzl", "proto_library") proto_library( diff --git a/third_party/buildifier/BUILD b/third_party/buildifier/BUILD index 0b4bcea..eecf0b0 100644 --- a/third_party/buildifier/BUILD +++ b/third_party/buildifier/BUILD @@ -1,7 +1,7 @@ -package(default_visibility = ["//infra:__subpackages__"]) - load("@buildifier_prebuilt//:rules.bzl", "buildifier_binary") +package(default_visibility = ["//infra:__subpackages__"]) + buildifier_binary( name = "buildifier", visibility = ["//visibility:public"], diff --git a/third_party/commons-cli/BUILD b/third_party/commons-cli/BUILD index 85d3df5..70b710e 100644 --- a/third_party/commons-cli/BUILD +++ b/third_party/commons-cli/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "commons_cli", visibility = ["//visibility:public"], diff --git a/third_party/google-java-format/BUILD b/third_party/google-java-format/BUILD index ce84fc5..c6cdd83 100644 --- a/third_party/google-java-format/BUILD +++ b/third_party/google-java-format/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_binary") + package(default_visibility = ["//infra:__subpackages__"]) java_binary( diff --git a/third_party/gson/BUILD b/third_party/gson/BUILD index 541b4d7..1fa7f25 100644 --- a/third_party/gson/BUILD +++ b/third_party/gson/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "gson", visibility = ["//visibility:public"], diff --git a/third_party/guava/BUILD b/third_party/guava/BUILD index d0cae28..754425d 100644 --- a/third_party/guava/BUILD +++ b/third_party/guava/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "guava", visibility = ["//visibility:public"], diff --git a/third_party/jsr305/BUILD b/third_party/jsr305/BUILD index 0a31986..c3f8633 100644 --- a/third_party/jsr305/BUILD +++ b/third_party/jsr305/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "jsr305", visibility = ["//visibility:public"], diff --git a/third_party/junit/BUILD b/third_party/junit/BUILD index eb63e32..c25904b 100644 --- a/third_party/junit/BUILD +++ b/third_party/junit/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "junit", testonly = 1, diff --git a/third_party/mockito/BUILD b/third_party/mockito/BUILD index 44df90f..5fb95ba 100644 --- a/third_party/mockito/BUILD +++ b/third_party/mockito/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "mockito", testonly = 1, diff --git a/third_party/truth/BUILD b/third_party/truth/BUILD index 293013e..68b8e70 100644 --- a/third_party/truth/BUILD +++ b/third_party/truth/BUILD @@ -1,3 +1,5 @@ +load("@rules_java//java:defs.bzl", "java_library") + java_library( name = "truth", testonly = 1,