Commit cf40df3
authored
Add CommandLineParserAdapter for >=2.13.9 (#1634)
* Add scala.tools.cmd.CommandLineParser for >=2.13.9
Fixes //third_party/utils/src/test:test_util for Scala 2.13.9 and later
by providing a thin `scala.tools.cmd.CommandLineParser` adapter.
Before this change, building under Scala 2.13.14 produced:
```txt
$ bazel build --repo_env=SCALA_VERSION=2.13.14 \
//third_party/utils/src/test:test_util
ERROR: .../third_party/utils/src/test/BUILD:6:14:
scala @@//third_party/utils/src/test:test_util failed: (Exit 1):
scalac failed: error executing Scalac command
(from target //third_party/utils/src/test:test_util)
bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/src/java/io/bazel/rulesscala/scalac/scalac
@bazel-out/darwin_arm64-fastbuild/bin/third_party/utils/src/test/test_util.jar-0.params
third_party/utils/src/test/io/bazel/rulesscala/utils/TestUtil.scala:10:
error: object cmd is not a member of package tools
import scala.tools.cmd.CommandLineParser
^
third_party/utils/src/test/io/bazel/rulesscala/utils/TestUtil.scala:119:
error: not found: value CommandLineParser
val options = CommandLineParser.tokenize(compileOptions)
^
```
Turns out `CommandLineParser` disappered in Scala 2.13.9, and its
`Parser` replacement is private:
- scala/scala#10057
* Use local proxy instead of scala.tools.cmd patch
Copied the `CompilerAPICompat` code verbatim from @WojciechMazur's
suggestion on #1634. Definitely seems more robust than injecting
`CommandLineParser` directly into `scala.tools.cmd`.
* Convert CompilerAPICompat trait to adapter object
Requested by @simuons in #1634. Renamed it as well to reflect its very
specific function.1 parent 6a23700 commit cf40df3
File tree
4 files changed
+29
-2
lines changed- third_party/utils/src/test
- io/bazel/rulesscala/utils
4 files changed
+29
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
119 | | - | |
| 118 | + | |
120 | 119 | | |
121 | 120 | | |
122 | 121 | | |
| |||
0 commit comments