Fix console-project on subprojects

This commit is contained in:
Mark Harrah 2010-03-22 20:44:51 -04:00
parent 274ed92515
commit fd39a1f99e
7 changed files with 32 additions and 4 deletions

View File

@ -74,11 +74,11 @@ final class Compile(maximumErrors: Int, compiler: AnalyzingCompiler, analysisCal
protected def processScala(sources: Set[File], classpath: Set[File], outputDirectory: File, options: Seq[String], log: Logger) protected def processScala(sources: Set[File], classpath: Set[File], outputDirectory: File, options: Seq[String], log: Logger)
{ {
val callbackInterface = new AnalysisInterface(analysisCallback, baseDirectory, outputDirectory) val callbackInterface = new AnalysisInterface(analysisCallback, baseDirectory, outputDirectory)
compiler(Set() ++ sources, Set() ++ classpath, outputDirectory, options, true, callbackInterface, maximumErrors, log) compiler(Set() ++ sources, Set() ++ classpath, outputDirectory, options, callbackInterface, maximumErrors, log)
} }
protected def processJava(sources: Set[File], classpath: Set[File], outputDirectory: File, options: Seq[String], log: Logger) protected def processJava(sources: Set[File], classpath: Set[File], outputDirectory: File, options: Seq[String], log: Logger)
{ {
val arguments = (new CompilerArguments(compiler.scalaInstance))(sources, classpath, outputDirectory, options, true) val arguments = (new CompilerArguments(compiler.scalaInstance, false, compiler.compilerOnClasspath))(sources, classpath, outputDirectory, options)
log.debug("Calling 'javac' with arguments:\n\t" + arguments.mkString("\n\t")) log.debug("Calling 'javac' with arguments:\n\t" + arguments.mkString("\n\t"))
def javac(argFile: File) = Process("javac", ("@" + normalizeSlash(argFile.getAbsolutePath)) :: Nil) ! log def javac(argFile: File) = Process("javac", ("@" + normalizeSlash(argFile.getAbsolutePath)) :: Nil) ! log
val code = withArgumentFile(arguments)(javac) val code = withArgumentFile(arguments)(javac)

View File

@ -281,7 +281,7 @@ sealed abstract class PathFinder extends NotNull
final def absString = Path.makeString(get) final def absString = Path.makeString(get)
final def relativeString = Path.makeRelativeString(get) final def relativeString = Path.makeRelativeString(get)
override def toString = getRelativePaths.mkString("\n") override def toString = getRelativePaths.mkString("\n ", "\n ","")
} }
private class BasePathFinder(base: PathFinder) extends PathFinder private class BasePathFinder(base: PathFinder) extends PathFinder
{ {

View File

@ -437,7 +437,13 @@ object Project
getProjectBuilder(project.info, project.log) match getProjectBuilder(project.info, project.log) match
{ {
case Some(builder) => builder.projectClasspath case Some(builder) => builder.projectClasspath
case None => project.info.sbtClasspath case _ if project.getClass == DefaultBuilderClass => project.info.sbtClasspath
case _ =>
project.info.parent match
{
case Some(p) => getProjectClasspath(p)
case None => project.info.sbtClasspath
}
} }
private[sbt] def getProjectBuilder(info: ProjectInfo, buildLog: Logger): Option[BuilderProject] = private[sbt] def getProjectBuilder(info: ProjectInfo, buildLog: Logger): Option[BuilderProject] =
{ {

View File

@ -0,0 +1,2 @@
project.name=test
project.version=1.0

View File

@ -0,0 +1,10 @@
import sbt._
class Root(info: ProjectInfo) extends ParentProject(info)
{
lazy val sub1 = project("sub1", "sub1")
lazy val sub2 = project("sub2", "sub2", new Sub2(_))
lazy val sub3 = project("sub3", "sub3", new DefaultProject(_))
class Sub2(info: ProjectInfo) extends DefaultProject(info)
}

View File

@ -0,0 +1,3 @@
import sbt._
class TestSub(info: ProjectInfo) extends DefaultProject(info)

View File

@ -0,0 +1,7 @@
> console-project
> project sub3
> console-project
> project sub1
> console-project
> project sub2
> console-project