fix provided configuration

This commit is contained in:
Mark Harrah 2010-05-27 21:15:16 -04:00
parent b28d0361d7
commit 85bc7a363d
6 changed files with 58 additions and 13 deletions

View File

@ -322,8 +322,6 @@ trait BasicManagedProject extends ManagedProject with ReflectiveManagedProject w
def deliverIvyModule = newIvyModule(deliverModuleSettings)
def publishModuleSettings = deliverModuleSettings
def publishIvyModule = newIvyModule(publishModuleSettings)
/** True if the 'provided' configuration should be included on the 'compile' classpath. The default value is true.*/
def includeProvidedWithCompile = true
/** True if the default implicit extensions should be used when determining classpaths. The default value is true. */
def defaultConfigurationExtensions = true
/** If true, verify that explicit dependencies on Scala libraries use the same version as scala.version. */
@ -343,22 +341,15 @@ trait BasicManagedProject extends ManagedProject with ReflectiveManagedProject w
case _ => None
}
}
/** Includes the Provided configuration on the Compile classpath, the Compile configuration on the Runtime classpath,
* and Compile and Runtime on the Test classpath. Including Provided can be disabled by setting
* includeProvidedWithCompile to false. Including Compile and Runtime can be disabled by setting
* defaultConfigurationExtensions to false.*/
/** Includes the Compile configuration on the Runtime classpath, and Compile and Runtime on the Test classpath.
* Including Compile and Runtime can be disabled by setting defaultConfigurationExtensions to false.*/
override def managedClasspath(config: Configuration) =
{
import Configurations.{Compile, CompilerPlugin, Default, Provided, Runtime, Test}
import Configurations.{Compile, Default, Runtime, Test}
val baseClasspath = configurationClasspath(config)
config match
{
case Compile =>
val baseCompileClasspath = baseClasspath +++ managedClasspath(Default)
if(includeProvidedWithCompile)
baseCompileClasspath +++ managedClasspath(Provided)
else
baseCompileClasspath
case Compile => baseClasspath +++ managedClasspath(Default)
case Runtime if defaultConfigurationExtensions => baseClasspath +++ managedClasspath(Compile)
case Test if defaultConfigurationExtensions => baseClasspath +++ managedClasspath(Runtime)
case _ => baseClasspath

View File

@ -0,0 +1,6 @@
import sbinary._
trait A
{
def format: Format[A]
}

View File

@ -0,0 +1,6 @@
import sbinary._
trait B
{
def format(a: A): Format[A]
}

View File

@ -0,0 +1,19 @@
import sbt._
class P(info: ProjectInfo) extends ParentProject(info)
{
val a = project("a", "A", new A(_))
val b = project("b", "B", new B(_), a)
def aLibrary = "org.scala-tools.sbinary" %% "sbinary" % "0.3" % "provided"
class A(info: ProjectInfo) extends DefaultProject(info)
{
val a = aLibrary
}
class B(info: ProjectInfo) extends DefaultWebProject(info)
{
override def libraryDependencies =
if("declare.lib".asFile.exists) Set(aLibrary) else Set()
}
}

View File

@ -0,0 +1,2 @@
project.name=Multi Project Provided
project.version=1.0

View File

@ -0,0 +1,21 @@
> set build.scala.versions 2.7.7
$ copy-file changes/P.scala project/build/P.scala
$ copy-file changes/A.scala a/src/main/scala/A.scala
$ copy-file changes/B.scala b/src/main/scala/B.scala
> reload
> project A
-> compile
> update
> compile
> project B
-> compile
> update
-> compile
$ touch b/declare.lib
> reload
-> compile
> update
> compile