forked from bazelbuild/rules_java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava_common_tests.bzl
More file actions
34 lines (28 loc) · 1013 Bytes
/
Copy pathjava_common_tests.bzl
File metadata and controls
34 lines (28 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""Tests for java_common APIs"""
load("@rules_testing//lib:analysis_test.bzl", "analysis_test", "test_suite")
load("@rules_testing//lib:util.bzl", "util")
load("//java/test/testutil:rules/custom_library_with_sourcepaths.bzl", "custom_library_with_sourcepaths")
def _test_compile_sourcepath(name):
util.helper_target(
custom_library_with_sourcepaths,
name = "custom",
srcs = ["Main.java"],
sourcepath = [":B.jar"],
)
analysis_test(
name = name,
impl = _test_compile_sourcepath_impl,
target = ":custom",
)
def _test_compile_sourcepath_impl(env, target):
assert_compile_action = env.expect.that_target(target).action_generating("{package}/libcustom.jar")
assert_compile_action.contains_flag_values([
("--sourcepath", "{package}/B.jar".format(package = target.label.package)),
])
def java_common_tests(name):
test_suite(
name = name,
tests = [
_test_compile_sourcepath,
],
)