From fd39a1f99ec2c8519821c6a3f558796693ff37b2 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Mon, 22 Mar 2010 20:44:51 -0400 Subject: [PATCH] Fix console-project on subprojects --- src/main/scala/sbt/Compile.scala | 4 ++-- src/main/scala/sbt/Path.scala | 2 +- src/main/scala/sbt/Project.scala | 8 +++++++- src/sbt-test/project/console/project/build.properties | 2 ++ src/sbt-test/project/console/project/build/P.scala | 10 ++++++++++ .../project/console/sub1/project/build/TestSub.scala | 3 +++ src/sbt-test/project/console/test | 7 +++++++ 7 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 src/sbt-test/project/console/project/build.properties create mode 100644 src/sbt-test/project/console/project/build/P.scala create mode 100644 src/sbt-test/project/console/sub1/project/build/TestSub.scala create mode 100644 src/sbt-test/project/console/test diff --git a/src/main/scala/sbt/Compile.scala b/src/main/scala/sbt/Compile.scala index dbdb7d897..ae2712c93 100644 --- a/src/main/scala/sbt/Compile.scala +++ b/src/main/scala/sbt/Compile.scala @@ -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) { 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) { - 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")) def javac(argFile: File) = Process("javac", ("@" + normalizeSlash(argFile.getAbsolutePath)) :: Nil) ! log val code = withArgumentFile(arguments)(javac) diff --git a/src/main/scala/sbt/Path.scala b/src/main/scala/sbt/Path.scala index 1a6db396d..7a0e4e6b8 100644 --- a/src/main/scala/sbt/Path.scala +++ b/src/main/scala/sbt/Path.scala @@ -281,7 +281,7 @@ sealed abstract class PathFinder extends NotNull final def absString = Path.makeString(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 { diff --git a/src/main/scala/sbt/Project.scala b/src/main/scala/sbt/Project.scala index a3b60e581..6555f72d4 100644 --- a/src/main/scala/sbt/Project.scala +++ b/src/main/scala/sbt/Project.scala @@ -437,7 +437,13 @@ object Project getProjectBuilder(project.info, project.log) match { 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] = { diff --git a/src/sbt-test/project/console/project/build.properties b/src/sbt-test/project/console/project/build.properties new file mode 100644 index 000000000..3f2496999 --- /dev/null +++ b/src/sbt-test/project/console/project/build.properties @@ -0,0 +1,2 @@ +project.name=test +project.version=1.0 \ No newline at end of file diff --git a/src/sbt-test/project/console/project/build/P.scala b/src/sbt-test/project/console/project/build/P.scala new file mode 100644 index 000000000..ee02785e3 --- /dev/null +++ b/src/sbt-test/project/console/project/build/P.scala @@ -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) +} \ No newline at end of file diff --git a/src/sbt-test/project/console/sub1/project/build/TestSub.scala b/src/sbt-test/project/console/sub1/project/build/TestSub.scala new file mode 100644 index 000000000..f27b286af --- /dev/null +++ b/src/sbt-test/project/console/sub1/project/build/TestSub.scala @@ -0,0 +1,3 @@ +import sbt._ + +class TestSub(info: ProjectInfo) extends DefaultProject(info) \ No newline at end of file diff --git a/src/sbt-test/project/console/test b/src/sbt-test/project/console/test new file mode 100644 index 000000000..ef1e4e956 --- /dev/null +++ b/src/sbt-test/project/console/test @@ -0,0 +1,7 @@ +> console-project +> project sub3 +> console-project +> project sub1 +> console-project +> project sub2 +> console-project \ No newline at end of file