mirror of https://github.com/sbt/sbt.git
parent
faf0683a7a
commit
b086360046
|
|
@ -7,7 +7,7 @@ import sbt.util.Logger
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import sbt.librarymanagement.Resolver
|
import sbt.librarymanagement.Resolver
|
||||||
import sbt.internal.librarymanagement.{ InlineIvyConfiguration, IvyPaths }
|
import sbt.internal.librarymanagement.{ InlineIvyConfiguration, IvyPaths }
|
||||||
import sbt.internal.inc.{ AnalyzingCompiler, ClasspathOptions, IncrementalCompilerImpl }
|
import sbt.internal.inc.{ AnalyzingCompiler, ClasspathOptions, IncrementalCompilerImpl, ScalaInstance }
|
||||||
|
|
||||||
object ConsoleProject {
|
object ConsoleProject {
|
||||||
def apply(state: State, extra: String, cleanupCommands: String = "", options: Seq[String] = Nil)(implicit log: Logger): Unit = {
|
def apply(state: State, extra: String, cleanupCommands: String = "", options: Seq[String] = Nil)(implicit log: Logger): Unit = {
|
||||||
|
|
@ -15,13 +15,13 @@ object ConsoleProject {
|
||||||
val cpImports = new Imports(extracted, state)
|
val cpImports = new Imports(extracted, state)
|
||||||
val bindings = ("currentState" -> state) :: ("extracted" -> extracted) :: ("cpHelpers" -> cpImports) :: Nil
|
val bindings = ("currentState" -> state) :: ("extracted" -> extracted) :: ("cpHelpers" -> cpImports) :: Nil
|
||||||
val unit = extracted.currentUnit
|
val unit = extracted.currentUnit
|
||||||
val localOnly = false
|
val (_, ivyConf) = extracted.runTask(Keys.ivyConfiguration, state)
|
||||||
val lock = None
|
val scalaInstance = {
|
||||||
val checksums = Nil
|
val scalaProvider = state.configuration.provider.scalaProvider
|
||||||
val ivyPaths = new IvyPaths(unit.unit.localBase, bootIvyHome(state.configuration))
|
ScalaInstance(scalaProvider.version, scalaProvider.launcher)
|
||||||
val ivyConfiguration = new InlineIvyConfiguration(ivyPaths, Resolver.withDefaultResolvers(Nil),
|
}
|
||||||
Nil, Nil, localOnly, lock, checksums, None, log)
|
val sourcesModule = extracted.get(Keys.scalaCompilerBridgeSource)
|
||||||
val compiler: AnalyzingCompiler = Compiler.compilers(ClasspathOptions.repl, ivyConfiguration)(state.configuration, log) match { case IncrementalCompilerImpl.Compilers(scalac, _) => scalac }
|
val compiler = Compiler.scalaCompiler(scalaInstance, ClasspathOptions.repl, None, ivyConf, sourcesModule)(state.configuration, log)
|
||||||
val imports = BuildUtil.getImports(unit.unit) ++ BuildUtil.importAll(bindings.map(_._1))
|
val imports = BuildUtil.getImports(unit.unit) ++ BuildUtil.importAll(bindings.map(_._1))
|
||||||
val importString = imports.mkString("", ";\n", ";\n\n")
|
val importString = imports.mkString("", ";\n", ";\n\n")
|
||||||
val initCommands = importString + extra
|
val initCommands = importString + extra
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue