Skip to content

Commit

Permalink
Use http_file
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Nov 5, 2024
1 parent 48367fe commit 2cbac3a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
9 changes: 6 additions & 3 deletions test/repositories.bzl
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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",
":guava",
":truth",
"//java/runfiles",
],
)

Expand All @@ -14,16 +17,18 @@ java_test(
srcs = ["UtilTest.java"],
test_class = "com.google.devtools.build.runfiles.UtilTest",
deps = [
":test_deps",
":guava",
":truth",
"//java/runfiles",
],
)

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"],
)

0 comments on commit 2cbac3a

Please sign in to comment.