From 7689343ba0ee1cb6379dbae1a504c940d8697359 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Mon, 15 Apr 2013 18:18:52 -0400 Subject: [PATCH] Docs: correct custom Ivy configuration faq section --- src/sphinx/faq.rst | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/sphinx/faq.rst b/src/sphinx/faq.rst index 1a0101987..b293b2019 100644 --- a/src/sphinx/faq.rst +++ b/src/sphinx/faq.rst @@ -469,14 +469,15 @@ configuration and classpaths. These are the steps: 4. Use the classpath to implement the task. As an example, consider a ``proguard`` task. This task needs the -ProGuard jars in order to run the tool. Assuming a new configuration -defined in the full build definition (#1): +ProGuard jars in order to run the tool. First, define and add the new configuration: :: val ProguardConfig = config("proguard") hide -the following are settings that implement #2-#4: + ivyConfigurations += ProguardConfig + +Then, :: @@ -486,8 +487,10 @@ the following are settings that implement #2-#4: "net.sf.proguard" % "proguard" % "4.4" % ProguardConfig.name // Extract the dependencies from the UpdateReport. - managedClasspath in proguard := - Classpaths.managedJars(proguardConfig, (classpathTypes in proguard).value, update.value) + managedClasspath in proguard := { + // these are the types of artifacts to include + val artifactTypes: Set[String] = (classpathTypes in proguard).value + Classpaths.managedJars(proguardConfig, artifactTypes, update.value) } // Use the dependencies in a task, typically by putting them @@ -498,6 +501,21 @@ the following are settings that implement #2-#4: // ... do something with , which includes proguard ... } +Defining the intermediate classpath is optional, but it can be useful for debugging or if it needs to +be used by multiple tasks. +It is also possible to specify artifact types inline. +This alternative ``proguard`` task would look like: + +:: + + proguard := { + val artifactTypes = Set("jar") + val cp: Seq[File] = + Classpaths.managedJars(proguardConfig, artifactTypes, update.value) + // ... do something with , which includes proguard ... + } + + How would I change sbt's classpath dynamically? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~