Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dt_patches/dt_patch_test.sh for Scala 2.13.0 #1632

Merged

Conversation

mbland
Copy link
Contributor

@mbland mbland commented Oct 23, 2024

Description

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.

Motivation

The equivalent standalone command in dt_patches/test_dt_patches produced the error:

$ 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.

mbland added a commit to mbland/rules_scala that referenced this pull request Oct 23, 2024
Removes `//src/java/io/bazel/rulesscala/scalac/deps_tracking_reporter`
as a `srcs` dependency for Scala 3. This broke
`test/shell/test_semanticdb.sh` in bazelbuild#1632:

- https://buildkite.com/bazel/rules-scala-scala/builds/5107#0192baa8-d6f7-4851-b3f5-6093625cb9ea/124-497
mbland added a commit to mbland/rules_scala that referenced this pull request Oct 23, 2024
Caught by `./test_lint.sh` in CI yet again!
@mbland mbland force-pushed the bzlmod-fix-dt-patches-for-scala-2.13.0 branch from 7cb24cb to ce6523a Compare October 24, 2024 11:58
@mbland
Copy link
Contributor Author

mbland commented Oct 24, 2024

Just rebased and updated this change now that #1611 has landed.

@simuons
Copy link
Collaborator

simuons commented Oct 25, 2024

Hi, @mbland, sorry but I made a conflict by merging other PRs. Could you please rebase this PR? Thanks.

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 bazelbuild#1482.

This fix and the `.bazelversion` sync from bazelbuild#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.
@mbland mbland force-pushed the bzlmod-fix-dt-patches-for-scala-2.13.0 branch from ce6523a to af7e8f5 Compare October 25, 2024 21:33
@mbland
Copy link
Contributor Author

mbland commented Oct 25, 2024

@simuons No worries. Rebased, tested, and pushed. (CI doesn't run dt_patches/dt_patch_test.sh, but I ran it locally.)

@mbland mbland mentioned this pull request Oct 28, 2024
@liucijus liucijus merged commit 8480f9a into bazelbuild:master Oct 29, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants