Skip to content

Commit

Permalink
[bazel] Bump contrib_rules_jvm to 0.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Oct 9, 2023
1 parent e7babc9 commit 7408a5a
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 7 deletions.
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ rules_jvm_external_setup()

http_archive(
name = "contrib_rules_jvm",
sha256 = "548f0583192ff79c317789b03b882a7be9b1325eb5d3da5d7fdcc4b7ca69d543",
strip_prefix = "rules_jvm-0.9.0",
url = "https://github.com/bazel-contrib/rules_jvm/archive/refs/tags/v0.9.0.tar.gz",
sha256 = "4d62589dc6a55e74bbe33930b826d593367fc777449a410604b2ad7c6c625ef7",
strip_prefix = "rules_jvm-0.19.0",
url = "https://github.com/bazel-contrib/rules_jvm/releases/download/v0.19.0/rules_jvm-v0.19.0.tar.gz",
)

load("@contrib_rules_jvm//:repositories.bzl", "contrib_rules_jvm_deps")
Expand Down
2 changes: 1 addition & 1 deletion java/defs.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
load(
"@contrib_rules_jvm//java:defs.bzl",
_JUNIT5_DEPS = "JUNIT5_DEPS",
_java_test_suite = "java_test_suite",
)
load(
"@rules_java//java:defs.bzl",
Expand All @@ -10,6 +9,7 @@ load(
)
load("@rules_jvm_external//:defs.bzl", _artifact = "artifact", _javadoc = "javadoc", _maven_bom = "maven_bom")
load("//java/private:dist_zip.bzl", _java_dist_zip = "java_dist_zip")
load("//java/private:java_test_suite.bzl", _java_test_suite = "java_test_suite")
load("//java/private:library.bzl", _java_export = "java_export", _java_library = "java_library", _java_test = "java_test")
load("//java/private:merge_jars.bzl", _merge_jars = "merge_jars")
load("//java/private:module.bzl", _java_module = "java_module")
Expand Down
29 changes: 29 additions & 0 deletions java/private/java_test_suite.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
load("@contrib_rules_jvm//java/private:create_jvm_test_suite.bzl", "create_jvm_test_suite")
load("@contrib_rules_jvm//java/private:java_test_suite_shared_constants.bzl", "DEFAULT_TEST_SUFFIXES")
load("@contrib_rules_jvm//java/private:library.bzl", "java_library")
load(":junit5_test.bzl", "junit5_test")

def java_test_suite(
name,
srcs,
runner = "junit5",
test_suffixes = DEFAULT_TEST_SUFFIXES,
package = None,
deps = None,
runtime_deps = [],
size = None,
**kwargs):
create_jvm_test_suite(
name,
srcs = srcs,
test_suffixes = test_suffixes,
package = package,
define_library = java_library,
# We want to use our own test runner
define_test = junit5_test,
runner = runner,
deps = deps,
runtime_deps = runtime_deps,
size = size,
**kwargs
)
27 changes: 27 additions & 0 deletions java/private/junit5_test.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
load("@contrib_rules_jvm//java:defs.bzl", "java_test")
load("@contrib_rules_jvm//java/private:package.bzl", "get_package_name")

def junit5_test(
name,
test_class = None,
runtime_deps = [],
package_prefixes = [],
jvm_flags = [],
**kwargs):
if test_class:
clazz = test_class
else:
clazz = get_package_name(package_prefixes) + name

java_test(
name = name,
main_class = "com.github.bazel_contrib.contrib_rules_jvm.junit5.JUnit5Runner",
test_class = clazz,
runtime_deps = runtime_deps + [
"@contrib_rules_jvm//java/src/com/github/bazel_contrib/contrib_rules_jvm/junit5",
],
jvm_flags = jvm_flags + ["-Djava.security.manager=allow"],
**kwargs
)

return name
6 changes: 3 additions & 3 deletions java/private/selenium_test.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
load("@contrib_rules_jvm//java:defs.bzl", "java_junit5_test")
load(
"//common:browsers.bzl",
"COMMON_TAGS",
Expand All @@ -16,6 +15,7 @@ load(
"firefox_dev_jvm_flags",
"firefox_jvm_flags",
)
load(":junit5_test.bzl", "junit5_test")

DEFAULT_BROWSER = "firefox"

Expand Down Expand Up @@ -105,7 +105,7 @@ def selenium_test(name, test_class, size = "medium", browsers = DEFAULT_BROWSERS

test = name if browser == default_browser else "%s-%s" % (name, browser)

java_junit5_test(
junit5_test(
name = test,
test_class = test_class,
size = size,
Expand All @@ -124,7 +124,7 @@ def selenium_test(name, test_class, size = "medium", browsers = DEFAULT_BROWSERS
all_tests.append(":%s" % test)

if remote:
java_junit5_test(
junit5_test(
name = "%s-remote" % test,
test_class = test_class,
size = size,
Expand Down

0 comments on commit 7408a5a

Please sign in to comment.