mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[bazel] Add macros to build jni code and java tests (#7693)
This commit is contained in:
35
shared/bazel/rules/java_rules.bzl
Normal file
35
shared/bazel/rules/java_rules.bzl
Normal file
@@ -0,0 +1,35 @@
|
||||
load("@rules_java//java:defs.bzl", "java_binary")
|
||||
|
||||
def wpilib_java_junit5_test(
|
||||
name,
|
||||
deps = [],
|
||||
runtime_deps = [],
|
||||
args = [],
|
||||
tags = [],
|
||||
package = "edu",
|
||||
**kwargs):
|
||||
"""
|
||||
Convenience helper to make a junit5 test
|
||||
"""
|
||||
junit_deps = [
|
||||
"@maven//:org_junit_jupiter_junit_jupiter_api",
|
||||
"@maven//:org_junit_jupiter_junit_jupiter_params",
|
||||
"@maven//:org_junit_jupiter_junit_jupiter_engine",
|
||||
]
|
||||
|
||||
junit_runtime_deps = [
|
||||
"@maven//:org_junit_platform_junit_platform_console",
|
||||
]
|
||||
|
||||
# TODO - replace with java_test once shared libraries are hooked up.
|
||||
java_binary(
|
||||
name = name,
|
||||
deps = deps + junit_deps,
|
||||
runtime_deps = runtime_deps + junit_runtime_deps,
|
||||
args = args + ["--select-package", package],
|
||||
main_class = "org.junit.platform.console.ConsoleLauncher",
|
||||
use_testrunner = False,
|
||||
testonly = True,
|
||||
tags = tags + ["no-roborio", "no-bionic", "no-raspbian", "allwpilib-build-java", "no-asan", "no-tsan", "no-ubsan"],
|
||||
**kwargs
|
||||
)
|
||||
Reference in New Issue
Block a user