Skip to content

Commit

Permalink
Merge pull request scala#872 from eed3si9n/wip/service
Browse files Browse the repository at this point in the history
Make xsbt.CompilerInterface class name configurable
Rewritten from sbt/zinc@951c722
  • Loading branch information
eed3si9n committed Aug 13, 2020
2 parents eaec4dd + 8742abc commit 9386d78
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xsbt.InteractiveConsoleBridgeFactory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xsbt.CompilerBridge
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xsbt.ConsoleBridge
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xsbt.ScaladocBridge
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import java.io.File
/**
* This is the entry point for the compiler bridge (implementation of CompilerInterface)
*/
final class CompilerInterface extends CompilerInterface2 {
final class CompilerBridge extends xsbti.compile.CompilerInterface2 {
override def run(
sources: Array[VirtualFile],
changes: DependencyChanges,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@

package xsbt

import java.util.Optional
import xsbti.Logger

class InteractiveConsoleFactory extends xsbti.InteractiveConsoleFactory {
class InteractiveConsoleBridgeFactory extends xsbti.InteractiveConsoleFactory {
def createConsole(
args: Array[String],
bootClasspathString: String,
classpathString: String,
initialCommands: String,
cleanupCommands: String,
loader: ClassLoader,
loader: Optional[ClassLoader],
bindNames: Array[String],
bindValues: Array[AnyRef],
log: Logger
): xsbti.InteractiveConsoleInterface =
new InteractiveConsoleInterface(
new InteractiveConsoleBridge(
args,
bootClasspathString,
classpathString,
Expand Down
6 changes: 4 additions & 2 deletions src/main/scala/xsbt/InteractiveConsoleInterface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
package xsbt

import java.io.{ PrintWriter, StringWriter }
import java.util.Optional

import scala.tools.nsc.interpreter.IMain
import scala.tools.nsc.{ GenericRunnerCommand, Settings }
Expand All @@ -21,13 +22,14 @@ import xsbti.Logger
import Compat._
import InteractiveConsoleHelper._

class InteractiveConsoleInterface(
// See InteractiveConsoleBridgeFactory
class InteractiveConsoleBridge(
args: Array[String],
bootClasspathString: String,
classpathString: String,
initialCommands: String,
cleanupCommands: String,
loader: ClassLoader,
loader: Optional[ClassLoader],
bindNames: Array[String],
bindValues: Array[AnyRef],
log: Logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import xsbti.{ Logger, VirtualFile }
import scala.reflect.io.AbstractFile
import Log.debug

class ScaladocInterface extends xsbti.compile.ScaladocInterface2 {
class ScaladocBridge extends xsbti.compile.ScaladocInterface2 {
def run(sources: Array[VirtualFile], args: Array[String], log: Logger, delegate: xsbti.Reporter) =
(new Runner(sources, args, log, delegate)).run
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ import scala.tools.nsc.interpreter.{ ILoop, IMain, InteractiveReader, NamedParam
import scala.tools.nsc.reporters.Reporter
import scala.tools.nsc.{ GenericRunnerCommand, Settings }

class ConsoleInterface {
def commandArguments(
class ConsoleBridge extends xsbti.compile.ConsoleInterface1 {
override def commandArguments(
args: Array[String],
bootClasspathString: String,
classpathString: String,
log: Logger
): Array[String] =
MakeSettings.sync(args, bootClasspathString, classpathString, log).recreateArgs.toArray[String]

def run(
override def run(
args: Array[String],
bootClasspathString: String,
classpathString: String,
initialCommands: String,
cleanupCommands: String,
loader: ClassLoader,
bindNames: Array[String],
bindValues: Array[Any],
bindValues: Array[AnyRef],
log: Logger
): Unit = {
lazy val interpreterSettings = MakeSettings.sync(args.toList, log)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ import scala.tools.nsc.interpreter.{ ILoop, IMain, InteractiveReader, NamedParam
import scala.tools.nsc.reporters.Reporter
import scala.tools.nsc.{ GenericRunnerCommand, Settings }

class ConsoleInterface {
def commandArguments(
class ConsoleBridge extends xsbti.compile.ConsoleInterface1 {
override def commandArguments(
args: Array[String],
bootClasspathString: String,
classpathString: String,
log: Logger
): Array[String] =
MakeSettings.sync(args, bootClasspathString, classpathString, log).recreateArgs.toArray[String]

def run(
override def run(
args: Array[String],
bootClasspathString: String,
classpathString: String,
initialCommands: String,
cleanupCommands: String,
loader: ClassLoader,
bindNames: Array[String],
bindValues: Array[Any],
bindValues: Array[AnyRef],
log: Logger
): Unit = {
lazy val interpreterSettings = MakeSettings.sync(args.toList, log)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ import scala.tools.nsc.interpreter.IMain
import scala.tools.nsc.interpreter.shell.{ ILoop, ShellConfig, ReplReporterImpl }
import scala.tools.nsc.{ GenericRunnerCommand, Settings }

class ConsoleInterface {
def commandArguments(
class ConsoleBridge extends xsbti.compile.ConsoleInterface1 {
override def commandArguments(
args: Array[String],
bootClasspathString: String,
classpathString: String,
log: Logger
): Array[String] =
MakeSettings.sync(args, bootClasspathString, classpathString, log).recreateArgs.toArray[String]

def run(
override def run(
args: Array[String],
bootClasspathString: String,
classpathString: String,
initialCommands: String,
cleanupCommands: String,
loader: ClassLoader,
bindNames: Array[String],
bindValues: Array[Any],
bindValues: Array[AnyRef],
log: Logger
): Unit = {
lazy val interpreterSettings = MakeSettings.sync(args.toList, log)
Expand Down

0 comments on commit 9386d78

Please sign in to comment.