Skip to content

Commit

Permalink
Add java_test without launcher rule variant and macro
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 515721258
Change-Id: Ica63a58200ccd24ab7329127f41821b6f29b98ee
  • Loading branch information
hvadehra authored and copybara-github committed Mar 10, 2023
1 parent fbdf2c1 commit aa6f23e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/starlark/builtins_bzl/bazel/exports.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ load("@_builtins//:common/java/java_plugin.bzl", "java_plugin")
load("@_builtins//:common/java/java_import.bzl", "java_import")
load("@_builtins//:common/java/proto/java_proto_library.bzl", "java_proto_library")
load("@_builtins//:common/cc/cc_proto_library.bzl", "cc_proto_library")
load(":bazel/java/bazel_java_binary_wrapper.bzl", "java_binary")
load(":bazel/java/bazel_java_binary_wrapper.bzl", "java_binary", "java_test")
load("@_builtins//:common/python/py_binary_macro.bzl", "py_binary")
load("@_builtins//:common/python/py_library_macro.bzl", "py_library")
load("@_builtins//:common/python/py_test_macro.bzl", "py_test")
Expand All @@ -40,6 +40,7 @@ exported_rules = {
"java_proto_library": java_proto_library,
"+cc_proto_library": cc_proto_library,
"+java_binary": java_binary,
"-java_test": java_test,
"py_binary": py_binary,
"py_test": py_test,
"py_library": py_library,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ hash of their bzl environments will be different. See http://b/226379109,
specifically #20, for details.
"""

load(":bazel/java/bazel_java_binary.bzl", "make_java_binary")
load(":bazel/java/bazel_java_binary.bzl", "make_java_binary", "make_java_test")

java_binary = make_java_binary(executable = True, resolve_launcher_flag = False)

java_test = make_java_test(resolve_launcher_flag = False)
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ This is needed since the `executable` nature of the target must be computed from
the supplied value of the `create_executable` attribute.
"""

load(":bazel/java/bazel_java_binary.bzl", java_bin_exec = "java_binary")
load(":bazel/java/bazel_java_binary_nolauncher.bzl", java_bin_exec_no_launcher_flag = "java_binary")
load(":bazel/java/bazel_java_binary.bzl", _java_test = "java_test", java_bin_exec = "java_binary")
load(":bazel/java/bazel_java_binary_nolauncher.bzl", java_bin_exec_no_launcher_flag = "java_binary", java_test_no_launcher = "java_test")
load(":bazel/java/bazel_java_binary_nonexec.bzl", java_bin_nonexec = "java_binary")
load(":bazel/java/bazel_java_binary_deploy_jar.bzl", "deploy_jars")
load(":common/java/java_binary_wrapper.bzl", "register_java_binary_rules")

# TODO(hvd): add custom launcher rule if needed
def java_binary(**kwargs):
register_java_binary_rules(
java_bin_exec,
Expand All @@ -34,3 +33,14 @@ def java_binary(**kwargs):
rule_deploy_jars = deploy_jars,
**kwargs
)

def java_test(**kwargs):
register_java_binary_rules(
_java_test,
java_test_no_launcher,
java_test_no_launcher,
java_test_no_launcher,
rule_deploy_jars = deploy_jars,
is_test_rule_class = True,
**kwargs
)

0 comments on commit aa6f23e

Please sign in to comment.