diff --git a/test/repositories.bzl b/test/repositories.bzl index edd45b4..1260d71 100644 --- a/test/repositories.bzl +++ b/test/repositories.bzl @@ -1,17 +1,20 @@ """Test dependencies for rules_java.""" load("@bazel_skylib//lib:modules.bzl", "modules") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_jar") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") def test_repositories(): - http_jar( + http_file( name = "guava", url = "https://repo1.maven.org/maven2/com/google/guava/guava/33.3.1-jre/guava-33.3.1-jre.jar", integrity = "sha256-S/Dixa+ORSXJbo/eF6T3MH+X+EePEcTI41oOMpiuTpA=", + downloaded_file_path = "guava.jar", ) - http_jar( + http_file( name = "truth", url = "https://repo1.maven.org/maven2/com/google/truth/truth/1.4.4/truth-1.4.4.jar", + integrity = "sha256-Ushs3a3DG8hFfB4VaJ/Gt14ul84qg9i1S3ldVW1In4w=", + downloaded_file_path = "truth.jar", ) test_repositories_ext = modules.as_extension(test_repositories) diff --git a/test/runfiles/src/test/java/com/google/devtools/build/runfiles/BUILD b/test/runfiles/src/test/java/com/google/devtools/build/runfiles/BUILD index cf9b040..230ad06 100644 --- a/test/runfiles/src/test/java/com/google/devtools/build/runfiles/BUILD +++ b/test/runfiles/src/test/java/com/google/devtools/build/runfiles/BUILD @@ -1,11 +1,14 @@ -load("@rules_java//java:defs.bzl", "java_library", "java_test") +load("@rules_java//java:java_import.bzl", "java_import") +load("@rules_java//java:java_test.bzl", "java_test") java_test( name = "RunfilesTest", srcs = ["RunfilesTest.java"], test_class = "com.google.devtools.build.runfiles.RunfilesTest", deps = [ - ":test_deps", + "//java/runfiles", + ":guava", + ":truth", ], ) @@ -14,16 +17,18 @@ java_test( srcs = ["UtilTest.java"], test_class = "com.google.devtools.build.runfiles.UtilTest", deps = [ - ":test_deps", + "//java/runfiles", + ":guava", + ":truth", ], ) -java_library( - name = "test_deps", - testonly = True, - exports = [ - "//java/runfiles", - "@guava//jar", - "@truth//jar", - ], +java_import( + name = "guava", + jars = ["@guava//file"], +) + +java_import( + name = "truth", + jars = ["@truth//file"], )