mirror of https://github.com/sbt/sbt.git
Merge pull request #3889 from dwijnand/sbtOn-works-more
Tweak RunFromSourceMain so compile/run/test work
This commit is contained in:
commit
c0efc41f2e
|
|
@ -12,7 +12,7 @@ import scala.annotation.tailrec
|
||||||
import xsbti._
|
import xsbti._
|
||||||
|
|
||||||
object RunFromSourceMain {
|
object RunFromSourceMain {
|
||||||
private val sbtVersion = "1.0.3" // "dev"
|
private val sbtVersion = "1.1.0" // "dev"
|
||||||
private val scalaVersion = "2.12.4"
|
private val scalaVersion = "2.12.4"
|
||||||
|
|
||||||
def main(args: Array[String]): Unit = args match {
|
def main(args: Array[String]): Unit = args match {
|
||||||
|
|
@ -51,6 +51,8 @@ object RunFromSourceMain {
|
||||||
def baseDirectory = baseDir
|
def baseDirectory = baseDir
|
||||||
def arguments = args.toArray
|
def arguments = args.toArray
|
||||||
def provider = new AppProvider { appProvider =>
|
def provider = new AppProvider { appProvider =>
|
||||||
|
def bootDirectory: File = file(sys.props("user.home")) / ".sbt" / "boot"
|
||||||
|
def scalaHome: File = bootDirectory / s"scala-$scalaVersion"
|
||||||
def scalaProvider = new ScalaProvider { scalaProvider =>
|
def scalaProvider = new ScalaProvider { scalaProvider =>
|
||||||
def scalaOrg = "org.scala-lang"
|
def scalaOrg = "org.scala-lang"
|
||||||
def launcher = new Launcher {
|
def launcher = new Launcher {
|
||||||
|
|
@ -60,15 +62,15 @@ object RunFromSourceMain {
|
||||||
def app(id: xsbti.ApplicationID, version: String) = appProvider
|
def app(id: xsbti.ApplicationID, version: String) = appProvider
|
||||||
def topLoader = new java.net.URLClassLoader(Array(), null)
|
def topLoader = new java.net.URLClassLoader(Array(), null)
|
||||||
def globalLock = noGlobalLock
|
def globalLock = noGlobalLock
|
||||||
def bootDirectory = file(sys.props("user.home")) / ".sbt" / "boot"
|
def bootDirectory = appProvider.bootDirectory
|
||||||
def ivyRepositories = Array()
|
|
||||||
def appRepositories = Array()
|
|
||||||
def isOverrideRepositories = false
|
|
||||||
def ivyHome = file(sys.props("user.home")) / ".ivy2"
|
def ivyHome = file(sys.props("user.home")) / ".ivy2"
|
||||||
|
def ivyRepositories = Array(new PredefinedRepository { def id() = Predefined.Local })
|
||||||
|
def appRepositories = Array(new PredefinedRepository { def id() = Predefined.Local })
|
||||||
|
def isOverrideRepositories = false
|
||||||
def checksums = Array("sha1", "md5")
|
def checksums = Array("sha1", "md5")
|
||||||
}
|
}
|
||||||
def version = scalaVersion
|
def version = scalaVersion
|
||||||
def libDir: File = launcher.bootDirectory / s"scala-$version" / "lib"
|
def libDir: File = scalaHome / "lib"
|
||||||
def jar(name: String): File = libDir / s"$name.jar"
|
def jar(name: String): File = libDir / s"$name.jar"
|
||||||
def libraryJar = jar("scala-library")
|
def libraryJar = jar("scala-library")
|
||||||
def compilerJar = jar("scala-compiler")
|
def compilerJar = jar("scala-compiler")
|
||||||
|
|
@ -86,6 +88,7 @@ object RunFromSourceMain {
|
||||||
CrossValue.Disabled,
|
CrossValue.Disabled,
|
||||||
Nil
|
Nil
|
||||||
)
|
)
|
||||||
|
def appHome: File = scalaHome / id.groupID / id.name / id.version
|
||||||
|
|
||||||
def mainClasspath =
|
def mainClasspath =
|
||||||
buildinfo.TestBuildInfo.fullClasspath.iterator
|
buildinfo.TestBuildInfo.fullClasspath.iterator
|
||||||
|
|
@ -98,11 +101,11 @@ object RunFromSourceMain {
|
||||||
def newMain = new xMain
|
def newMain = new xMain
|
||||||
|
|
||||||
def components = new ComponentProvider {
|
def components = new ComponentProvider {
|
||||||
def componentLocation(id: String) = ???
|
def componentLocation(id: String) = appHome / id
|
||||||
def component(componentID: String) = ???
|
def component(id: String) = IO.listFiles(componentLocation(id), _.isFile)
|
||||||
def defineComponent(componentID: String, components: Array[File]) = ???
|
def defineComponent(id: String, components: Array[File]) = ()
|
||||||
def addToComponent(componentID: String, components: Array[File]) = ???
|
def addToComponent(id: String, components: Array[File]) = false
|
||||||
def lockFile = ???
|
def lockFile = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue