File tree Expand file tree Collapse file tree
test_expect_failure/transitive Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,32 +23,6 @@ test_disappearing_class() {
2323 set -e
2424}
2525
26- test_transitive_deps () {
27- set +e
28-
29- bazel build test_expect_failure/transitive/scala_to_scala:d
30- if [ $? -eq 0 ]; then
31- echo " 'bazel build test_expect_failure/transitive/scala_to_scala:d' should have failed."
32- exit 1
33- fi
34-
35- expected_message=" error: [strict] Using type example.A from an indirect dependency"
36- output=$( bazel build test_expect_failure/transitive/java_to_scala:d 2>&1 )
37- if [ $? -eq 0 ] || [[ " $output " != * " $expected_message " * ]]; then
38- echo " 'bazel build test_expect_failure/transitive/java_to_scala:d' should have failed with message '$expected_message '."
39- exit 1
40- fi
41-
42- bazel build test_expect_failure/transitive/scala_to_java:d
43- if [ $? -eq 0 ]; then
44- echo " 'bazel build test_transitive_deps/scala_to_java:d' should have failed."
45- exit 1
46- fi
47-
48- set -e
49- exit 0
50- }
51-
5226test_repl () {
5327 local query_results=$( bazel query ' kind(scala_repl, //test/...)' )
5428 # local query_results="${query_results//$'\r'}" #make sure \r is removed so bash can parse args correctly on windows
@@ -118,7 +92,6 @@ xmllint_test() {
11892}
11993
12094$runner test_disappearing_class
121- $runner test_transitive_deps
12295$runner test_repl
12396$runner test_benchmark_jmh
12497$runner scala_test_test_filters
File renamed without changes.
Original file line number Diff line number Diff line change 1+ load ("@rules_java//java:defs.bzl" , "java_library" )
2+ load ("//scala:scala.bzl" , "scala_library" )
3+ load ("//test/expect_build_failure:expect_build_failure.bzl" , "expect_build_failure_test" )
4+
5+ scala_library (
6+ name = "a" ,
7+ srcs = ["A.scala" ],
8+ )
9+
10+ java_library (
11+ name = "c" ,
12+ srcs = ["C.java" ],
13+ deps = [":a" ],
14+ )
15+
16+ # `d` uses a Scala type reachable only transitively (through `c`); strict deps
17+ # must reject building it with the "indirect dependency" error. Tagged "manual"
18+ # so wildcard builds skip it; the sh_test drives a nested `bazel build`.
19+ java_library (
20+ name = "d" ,
21+ srcs = ["D.java" ],
22+ tags = ["manual" ],
23+ deps = [":c" ],
24+ )
25+
26+ expect_build_failure_test (
27+ name = "transitive_java_to_scala_build_test" ,
28+ expect = ["expected_indirect_dependency.txt" ],
29+ target = ":d" ,
30+ )
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 1+ error: [strict] Using type example.A from an indirect dependency
File renamed without changes.
Original file line number Diff line number Diff line change 1+ load ("@rules_java//java:defs.bzl" , "java_library" )
2+ load ("//scala:scala.bzl" , "scala_library" )
3+ load ("//test/expect_build_failure:expect_build_failure.bzl" , "expect_build_failure_test" )
4+
5+ java_library (
6+ name = "a" ,
7+ srcs = ["A.java" ],
8+ )
9+
10+ scala_library (
11+ name = "b" ,
12+ exports = [":a" ],
13+ )
14+
15+ scala_library (
16+ name = "c" ,
17+ deps = [":b" ],
18+ )
19+
20+ # `d` uses a Java type reachable only transitively (through `c` -> `b` ->
21+ # exported `a`); strict deps must reject building it. Tagged "manual" so wildcard
22+ # builds skip it; the sh_test drives a nested `bazel build` and asserts the failure.
23+ scala_library (
24+ name = "d" ,
25+ srcs = ["D.scala" ],
26+ tags = ["manual" ],
27+ deps = [":c" ],
28+ )
29+
30+ expect_build_failure_test (
31+ name = "transitive_scala_to_java_build_test" ,
32+ target = ":d" ,
33+ )
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments