File tree Expand file tree Collapse file tree 5 files changed +40
-1
lines changed
test_expect_failure/missing_direct_deps/external_deps Expand file tree Collapse file tree 5 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ def _stamp_jar(ctx, jar):
2626 arguments = [
2727 "--nostrip_jar" ,
2828 "--target_label" ,
29- ctx .label . name ,
29+ str ( ctx .label ) ,
3030 jar .path ,
3131 stamped_file .path ,
3232 ],
Original file line number Diff line number Diff line change @@ -69,9 +69,20 @@ test_plus_one_ast_analyzer_strict_deps() {
6969 test_expect_failure_or_warning_on_missing_direct_deps_with_expected_message " ${expected_message_warn} " ${test_target} " --extra_toolchains=//test/toolchains:ast_plus_one_deps_strict_deps_warn" " ne"
7070}
7171
72+ test_stamped_target_label_loading () {
73+ local test_target=" //test_expect_failure/missing_direct_deps/external_deps:java_lib_with_a_transitive_external_dep"
74+ local expected_message=" buildozer 'add deps @io_bazel_rules_scala_guava//:io_bazel_rules_scala_guava' ${test_target} "
75+
76+ test_expect_failure_or_warning_on_missing_direct_deps_with_expected_message \
77+ " ${expected_message} " ${test_target} \
78+ " --extra_toolchains=//test/toolchains:ast_plus_one_deps_unused_deps_error" \
79+ " eq"
80+ }
81+
7282$runner test_scala_import_library_passes_labels_of_direct_deps
7383$runner test_plus_one_deps_only_works_for_java_info_targets
7484$runner scala_pb_library_targets_do_not_have_host_deps
7585$runner scrooge_library_targets_do_not_have_host_deps
7686$runner test_scala_import_expect_failure_on_missing_direct_deps_warn_mode
7787$runner test_plus_one_ast_analyzer_strict_deps
88+ $runner test_stamped_target_label_loading
Original file line number Diff line number Diff line change 1+ load ("@rules_java//java:defs.bzl" , "java_library" )
12load ("//scala:scala.bzl" , "scala_library" )
23
34package (default_visibility = ["//visibility:public" ])
@@ -37,3 +38,18 @@ scala_library(
3738 ],
3839 deps = ["@com_google_guava_guava_21_0_with_file//jar" ],
3940)
41+
42+ # tests if external jars are stamped with a correct label
43+ java_library (
44+ name = "java_lib_with_unused_external_dep" ,
45+ testonly = True ,
46+ srcs = ["Empty.java" ],
47+ deps = ["@io_bazel_rules_scala_guava" ],
48+ )
49+
50+ java_library (
51+ name = "java_lib_with_a_transitive_external_dep" ,
52+ testonly = True ,
53+ srcs = ["UsesExternalDep.java" ],
54+ deps = [":java_lib_with_unused_external_dep" ],
55+ )
Original file line number Diff line number Diff line change 1+ public class Empty {
2+ }
Original file line number Diff line number Diff line change 1+ import com .google .common .base .Charsets ;
2+
3+ public class UsesExternalDep {
4+
5+ public void dependsOnExternalDep () {
6+ Empty useDirectDep = new Empty ();
7+ System .out .println (useDirectDep );
8+ System .out .println (Charsets .ISO_8859_1 );
9+ }
10+ }
You can’t perform that action at this time.
0 commit comments