make classpaths exported

This commit is contained in:
Mark Harrah 2013-02-28 17:59:38 -05:00
parent f2d29d8678
commit dde24d5e5a
2 changed files with 18 additions and 6 deletions

View File

@ -805,19 +805,30 @@ object Classpaths
def concat[T](a: ScopedTaskable[Seq[T]], b: ScopedTaskable[Seq[T]]): Initialize[Task[Seq[T]]] = (a,b) map ( _ ++ _)
def concatSettings[T](a: SettingKey[Seq[T]], b: SettingKey[Seq[T]]): Initialize[Seq[T]] = (a,b)(_ ++ _)
lazy val configSettings: Seq[Setting[_]] = Seq(
lazy val configSettings: Seq[Setting[_]] = classpaths ++ Seq(
products <<= makeProducts,
productDirectories := compileInputs.value.config.classesDirectory :: Nil,
classpathConfiguration := findClasspathConfig(internalConfigurationMap.value, configuration.value, classpathConfiguration.?.value, update.value)
)
private[this] def classpaths: Seq[Setting[_]] = Seq(
externalDependencyClasspath <<= concat(unmanagedClasspath, managedClasspath),
dependencyClasspath <<= concat(internalDependencyClasspath, externalDependencyClasspath),
fullClasspath <<= concatDistinct(exportedProducts, dependencyClasspath),
internalDependencyClasspath <<= internalDependencies,
unmanagedClasspath <<= unmanagedDependencies,
products <<= makeProducts,
productDirectories := compileInputs.value.config.classesDirectory :: Nil,
exportedProducts <<= exportProductsTask,
classpathConfiguration := findClasspathConfig(internalConfigurationMap.value, configuration.value, classpathConfiguration.?.value, update.value),
managedClasspath := managedJars(classpathConfiguration.value, classpathTypes.value, update.value),
exportedProducts <<= exportProductsTask,
unmanagedJars := findUnmanagedJars(configuration.value, unmanagedBase.value, includeFilter in unmanagedJars value, excludeFilter in unmanagedJars value)
)
).map(exportClasspath)
private[this] def exportClasspath(s: Setting[Task[Classpath]]): Setting[Task[Classpath]] =
s.mapInitialize(init => Def.task { exportClasspath(streams.value, init.value) })
private[this] def exportClasspath(s: TaskStreams, cp: Classpath): Classpath =
{
s.text("export").println(Path.makeString(data(cp)))
cp
}
def defaultPackageKeys = Seq(packageBin, packageSrc, packageDoc)
lazy val defaultPackages: Seq[TaskKey[File]] =
for(task <- defaultPackageKeys; conf <- Seq(Compile, Test)) yield (task in conf)

View File

@ -267,6 +267,7 @@ trait Init[Scope]
def mapInit(f: (ScopedKey[T], T) => T): Setting[T] = new Setting(key, init(t => f(key,t)), pos)
def mapConstant(g: MapConstant): Setting[T] = new Setting(key, init mapConstant g, pos)
def withPos(pos: SourcePosition) = new Setting(key, init, pos)
private[sbt] def mapInitialize(f: Initialize[T] => Initialize[T]): Setting[T] = new Setting(key, f(init), pos)
override def toString = "setting(" + key + ") at " + pos
}