You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Don't output unused dependency warning and errors when compilation fails. (#1548)
When a scala source is malformed, the AST parsing dependency checking step comes
back with no/very little dependencies used. It then prints out a bunch of these
warnings which are not necessarily true. As a workaround, let's not print the
unused dependency warnings if the build has already failed before hand.
Copy file name to clipboardExpand all lines: src/java/io/bazel/rulesscala/scalac/deps_tracking_reporter/after_2_12_13_and_before_2_13_12/DepsTrackingReporter.java
+13-11Lines changed: 13 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -146,20 +146,22 @@ public void prepareReport() throws IOException {
146
146
}
147
147
148
148
Set<Dependency> unusedDeps = newHashSet<>();
149
-
for (inti = 0; i < ops.directTargets.length; i++) {
150
-
StringdirectTarget = ops.directTargets[i];
151
-
if (usedTargets.contains(directTarget)) {
152
-
continue;
153
-
}
149
+
if (!hasErrors()) {
150
+
for (inti = 0; i < ops.directTargets.length; i++) {
Copy file name to clipboardExpand all lines: test/shell/test_compiler_dependency_tracking.sh
+28Lines changed: 28 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,35 @@ test_sdeps() {
28
28
bazel test --extra_toolchains=//test_expect_failure/compiler_dependency_tracker:ast_plus_warn //test_expect_failure/compiler_dependency_tracker/sdeps/...
29
29
}
30
30
31
+
test_fails_without_warning() {
32
+
cmd=$1
33
+
expected=$2
34
+
35
+
local output
36
+
output=$($cmd2>&1)
37
+
38
+
if [ $?-eq 0 ];then
39
+
echo"Expected build to fail"
40
+
echo"$output"
41
+
exit 1
42
+
fi
43
+
44
+
echo"$output"| grep "$expected"
45
+
if [ $?-eq 0 ];then
46
+
echo"Expected output:[$output] to not contain [$expected]"
0 commit comments