From b7ffd26c28a29dc25565e4ed1953e0e37100f033 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Tue, 19 Apr 2011 22:24:52 -0400 Subject: [PATCH] Implement optional/provided configurations, closes #8 --- ivy/IvyInterface.scala | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/ivy/IvyInterface.scala b/ivy/IvyInterface.scala index ab011eed3..025d5f50f 100644 --- a/ivy/IvyInterface.scala +++ b/ivy/IvyInterface.scala @@ -290,11 +290,29 @@ object Configurations { def config(name: String) = new Configuration(name) def default: Seq[Configuration] = defaultMavenConfigurations - def defaultMavenConfigurations: Seq[Configuration] = Compile :: Runtime :: Test :: Provided :: System :: Optional :: Sources :: Javadoc :: Nil + def defaultMavenConfigurations: Seq[Configuration] = Compile :: Runtime :: Test :: Provided :: Optional :: Nil + def defaultInternal: Seq[Configuration] = CompileInternal :: RuntimeInternal :: TestInternal :: Nil + + lazy val RuntimeInternal = optionalInternal(Runtime) + lazy val TestInternal = fullInternal(Test) + lazy val IntegrationTestInternal = fullInternal(IntegrationTest) + lazy val CompileInternal = fullInternal(Compile) + + def internalMap(c: Configuration) = c match { + case Compile => CompileInternal + case Test => TestInternal + case Runtime => RuntimeInternal + case IntegrationTest => IntegrationTestInternal + case _ => c + } + + def internal(base: Configuration, ext: Configuration*) = config(base.name + "-internal") extend(ext : _*) hide; + def fullInternal(base: Configuration): Configuration = internal(base, base, Optional, Provided) + def optionalInternal(base: Configuration): Configuration = internal(base, base, Optional) lazy val Default = config("default") lazy val Compile = config("compile") - lazy val IntegrationTest = config("it") extend(Runtime) hide; + lazy val IntegrationTest = config("it") extend(Runtime); lazy val Provided = config("provided") lazy val Javadoc = config("javadoc") lazy val Runtime = config("runtime") extend(Compile)