diff --git a/main/Defaults.scala b/main/Defaults.scala index d06cb78bf..018fd2f64 100644 --- a/main/Defaults.scala +++ b/main/Defaults.scala @@ -7,6 +7,7 @@ package sbt import Scope.{fillTaskAxis, GlobalScope, ThisScope} import xsbt.api.Discovery import Project.{inConfig, Initialize, inScope, inTask, ScopedKey, Setting, SettingsDefinition} + import Load.LoadedBuild import Artifact.{DocClassifier, SourceClassifier} import Configurations.{Compile, CompilerPlugin, IntegrationTest, names, Provided, Runtime, Test} import complete._ @@ -539,12 +540,12 @@ object Defaults extends BuildCommon transitiveDependencies(base, lb, includeRoot, classpath, aggregate) map ( ref => (key in ref) ?? default(ref) ) join ; } - def transitiveDependencies(base: ProjectRef, structure: Load.LoadedBuild, includeRoot: Boolean, classpath: Boolean = true, aggregate: Boolean = false): Seq[ProjectRef] = + def transitiveDependencies(base: ProjectRef, structure: LoadedBuild, includeRoot: Boolean, classpath: Boolean = true, aggregate: Boolean = false): Seq[ProjectRef] = { val full = Dag.topologicalSort(base)(getDependencies(structure, classpath, aggregate)) if(includeRoot) full else full.dropRight(1) } - def getDependencies(structure: Load.LoadedBuild, classpath: Boolean = true, aggregate: Boolean = false): ProjectRef => Seq[ProjectRef] = + def getDependencies(structure: LoadedBuild, classpath: Boolean = true, aggregate: Boolean = false): ProjectRef => Seq[ProjectRef] = ref => Project.getProject(ref, structure).toList flatMap { p => (if(classpath) p.dependencies.map(_.project) else Nil) ++ (if(aggregate) p.aggregate else Nil) @@ -594,7 +595,7 @@ object Classpaths products <<= makeProducts, productDirectories <<= compileInputs map (_.config.classesDirectory :: Nil), exportedProducts <<= exportProductsTask, - classpathConfiguration <<= (internalConfigurationMap, configuration)( _ apply _ ), + classpathConfiguration <<= (internalConfigurationMap, configuration, classpathConfiguration.?, update.task) apply findClasspathConfig, managedClasspath <<= (classpathConfiguration, classpathTypes, update) map managedJars, // remove when defaultExcludes and classpathFilter are removed excludeFilter in unmanagedJars <<= (defaultExcludes in unmanagedJars) or (excludeFilter in unmanagedJars), @@ -608,6 +609,14 @@ object Classpaths for(task <- defaultPackageKeys; conf <- Seq(Compile, Test)) yield (task in conf) lazy val defaultArtifactTasks: Seq[ScopedTask[File]] = makePom +: defaultPackages + def findClasspathConfig(map: Configuration => Configuration, thisConfig: Configuration, delegate: Task[Option[Configuration]], up: Task[UpdateReport]): Task[Configuration] = + (delegate :^: up :^: KNil) map { case delegated :+: report :+: HNil => + val defined = report.allConfigurations.toSet + val search = map(thisConfig) +: (delegated.toList ++ Seq(Compile, Configurations.Default)) + def notFound = error("Configuration to use for managed classpath must be explicitly defined when default configurations are not present.") + search find { defined contains _.name } getOrElse notFound + } + def packaged(pkgTasks: Seq[ScopedTask[File]]): Initialize[Task[Map[Artifact, File]]] = enabledOnly(packagedArtifact.task, pkgTasks) apply (_.join.map(_.toMap)) def artifactDefs(pkgTasks: Seq[ScopedTask[File]]): Initialize[Seq[Artifact]] = diff --git a/main/Keys.scala b/main/Keys.scala index e5a4f2848..2220ea977 100644 --- a/main/Keys.scala +++ b/main/Keys.scala @@ -219,7 +219,7 @@ object Keys val fullClasspath = TaskKey[Classpath]("full-classpath", "The exported classpath, consisting of build products and unmanaged and managed, internal and external dependencies.") val internalConfigurationMap = SettingKey[Configuration => Configuration]("internal-configuration-map", "Maps configurations to the actual configuration used to define the classpath.") - val classpathConfiguration = SettingKey[Configuration]("classpath-configuration", "The configuration used to define the classpath.") + val classpathConfiguration = TaskKey[Configuration]("classpath-configuration", "The configuration used to define the classpath.") val ivyConfiguration = TaskKey[IvyConfiguration]("ivy-configuration", "General dependency management (Ivy) settings, such as the resolvers and paths to use.") val ivyConfigurations = SettingKey[Seq[Configuration]]("ivy-configurations", "The defined configurations for dependency management. This may be different from the configurations for Project settings.") val moduleSettings = TaskKey[ModuleSettings]("module-settings", "Module settings, which configure a specific module, such as a project.") diff --git a/sbt/src/sbt-test/dependency-management/ivy-settings-a/build.sbt b/sbt/src/sbt-test/dependency-management/ivy-settings-a/build.sbt index d78524dc5..7d4ed2d02 100644 --- a/sbt/src/sbt-test/dependency-management/ivy-settings-a/build.sbt +++ b/sbt/src/sbt-test/dependency-management/ivy-settings-a/build.sbt @@ -1,6 +1,6 @@ seq(externalIvySettings(), externalIvyFile()) TaskKey[Unit]("check") <<= (baseDirectory, update) map { (base, report) => - val files = report.matching( moduleFilter(organization = "org.scalacheck", name = "scalacheck", revision = "1.5") ) + val files = report.matching( moduleFilter(organization = "org.scala-tools.testing", name = "scalacheck*", revision = "1.9") ) assert(!files.isEmpty, "ScalaCheck module not found in update report") } \ No newline at end of file diff --git a/sbt/src/sbt-test/dependency-management/ivy-settings-a/changes/scalacheck-ivy.xml b/sbt/src/sbt-test/dependency-management/ivy-settings-a/changes/scalacheck-ivy.xml index 522e78a48..a26af7cf0 100644 --- a/sbt/src/sbt-test/dependency-management/ivy-settings-a/changes/scalacheck-ivy.xml +++ b/sbt/src/sbt-test/dependency-management/ivy-settings-a/changes/scalacheck-ivy.xml @@ -2,6 +2,6 @@ - + \ No newline at end of file diff --git a/sbt/src/sbt-test/dependency-management/ivy-settings-a/src/test/scala/Test.scala b/sbt/src/sbt-test/dependency-management/ivy-settings-a/src/test/scala/Test.scala new file mode 100644 index 000000000..5da1123be --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/ivy-settings-a/src/test/scala/Test.scala @@ -0,0 +1,3 @@ +import org.scalacheck._ + +object Test extends Properties("Test") \ No newline at end of file diff --git a/sbt/src/sbt-test/dependency-management/ivy-settings-a/test b/sbt/src/sbt-test/dependency-management/ivy-settings-a/test index 0129b8a05..87213b2d4 100644 --- a/sbt/src/sbt-test/dependency-management/ivy-settings-a/test +++ b/sbt/src/sbt-test/dependency-management/ivy-settings-a/test @@ -5,3 +5,4 @@ $ copy-file changes/scalacheck-ivy.xml ivy.xml $ copy-file changes/scala-tools-ivysettings.xml ivysettings.xml > check +> test:compile \ No newline at end of file