File tree Expand file tree Collapse file tree
bazel/tests/java_proto_library_tests/binary_deps Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ load ("@rules_testing//lib:util.bzl" , "PREVENT_IMPLICIT_BUILDING_TAGS" )
2+ load ("//bazel:java_proto_library.bzl" , "java_proto_library" )
3+ load ("//bazel:proto_library.bzl" , "proto_library" )
4+ load ("//bazel/tests:java_proto_library_tests/test_utils.bzl" , "java_info_subject_factory" )
5+ load ("//bazel/tests:proto_bzl_test_suite.bzl" , "bzl_test_suite" )
6+ load (":tests.bzl" , "TESTS" )
7+
8+ package (default_applicable_licenses = ["//:license" ])
9+
10+ proto_library (
11+ name = "baz_proto" ,
12+ srcs = ["baz.proto" ],
13+ tags = PREVENT_IMPLICIT_BUILDING_TAGS ,
14+ )
15+
16+ proto_library (
17+ name = "foo_proto" ,
18+ srcs = [
19+ "bar.proto" ,
20+ "foo.proto" ,
21+ ],
22+ tags = PREVENT_IMPLICIT_BUILDING_TAGS ,
23+ deps = [":baz_proto" ],
24+ )
25+
26+ java_proto_library (
27+ name = "foo_java_proto" ,
28+ tags = PREVENT_IMPLICIT_BUILDING_TAGS ,
29+ deps = [":foo_proto" ],
30+ )
31+
32+ bzl_test_suite (
33+ name = "tests" ,
34+ provider_subject_factories = [java_info_subject_factory ],
35+ tests = TESTS ,
36+ )
Original file line number Diff line number Diff line change 1+ """Tests that java_proto_library depends on the right set of files."""
2+
3+ load ("@rules_java//java/common:java_info.bzl" , "JavaInfo" )
4+
5+ def _test_binary_deps (env , target ):
6+ java_info = env .expect .that_target (target ).provider (JavaInfo )
7+
8+ # Should depend on Java outputs.
9+ java_info .transitive_source_jars_in_package ().contains_exactly ([
10+ "{package}/foo_proto-speed-src.jar" ,
11+ "{package}/baz_proto-speed-src.jar" ,
12+ ])
13+ java_info .transitive_source_jars ().contains_at_least ([
14+ "java/core/liblite_runtime_only-src.jar" ,
15+ "java/core/libcore-src.jar" ,
16+ ])
17+
18+ # Should depend on Java libraries.
19+ java_info .transitive_compile_time_jars_in_package ().contains_exactly ([
20+ "{package}/libfoo_proto-speed-hjar.jar" ,
21+ "{package}/libbaz_proto-speed-hjar.jar" ,
22+ ])
23+ java_info .transitive_compile_time_jars ().contains_at_least ([
24+ "java/core/liblite_runtime_only-hjar.jar" ,
25+ "java/core/libcore-hjar.jar" ,
26+ ])
27+
28+ TESTS = {
29+ ":foo_java_proto" : [_test_binary_deps ],
30+ }
You can’t perform that action at this time.
0 commit comments