mirror of https://github.com/sbt/sbt.git
Add forkRun methods to make implementing fork straightforward.
This commit is contained in:
parent
3fcdca4ef7
commit
852a69e2e6
|
|
@ -1,7 +1,7 @@
|
|||
#Project properties
|
||||
#Sun Dec 06 21:31:48 EST 2009
|
||||
#Tue Dec 29 21:41:25 EST 2009
|
||||
project.organization=org.scala-tools.sbt
|
||||
project.name=Simple Build Tool
|
||||
sbt.version=0.5.6
|
||||
project.version=0.6.9-SNAPSHOT
|
||||
project.version=0.6.9
|
||||
scala.version=2.7.7
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class SbtProject(info: ProjectInfo) extends DefaultProject(info) with test.SbtSc
|
|||
val jsch = "com.jcraft" % "jsch" % "0.1.31" intransitive()
|
||||
val jetty = "org.mortbay.jetty" % "jetty" % "6.1.14" % "optional"
|
||||
|
||||
val testInterface = "org.scala-tools.testing" % "test-interface" % "0.2"
|
||||
val testInterface = "org.scala-tools.testing" % "test-interface" % "0.3"
|
||||
|
||||
// xsbt components
|
||||
val xsbti = "org.scala-tools.sbt" % "launcher-interface" % projectVersion.value.toString % "provided"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ import java.net.URL
|
|||
|
||||
class Plugins(info: ProjectInfo) extends PluginDefinition(info)
|
||||
{
|
||||
val scripted = "org.scala-tools.sbt" % "scripted" % "0.6.7"
|
||||
val scripted = "org.scala-tools.sbt" % "scripted" % "0.6.9"
|
||||
val technically = Resolver.url("technically.us", new URL("http://databinder.net/repo/"))(Resolver.ivyStylePatterns)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
project.organization=org.scala-tools.sbt
|
||||
project.name=scripted
|
||||
sbt.version=0.5.6
|
||||
project.version=0.6.7
|
||||
project.version=0.6.9
|
||||
scala.version=2.7.7
|
||||
project.initialize=false
|
||||
|
|
|
|||
|
|
@ -88,11 +88,11 @@ object FillProperties
|
|||
import CompatibilityLevel._
|
||||
level match
|
||||
{
|
||||
case Full => "2.7.2 2.7.3 2.7.5 2.7.7 2.8.0.Beta1-RC2 2.8.0-SNAPSHOT"
|
||||
case Basic => "2.7.7 2.7.2 2.8.0.Beta1-RC2"
|
||||
case Minimal => "2.7.7 2.8.0.Beta1-RC2"
|
||||
case Full => "2.7.2 2.7.3 2.7.5 2.7.7 2.8.0.Beta1-RC6 2.8.0-SNAPSHOT"
|
||||
case Basic => "2.7.7 2.7.2 2.8.0.Beta1-RC6"
|
||||
case Minimal => "2.7.7 2.8.0.Beta1-RC6"
|
||||
case Minimal27 => "2.7.7"
|
||||
case Minimal28 => "2.8.0.Beta1-RC2"
|
||||
case Minimal28 => "2.8.0.Beta1-RC6"
|
||||
}
|
||||
}
|
||||
def extraProperties(sbtVersion: String, defScalaVersion: String, buildScalaVersions: String) =
|
||||
|
|
|
|||
|
|
@ -232,6 +232,18 @@ abstract class BasicScalaProject extends ScalaProject with BasicDependencyProjec
|
|||
|
||||
/** Configures forking the compiler and runner. Use ForkScalaCompiler, ForkScalaRun or mix together.*/
|
||||
def fork: Option[ForkScala] = None
|
||||
def forkRun: Option[ForkScala] = forkRun(None, Nil)
|
||||
def forkRun(workingDirectory: File): Option[ForkScala] = forkRun(Some(workingDirectory), Nil)
|
||||
def forkRun(jvmOptions: Seq[String]): Option[ForkScala] = forkRun(None, jvmOptions)
|
||||
def forkRun(workingDirectory0: Option[File], jvmOptions: Seq[String]): Option[ForkScala] =
|
||||
{
|
||||
val si = buildScalaInstance
|
||||
Some(new ForkScalaRun {
|
||||
override def scalaJars = si.libraryJar :: si.compilerJar :: Nil
|
||||
override def workingDirectory: Option[File] = workingDirectory0
|
||||
override def runJVMOptions: Seq[String] = jvmOptions
|
||||
})
|
||||
}
|
||||
private def doCompile(conditional: CompileConditional) = conditional.run
|
||||
implicit def defaultRunner: ScalaRun =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ abstract class ForkJava extends NotNull
|
|||
}
|
||||
abstract class ForkScala extends ForkJava
|
||||
{
|
||||
def scalaJars: Iterable[File] = None
|
||||
def scalaJars: Iterable[File] = Nil
|
||||
}
|
||||
trait ForkScalaRun extends ForkScala
|
||||
{
|
||||
|
|
@ -20,11 +20,6 @@ trait ForkScalaRun extends ForkScala
|
|||
def runJVMOptions: Seq[String] = Nil
|
||||
}
|
||||
|
||||
trait ForkScalaCompiler extends ForkScala
|
||||
{
|
||||
def compileJVMOptions: Seq[String] = Nil
|
||||
}
|
||||
|
||||
sealed abstract class OutputStrategy extends NotNull
|
||||
case object StdoutOutput extends OutputStrategy
|
||||
case class BufferedOutput(logger: Logger) extends OutputStrategy
|
||||
|
|
@ -84,12 +79,8 @@ object Fork
|
|||
apply(javaHome, jvmOptions, scalaJars, arguments, workingDirectory, BufferedOutput(log))
|
||||
def apply(javaHome: Option[File], jvmOptions: Seq[String], scalaJars: Iterable[File], arguments: Seq[String], workingDirectory: Option[File], outputStrategy: OutputStrategy): Int =
|
||||
{
|
||||
val scalaClasspath =
|
||||
if(scalaJars.isEmpty)
|
||||
FileUtilities.scalaLibraryJar :: FileUtilities.scalaCompilerJar :: Nil
|
||||
else
|
||||
scalaJars
|
||||
val scalaClasspathString = "-Xbootclasspath/a:" + scalaClasspath.map(_.getAbsolutePath).mkString(File.pathSeparator)
|
||||
if(scalaJars.isEmpty) error("Scala jars not specified")
|
||||
val scalaClasspathString = "-Xbootclasspath/a:" + scalaJars.map(_.getAbsolutePath).mkString(File.pathSeparator)
|
||||
val mainClass = if(mainClassName.isEmpty) Nil else mainClassName :: Nil
|
||||
val options = jvmOptions ++ (scalaClasspathString :: mainClass ::: arguments.toList)
|
||||
Fork.java(javaHome, options, workingDirectory, Map.empty, outputStrategy)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
#Project properties
|
||||
#Tue Dec 22 16:14:08 CST 2009
|
||||
project.organization=Cough
|
||||
project.name=ForkFail
|
||||
project.version=1.0
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import sbt._
|
||||
|
||||
class ForkFailProject(info: ProjectInfo) extends DefaultProject(info) {
|
||||
override def fork = forkRun
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
object ForkFail {
|
||||
def main(args:Array[String]) {
|
||||
println(scala.util.Properties.versionString)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
> ++2.8.0.Beta1-RC6 run
|
||||
Loading…
Reference in New Issue