From 85bc7a363de78fee968269e7be5593445386cdb6 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Thu, 27 May 2010 21:15:16 -0400 Subject: [PATCH] fix provided configuration --- .../main/scala/sbt/BasicProjectTypes.scala | 17 ++++----------- .../provided-multi/changes/A.scala | 6 ++++++ .../provided-multi/changes/B.scala | 6 ++++++ .../provided-multi/changes/P.scala | 19 +++++++++++++++++ .../provided-multi/project/build.properties | 2 ++ .../dependency-management/provided-multi/test | 21 +++++++++++++++++++ 6 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 sbt/src/sbt-test/dependency-management/provided-multi/changes/A.scala create mode 100644 sbt/src/sbt-test/dependency-management/provided-multi/changes/B.scala create mode 100644 sbt/src/sbt-test/dependency-management/provided-multi/changes/P.scala create mode 100644 sbt/src/sbt-test/dependency-management/provided-multi/project/build.properties create mode 100644 sbt/src/sbt-test/dependency-management/provided-multi/test diff --git a/sbt/src/main/scala/sbt/BasicProjectTypes.scala b/sbt/src/main/scala/sbt/BasicProjectTypes.scala index e8a646912..16b8b01e0 100644 --- a/sbt/src/main/scala/sbt/BasicProjectTypes.scala +++ b/sbt/src/main/scala/sbt/BasicProjectTypes.scala @@ -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 diff --git a/sbt/src/sbt-test/dependency-management/provided-multi/changes/A.scala b/sbt/src/sbt-test/dependency-management/provided-multi/changes/A.scala new file mode 100644 index 000000000..40190d644 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/provided-multi/changes/A.scala @@ -0,0 +1,6 @@ +import sbinary._ + +trait A +{ + def format: Format[A] +} \ No newline at end of file diff --git a/sbt/src/sbt-test/dependency-management/provided-multi/changes/B.scala b/sbt/src/sbt-test/dependency-management/provided-multi/changes/B.scala new file mode 100644 index 000000000..3519cbacb --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/provided-multi/changes/B.scala @@ -0,0 +1,6 @@ +import sbinary._ + +trait B +{ + def format(a: A): Format[A] +} \ No newline at end of file diff --git a/sbt/src/sbt-test/dependency-management/provided-multi/changes/P.scala b/sbt/src/sbt-test/dependency-management/provided-multi/changes/P.scala new file mode 100644 index 000000000..37834dded --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/provided-multi/changes/P.scala @@ -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() + } +} \ No newline at end of file diff --git a/sbt/src/sbt-test/dependency-management/provided-multi/project/build.properties b/sbt/src/sbt-test/dependency-management/provided-multi/project/build.properties new file mode 100644 index 000000000..1960ba3b0 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/provided-multi/project/build.properties @@ -0,0 +1,2 @@ +project.name=Multi Project Provided +project.version=1.0 \ No newline at end of file diff --git a/sbt/src/sbt-test/dependency-management/provided-multi/test b/sbt/src/sbt-test/dependency-management/provided-multi/test new file mode 100644 index 000000000..9019dbd82 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/provided-multi/test @@ -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 \ No newline at end of file