mirror of https://github.com/sbt/sbt.git
Merge branch '0.9' of github.com:harrah/xsbt into 0.9
This commit is contained in:
commit
fc32a31abf
|
|
@ -0,0 +1,11 @@
|
||||||
|
/* sbt -- Simple Build Tool
|
||||||
|
* Copyright 2009, 2010 Mark Harrah
|
||||||
|
*/
|
||||||
|
package sbt
|
||||||
|
|
||||||
|
final case class ClasspathOptions(autoBoot: Boolean, compiler: Boolean, extra: Boolean)
|
||||||
|
object ClasspathOptions
|
||||||
|
{
|
||||||
|
def manual = ClasspathOptions(false, false, false)
|
||||||
|
def auto = ClasspathOptions(true, true, true)
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,7 @@ package compiler
|
||||||
* order to add these jars to the boot classpath. The 'scala.home' property must be unset because Scala
|
* order to add these jars to the boot classpath. The 'scala.home' property must be unset because Scala
|
||||||
* puts jars in that directory on the bootclasspath. Because we use multiple Scala versions,
|
* puts jars in that directory on the bootclasspath. Because we use multiple Scala versions,
|
||||||
* this would lead to compiling against the wrong library jar.*/
|
* this would lead to compiling against the wrong library jar.*/
|
||||||
class CompilerArguments(scalaInstance: ScalaInstance, cp: ClasspathOptions) extends NotNull
|
final class CompilerArguments(scalaInstance: ScalaInstance, cp: ClasspathOptions)
|
||||||
{
|
{
|
||||||
def apply(sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String]): Seq[String] =
|
def apply(sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String]): Seq[String] =
|
||||||
{
|
{
|
||||||
|
|
@ -41,12 +41,6 @@ class CompilerArguments(scalaInstance: ScalaInstance, cp: ClasspathOptions) exte
|
||||||
def bootClasspathOption = if(cp.autoBoot) Seq("-bootclasspath", createBootClasspath) else Nil
|
def bootClasspathOption = if(cp.autoBoot) Seq("-bootclasspath", createBootClasspath) else Nil
|
||||||
def bootClasspath = if(cp.autoBoot) sbt.IO.pathSplit(createBootClasspath).map(new File(_)).toSeq else Nil
|
def bootClasspath = if(cp.autoBoot) sbt.IO.pathSplit(createBootClasspath).map(new File(_)).toSeq else Nil
|
||||||
}
|
}
|
||||||
class ClasspathOptions(val autoBoot: Boolean, val compiler: Boolean, val extra: Boolean) extends NotNull
|
|
||||||
object ClasspathOptions
|
|
||||||
{
|
|
||||||
def manual = new ClasspathOptions(false, false, false)
|
|
||||||
def auto = new ClasspathOptions(true, true, true)
|
|
||||||
}
|
|
||||||
object CompilerArguments
|
object CompilerArguments
|
||||||
{
|
{
|
||||||
def abs(files: Seq[File]): Seq[String] = files.map(_.getAbsolutePath)
|
def abs(files: Seq[File]): Seq[String] = files.map(_.getAbsolutePath)
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ class SameAPI(tagsA: TypeVars, tagsB: TypeVars, includePrivate: Boolean, include
|
||||||
{
|
{
|
||||||
import SameAPI._
|
import SameAPI._
|
||||||
|
|
||||||
private val pending = new mutable.HashSet[(Structure, Structure)]
|
private val pending = new mutable.HashSet[AnyRef]
|
||||||
private[this] val debugEnabled = java.lang.Boolean.getBoolean("xsbt.api.debug")
|
private[this] val debugEnabled = java.lang.Boolean.getBoolean("xsbt.api.debug")
|
||||||
def debug(flag: Boolean, msg: => String): Boolean =
|
def debug(flag: Boolean, msg: => String): Boolean =
|
||||||
{
|
{
|
||||||
|
|
@ -161,11 +161,15 @@ class SameAPI(tagsA: TypeVars, tagsB: TypeVars, includePrivate: Boolean, include
|
||||||
|
|
||||||
/** Checks that the two definitions are the same, other than their name.*/
|
/** Checks that the two definitions are the same, other than their name.*/
|
||||||
def sameDefinitionContent(a: Definition, b: Definition): Boolean =
|
def sameDefinitionContent(a: Definition, b: Definition): Boolean =
|
||||||
|
samePending(a,b)(sameDefinitionContentDirect)
|
||||||
|
def sameDefinitionContentDirect(a: Definition, b: Definition): Boolean =
|
||||||
|
{
|
||||||
//a.name == b.name &&
|
//a.name == b.name &&
|
||||||
debug(sameAccess(a.access, b.access), "Access differed") &&
|
debug(sameAccess(a.access, b.access), "Access differed") &&
|
||||||
debug(sameModifiers(a.modifiers, b.modifiers), "Modifiers differed") &&
|
debug(sameModifiers(a.modifiers, b.modifiers), "Modifiers differed") &&
|
||||||
debug(sameAnnotations(a.annotations, b.annotations), "Annotations differed") &&
|
debug(sameAnnotations(a.annotations, b.annotations), "Annotations differed") &&
|
||||||
debug(sameDefinitionSpecificAPI(a, b), "Definition-specific differed")
|
debug(sameDefinitionSpecificAPI(a, b), "Definition-specific differed")
|
||||||
|
}
|
||||||
|
|
||||||
def sameAccess(a: Access, b: Access): Boolean =
|
def sameAccess(a: Access, b: Access): Boolean =
|
||||||
(a, b) match
|
(a, b) match
|
||||||
|
|
@ -301,6 +305,8 @@ class SameAPI(tagsA: TypeVars, tagsB: TypeVars, includePrivate: Boolean, include
|
||||||
}
|
}
|
||||||
|
|
||||||
def sameType(a: Type, b: Type): Boolean =
|
def sameType(a: Type, b: Type): Boolean =
|
||||||
|
samePending(a,b)(sameTypeDirect)
|
||||||
|
def sameTypeDirect(a: Type, b: Type): Boolean =
|
||||||
(a, b) match
|
(a, b) match
|
||||||
{
|
{
|
||||||
case (sa: SimpleType, sb: SimpleType) => debug(sameSimpleType(sa, sb), "Different simple types: " + DefaultShowAPI(sa) + " and " + DefaultShowAPI(sb))
|
case (sa: SimpleType, sb: SimpleType) => debug(sameSimpleType(sa, sb), "Different simple types: " + DefaultShowAPI(sa) + " and " + DefaultShowAPI(sb))
|
||||||
|
|
@ -325,11 +331,10 @@ class SameAPI(tagsA: TypeVars, tagsB: TypeVars, includePrivate: Boolean, include
|
||||||
sameSimpleType(a.baseType, b.baseType) &&
|
sameSimpleType(a.baseType, b.baseType) &&
|
||||||
sameAnnotations(a.annotations, b.annotations)
|
sameAnnotations(a.annotations, b.annotations)
|
||||||
def sameStructure(a: Structure, b: Structure): Boolean =
|
def sameStructure(a: Structure, b: Structure): Boolean =
|
||||||
if(pending add ((a,b)) )
|
samePending(a,b)(sameStructureDirect)
|
||||||
try { sameStructureDirect(a,b) }
|
private[this] def samePending[T](a: T, b: T)(f: (T,T) => Boolean): Boolean =
|
||||||
finally { pending -= ((a,b)) }
|
if(pending add ((a,b)) ) f(a,b) else true
|
||||||
else
|
|
||||||
true
|
|
||||||
def sameStructureDirect(a: Structure, b: Structure): Boolean =
|
def sameStructureDirect(a: Structure, b: Structure): Boolean =
|
||||||
sameSeq(a.parents, b.parents)(sameType) &&
|
sameSeq(a.parents, b.parents)(sameType) &&
|
||||||
sameMembers(a.declared, b.declared) &&
|
sameMembers(a.declared, b.declared) &&
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,8 @@ object Defaults
|
||||||
)
|
)
|
||||||
|
|
||||||
def compileBase = Seq(
|
def compileBase = Seq(
|
||||||
compilers <<= (scalaInstance, appConfiguration, streams) map { (si, app, s) => Compiler.compilers(si)(app, s.log) },
|
classpathOptions in GlobalScope :== ClasspathOptions.auto,
|
||||||
|
compilers <<= (scalaInstance, appConfiguration, streams, classpathOptions) map { (si, app, s, co) => Compiler.compilers(si, co)(app, s.log) },
|
||||||
javacOptions in GlobalScope :== Nil,
|
javacOptions in GlobalScope :== Nil,
|
||||||
scalacOptions in GlobalScope :== Nil,
|
scalacOptions in GlobalScope :== Nil,
|
||||||
scalaInstance <<= (appConfiguration, scalaVersion){ (app, version) => ScalaInstance(version, app.provider.scalaProvider.launcher) },
|
scalaInstance <<= (appConfiguration, scalaVersion){ (app, version) => ScalaInstance(version, app.provider.scalaProvider.launcher) },
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ object Keys
|
||||||
val compileInputs = TaskKey[Compiler.Inputs]("compile-inputs")
|
val compileInputs = TaskKey[Compiler.Inputs]("compile-inputs")
|
||||||
val scalaInstance = SettingKey[ScalaInstance]("scala-instance")
|
val scalaInstance = SettingKey[ScalaInstance]("scala-instance")
|
||||||
val scalaVersion = SettingKey[String]("scala-version")
|
val scalaVersion = SettingKey[String]("scala-version")
|
||||||
|
val classpathOptions = SettingKey[ClasspathOptions]("classpath-options")
|
||||||
|
|
||||||
val webappDir = SettingKey[File]("webapp-dir")
|
val webappDir = SettingKey[File]("webapp-dir")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue