File tree Expand file tree Collapse file tree 8 files changed +92
-0
lines changed
test_expect_failure/compiler_dependency_tracker Expand file tree Collapse file tree 8 files changed +92
-0
lines changed Original file line number Diff line number Diff line change
1
+ # shellcheck source=./test_runner.sh
2
+ dir=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd )
3
+ . " ${dir} " /test_runner.sh
4
+ . " ${dir} " /test_helper.sh
5
+ runner=$( get_test_runner " ${1:- local} " )
6
+
7
+ # fails unused dep
8
+
9
+ test_fails_for_unused_dep () {
10
+ action_should_fail_with_message \
11
+ " buildozer 'remove deps //test_expect_failure/compiler_dependency_tracker:E' //test_expect_failure/compiler_dependency_tracker:unused_dep" \
12
+ build --extra_toolchains=" //test_expect_failure/compiler_dependency_tracker:ast_plus_error" //test_expect_failure/compiler_dependency_tracker:unused_dep
13
+ }
14
+
15
+ test_fails_for_missing_compile_dep () {
16
+ action_should_fail_with_message \
17
+ " buildozer 'add deps //test_expect_failure/compiler_dependency_tracker:E' //test_expect_failure/compiler_dependency_tracker:missing_compile_dep" \
18
+ build --extra_toolchains=" //test_expect_failure/compiler_dependency_tracker:ast_plus_error" //test_expect_failure/compiler_dependency_tracker:missing_compile_dep
19
+ }
20
+
21
+ test_fails_for_strict_dep () {
22
+ action_should_fail_with_message \
23
+ " buildozer 'add deps //test_expect_failure/compiler_dependency_tracker:E' //test_expect_failure/compiler_dependency_tracker:missing_source_dep" \
24
+ build --extra_toolchains=" //test_expect_failure/compiler_dependency_tracker:ast_plus_error" //test_expect_failure/compiler_dependency_tracker:missing_source_dep
25
+ }
26
+
27
+ $runner test_fails_for_unused_dep
28
+ $runner test_fails_for_missing_compile_dep
29
+ $runner test_fails_for_strict_dep
Original file line number Diff line number Diff line change
1
+ class A
Original file line number Diff line number Diff line change
1
+ class B extends D
Original file line number Diff line number Diff line change
1
+ load ("//scala:scala_toolchain.bzl" , "scala_toolchain" )
2
+ load ("@io_bazel_rules_scala//scala:scala.bzl" , "scala_library" )
3
+
4
+ scala_toolchain (
5
+ name = "ast_plus_error_impl" ,
6
+ compiler_deps_mode = "error" ,
7
+ dependency_mode = "plus-one" ,
8
+ dependency_tracking_method = "ast-plus" ,
9
+ strict_deps_mode = "error" ,
10
+ unused_dependency_checker_mode = "error" ,
11
+ visibility = ["//visibility:public" ],
12
+ )
13
+
14
+ toolchain (
15
+ name = "ast_plus_error" ,
16
+ toolchain = ":ast_plus_error_impl" ,
17
+ toolchain_type = "@io_bazel_rules_scala//scala:toolchain_type" ,
18
+ visibility = ["//visibility:public" ],
19
+ )
20
+
21
+ scala_library (
22
+ name = "unused_dep" ,
23
+ srcs = ["A.scala" ],
24
+ deps = [":E" ],
25
+ )
26
+
27
+ scala_library (
28
+ name = "missing_compile_dep" ,
29
+ srcs = ["B.scala" ],
30
+ deps = [":D" ],
31
+ )
32
+
33
+ scala_library (
34
+ name = "missing_source_dep" ,
35
+ srcs = ["C.scala" ],
36
+ deps = [":D" ],
37
+ )
38
+
39
+ scala_library (
40
+ name = "B" ,
41
+ srcs = ["B.scala" ],
42
+ deps = [":D" ],
43
+ )
44
+
45
+ scala_library (
46
+ name = "D" ,
47
+ srcs = ["D.scala" ],
48
+ deps = [":E" ],
49
+ )
50
+
51
+ scala_library (
52
+ name = "E" ,
53
+ srcs = ["E.scala" ],
54
+ )
Original file line number Diff line number Diff line change
1
+ class C extends D {
2
+ val e : E = ???
3
+ }
Original file line number Diff line number Diff line change
1
+ class D extends E {
2
+ }
Original file line number Diff line number Diff line change
1
+ class E
Original file line number Diff line number Diff line change @@ -52,5 +52,6 @@ $runner bazel build //test_statsfile:SimpleNoStatsFile_statsfile --extra_toolcha
52
52
. " ${test_dir} " /test_toolchain.sh
53
53
. " ${test_dir} " /test_strict_dependency.sh
54
54
. " ${test_dir} " /test_unused_dependency.sh
55
+ . " ${test_dir} " /test_compiler_dependency_tracking.sh
55
56
. " ${test_dir} " /test_twitter_scrooge.sh
56
57
. " ${test_dir} " /test_inherited_environment.sh
You can’t perform that action at this time.
0 commit comments