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

Add CommandLineParserAdapter for >=2.13.9 #1634

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions third_party/utils/src/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ scala_library(
any_3 = [
"io/bazel/rulesscala/utils/Scala3CompilerUtils.scala",
],
before_2_13_9 = [
"io/bazel/rulesscala/utils/CommandLineParserAdapter_before_2_13_9.scala",
],
between_2_13_9_and_3 = [
"io/bazel/rulesscala/utils/CommandLineParserAdapter_since_2_13_9.scala",
],
),
visibility = ["//visibility:public"],
deps = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.bazel.rulesscala.utils

import scala.tools.cmd.CommandLineParser

object CommandLineParserAdapter {
def tokenize(cmd: String): List[String] = CommandLineParser.tokenize(cmd)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package scala {
package rulesscala {
// proxy to private[scala] compiler API
object Proxy {
def tokenize(cmd: String): List[String] = sys.process.Parser.tokenize(cmd)
}
}
}

package io.bazel.rulesscala.utils {
object CommandLineParserAdapter {
def tokenize(cmd: String): List[String] =
scala.rulesscala.Proxy.tokenize(cmd)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import scala.reflect.io.AbstractFile
import scala.reflect.io.Directory
import scala.reflect.io.PlainDirectory
import scala.reflect.io.VirtualDirectory
import scala.tools.cmd.CommandLineParser
import scala.tools.nsc.CompilerCommand
import scala.tools.nsc.Global
import scala.tools.nsc.Settings
Expand Down Expand Up @@ -116,7 +115,7 @@ object TestUtil {
output: AbstractFile
): List[StoreReporter#Info] = {
// TODO: Optimize and cache global.
val options = CommandLineParser.tokenize(compileOptions)
val options = CommandLineParserAdapter.tokenize(compileOptions)
val reporter = new StoreReporter()
val settings = new Settings(println)
val _ = new CompilerCommand(options, settings)
Expand Down