Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Got all Scala 2 versions to run the `//test/scalafmt/...` tests, even though they all fail. Scala 3 won't work to begin with because the test files are all using Scala 2 syntax. Updated `scalafmt_repositories.bzl` to import all the libraries needed by Scalafmt under Scala 2.11. This made the file neater, actually, since there more libraries were in common than previously. Added the conditionally compiled `ScalafmtWorker-2_11.scala` file to fix the following compiler error: ```txt $ bazel test --repo_env=SCALA_VERSION=2.11.12 //test/scalafmt/... ERROR: .../scala/scalafmt/BUILD:22:13: scala @@//scala/scalafmt:scalafmt [for tool] failed: (Exit 1): scalac failed: error executing Scalac command (from target //scala/scalafmt:scalafmt) bazel-bin/src/java/io/bazel/rulesscala/scalac/scalac @bazel-bin/scala/scalafmt/scalafmt.jar-0.params scala/scalafmt/scalafmt/ScalafmtWorker.scala:8: error: object sysops is not a member of package org.scalafmt import org.scalafmt.sysops.FileOps ^ scala/scalafmt/scalafmt/ScalafmtWorker.scala:21: error: not found: value FileOps val source = FileOps.readFile( ^ scala/scalafmt/scalafmt/ScalafmtWorker.scala:25: error: value fromHoconFile is not a member of object org.scalafmt.config.ScalafmtConfig val config = ScalafmtConfig.fromHoconFile( ^ Build failure with errors. ``` Then downgraded to `com.lihaoyi:pprint_2.11:0.5.4` for Scala 2.11 to fix this error: ```txt $ bazel test --repo_env=SCALA_VERSION=2.11.12 //test/scalafmt/... INFO: Analyzed 9 targets (43 packages loaded, 2484 targets configured). ERROR: .../test/scalafmt/BUILD:63:23: ScalaFmt test/scalafmt/test/scalafmt/unformatted/unformatted-custom-conf.scala.fmt.output failed: Worker process did not return a WorkResponse: ---8<---8<--- Start of log, file at .../bazel-workers/worker-99-ScalaFmt.log ---8<---8<--- Exception in thread "main" java.lang.NoSuchMethodError: 'pprint.TPrint pprint.TPrint$.lambda(scala.Function1)' at org.scalafmt.config.Docstrings$.<init>(Docstrings.scala:77) at org.scalafmt.config.Docstrings$.<clinit>(Docstrings.scala) at org.scalafmt.config.ScalafmtConfig$.apply$default$3(ScalafmtConfig.scala:104) at org.scalafmt.config.ScalafmtConfig$.<init>(ScalafmtConfig.scala:236) at org.scalafmt.config.ScalafmtConfig$.<clinit>(ScalafmtConfig.scala) at org.scalafmt.config.Config$.fromHoconFile$default$3(Config.scala:42) at io.bazel.rules_scala.scalafmt.ScalafmtWorker$.work(ScalafmtWorker-2_11.scala:25) at io.bazel.rulesscala.worker.Worker.persistentWorkerMain(Worker.java:96) at io.bazel.rulesscala.worker.Worker.workerMain(Worker.java:49) at io.bazel.rules_scala.scalafmt.ScalafmtWorker$.main(ScalafmtWorker-2_11.scala:14) at io.bazel.rules_scala.scalafmt.ScalafmtWorker.main(ScalafmtWorker-2_11.scala) ---8<---8<--- End of log ---8<---8<--- ``` Now all Scala 2 versions are failing with the following: ```txt $ bazel test --repo_env=SCALA_VERSION=2.11.12 //test/scalafmt/... INFO: Analyzed 9 targets (80 packages loaded, 3307 targets configured). ERROR: .../test/scalafmt/BUILD:43:20: ScalaFmt test/scalafmt/test/scalafmt/formatted/formatted-test.scala.fmt.output failed: Worker process did not return a WorkResponse: ---8<---8<--- Start of log, file at .../bazel-workers/worker-134-ScalaFmt.log ---8<---8<--- Exception in thread "main" java.lang.NoSuchMethodError: 'boolean com.google.protobuf.GeneratedMessageV3.isStringEmpty(java.lang.Object)' at com.google.devtools.build.lib.worker.WorkerProtocol$WorkResponse.getSerializedSize(WorkerProtocol.java:2704) at com.google.protobuf.AbstractMessageLite.writeDelimitedTo(AbstractMessageLite.java:89) at io.bazel.rulesscala.worker.Worker.persistentWorkerMain(Worker.java:109) at io.bazel.rulesscala.worker.Worker.workerMain(Worker.java:49) at io.bazel.rules_scala.scalafmt.ScalafmtWorker$.main(ScalafmtWorker-2_11.scala:14) at io.bazel.rules_scala.scalafmt.ScalafmtWorker.main(ScalafmtWorker-2_11.scala) ---8<---8<--- End of log ---8<---8<--- ``` This issue seems to suggest a library bump may fix it; will look into it: - protocolbuffers/protobuf#9236
- Loading branch information