Skip to content

Commit e472de4

Browse files
committed
Convert CompilerAPICompat trait to adapter object
Requested by @simuons in bazel-contrib#1634. Renamed it as well to reflect its very specific function.
1 parent 978f6d8 commit e472de4

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

third_party/utils/src/test/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ scala_library(
1414
"io/bazel/rulesscala/utils/Scala3CompilerUtils.scala",
1515
],
1616
before_2_13_9 = [
17-
"io/bazel/rulesscala/utils/CompilerAPICompat_before_2_13_9.scala",
17+
"io/bazel/rulesscala/utils/CommandLineParserAdapter_before_2_13_9.scala",
1818
],
1919
between_2_13_9_and_3 = [
20-
"io/bazel/rulesscala/utils/CompilerAPICompat_since_2_13_9.scala",
20+
"io/bazel/rulesscala/utils/CommandLineParserAdapter_since_2_13_9.scala",
2121
],
2222
),
2323
visibility = ["//visibility:public"],

third_party/utils/src/test/io/bazel/rulesscala/utils/CompilerAPICompat_before_2_13_9.scala renamed to third_party/utils/src/test/io/bazel/rulesscala/utils/CommandLineParserAdapter_before_2_13_9.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ package io.bazel.rulesscala.utils
22

33
import scala.tools.cmd.CommandLineParser
44

5-
trait CompilerAPICompat {
5+
object CommandLineParserAdapter {
66
def tokenize(cmd: String): List[String] = CommandLineParser.tokenize(cmd)
77
}

third_party/utils/src/test/io/bazel/rulesscala/utils/CompilerAPICompat_since_2_13_9.scala renamed to third_party/utils/src/test/io/bazel/rulesscala/utils/CommandLineParserAdapter_since_2_13_9.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ package scala {
88
}
99

1010
package io.bazel.rulesscala.utils {
11-
trait CompilerAPICompat {
12-
def tokenize(cmd: String): List[String] = scala.rulesscala.Proxy.tokenize(cmd)
11+
object CommandLineParserAdapter {
12+
def tokenize(cmd: String): List[String] =
13+
scala.rulesscala.Proxy.tokenize(cmd)
1314
}
1415
}

third_party/utils/src/test/io/bazel/rulesscala/utils/TestUtil.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import scala.tools.nsc.Settings
1313
import scala.tools.nsc.reporters.StoreReporter
1414
import io.bazel.rulesscala.dependencyanalyzer.DependencyTrackingMethod
1515

16-
object TestUtil extends CompilerAPICompat {
16+
object TestUtil {
1717
final val defaultTarget = "//..."
1818

1919
val isWindows: Boolean = System.getProperty("os.name").toLowerCase.contains("windows")
@@ -115,7 +115,7 @@ object TestUtil extends CompilerAPICompat {
115115
output: AbstractFile
116116
): List[StoreReporter#Info] = {
117117
// TODO: Optimize and cache global.
118-
val options = tokenize(compileOptions)
118+
val options = CommandLineParserAdapter.tokenize(compileOptions)
119119
val reporter = new StoreReporter()
120120
val settings = new Settings(println)
121121
val _ = new CompilerCommand(options, settings)

0 commit comments

Comments
 (0)