Skip to content

Commit 8480f9a

Browse files
authored
Fix dt_patches/dt_patch_test.sh for Scala 2.13.0 (#1632)
Updates targets broken under the Scala 2.13.0 test. Also removes the redundant 2.12.1 test, and cleans the `test_dt_patches_user_srcjar` repo before the `test_compiler_srcjar{,_nonhermetic}` tests. Part of #1482. This fix and the `.bazelversion` sync from #1629 can land in either order. Both are required for `dt_patches/dt_patch_test.sh` to be fully functional. --- The equivalent standalone command in `dt_patches/test_dt_patches` produced the error: ```txt $ bazel build //... --repo_env=SCALA_VERSION=2.13.0 //... ERROR: .../rules_scala~/src/java/io/bazel/rulesscala/scalac/reporter/BUILD:5:13: Building external/rules_scala~/src/java/io/bazel/rulesscala/scalac/reporter/libreporter.jar (2 source files) [for tool] failed: (Exit 1): java failed: error executing Javac command (from target @@rules_scala~//src/java/io/bazel/rulesscala/scalac/reporter:reporter) external/rules_java~~toolchains~remotejdk21_macos_aarch64/bin/java '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' ... (remaining 19 arguments skipped) external/rules_scala~/src/java/io/bazel/rulesscala/scalac/deps_tracking_reporter/ after_2_12_13_and_before_2_13_12/DepsTrackingReporter.java:85: error: method does not override or implement a method from a supertype @OverRide ^ external/rules_scala~/src/java/io/bazel/rulesscala/scalac/deps_tracking_reporter/ after_2_12_13_and_before_2_13_12/DepsTrackingReporter.java:94: error: cannot find symbol ((FilteringReporter) delegateReporter).doReport(pos, msg, severity); ^ symbol: method doReport(Position,String,Reporter.Severity) location: interface FilteringReporter external/rules_scala~/src/java/io/bazel/rulesscala/scalac/deps_tracking_reporter/after_2_12_13_and_before_2_13_12/DepsTrackingReporter.java:99: error: cannot find symbol super.doReport(pos, msg, severity); ^ symbol: method doReport(Position,String,Reporter.Severity) external/rules_scala~/src/java/io/bazel/rulesscala/scalac/reporter/after_2_12_13_and_before_2_13_12/ProtoReporter.java:49: error: method does not override or implement a method from a supertype @OverRide ^ external/rules_scala~/src/java/io/bazel/rulesscala/scalac/reporter/after_2_12_13_and_before_2_13_12/ProtoReporter.java:51: error: cannot find symbol super.doReport(pos, msg, severity); ^ symbol: method doReport(Position,String,Reporter.Severity) Target //dummy:dummy failed to build ``` I had the thought that maybe 2.13.0 could use the same `srcs` as the `before_2_12_13` targets. So I abused the `any` matcher to pick exactly 2.13.0 and assign it the same values as `before_2_12_13`. Now it works, and `dt_patches/dt_patch_test.sh` fully passes. --- Cleaning the `test_dt_patches_user_srcjar` repository helps ensure that the `test_compiler_srcjar_nonhermetic` runs, in particular, don't fail after the first run.
1 parent 190fbee commit 8480f9a

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

dt_patches/dt_patch_test.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ test_compiler_srcjar_error() {
6565
run_in_test_repo "bazel build //... --repo_env=SCALA_VERSION=${SCALA_VERSION} //..." "test_dt_patches_user_srcjar" 2>&1 | grep "$EXPECTED_ERROR"
6666
}
6767

68-
run_test_local test_compiler_patch 2.12.1
69-
70-
7168
#run_test_local test_compiler_patch 2.11.0
7269
#run_test_local test_compiler_patch 2.11.1
7370
#run_test_local test_compiler_patch 2.11.2
@@ -122,9 +119,14 @@ run_test_local test_compiler_patch 2.13.15
122119
run_test_local test_compiler_srcjar_error 2.12.11
123120
run_test_local test_compiler_srcjar_error 2.12.12
124121
run_test_local test_compiler_srcjar_error 2.12.13
122+
125123
# These tests are semi-stateful, if two tests are run sequentially with the
126124
# same Scala version, the DEBUG message about a canonical reproducible form
127125
# that we grep for will only be outputted the first time (on Bazel >= 6).
126+
# So we clean the repo first to ensure consistency.
127+
128+
run_in_test_repo "bazel clean --expunge" "test_dt_patches_user_srcjar"
129+
128130
run_test_local test_compiler_srcjar 2.12.14
129131
run_test_local test_compiler_srcjar 2.12.15
130132
run_test_local test_compiler_srcjar 2.12.16
@@ -136,4 +138,4 @@ run_test_local test_compiler_srcjar_nonhermetic 2.12.20
136138
run_test_local test_compiler_srcjar_nonhermetic 2.13.11
137139
run_test_local test_compiler_srcjar_nonhermetic 2.13.12
138140
run_test_local test_compiler_srcjar_nonhermetic 2.13.14
139-
run_test_local test_compiler_srcjar_nonhermetic 2.13.15
141+
run_test_local test_compiler_srcjar_nonhermetic 2.13.15

src/java/io/bazel/rulesscala/scalac/deps_tracking_reporter/BUILD

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ load("//scala:scala_cross_version_select.bzl", "select_for_scala_version")
33
filegroup(
44
name = "deps_tracking_reporter",
55
srcs = select_for_scala_version(
6+
any_2_13_0 = ["before_2_12_13/DepsTrackingReporter.java"],
67
any_3 = ["scala_3/DepsTrackingReporter.java"],
78
before_2_12_13 = ["before_2_12_13/DepsTrackingReporter.java"],
8-
between_2_12_13_and_2_13_12 = ["after_2_12_13_and_before_2_13_12/DepsTrackingReporter.java"],
9+
between_2_12_13_and_2_13 = ["after_2_12_13_and_before_2_13_12/DepsTrackingReporter.java"],
910
between_2_13_12_and_3 = ["after_2_13_12/DepsTrackingReporter.java"],
11+
between_2_13_1_and_2_13_12 = ["after_2_12_13_and_before_2_13_12/DepsTrackingReporter.java"],
1012
),
1113
visibility = ["//visibility:public"],
1214
)

src/java/io/bazel/rulesscala/scalac/reporter/BUILD

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,28 @@ load("//scala:scala_cross_version_select.bzl", "select_for_scala_version")
55
java_library(
66
name = "reporter",
77
srcs = select_for_scala_version(
8+
any_2_13_0 = [
9+
"before_2_12_13/ProtoReporter.java",
10+
],
811
before_2_12_13 = [
9-
"//src/java/io/bazel/rulesscala/scalac/deps_tracking_reporter",
1012
"before_2_12_13/ProtoReporter.java",
1113
],
12-
between_2_12_13_and_2_13_12 = [
13-
"//src/java/io/bazel/rulesscala/scalac/deps_tracking_reporter",
14+
between_2_12_13_and_2_13 = [
1415
"after_2_12_13_and_before_2_13_12/ProtoReporter.java",
1516
],
1617
between_2_13_12_and_3 = [
17-
"//src/java/io/bazel/rulesscala/scalac/deps_tracking_reporter",
1818
"after_2_13_12/ProtoReporter.java",
1919
],
20+
between_2_13_1_and_2_13_12 = [
21+
"after_2_12_13_and_before_2_13_12/ProtoReporter.java",
22+
],
2023
between_3_0_and_3_3 = glob(["scala_3/*.java"]) + [
2124
"since_3_before_3_3/CompilerCompat.java",
22-
"//src/java/io/bazel/rulesscala/scalac/deps_tracking_reporter",
2325
],
2426
since_3_3 = glob(["scala_3/*.java"]) + [
2527
"since_3_3/CompilerCompat.java",
26-
"//src/java/io/bazel/rulesscala/scalac/deps_tracking_reporter",
2728
],
28-
),
29+
) + ["//src/java/io/bazel/rulesscala/scalac/deps_tracking_reporter"],
2930
visibility = ["//visibility:public"],
3031
deps = [
3132
":scala_deps_java_proto",

0 commit comments

Comments
 (0)