diff --git a/project/build.properties b/project/build.properties
index 66c6dd626..e5c1ce7f9 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -1,7 +1,5 @@
-#Project properties
-#Tue Dec 29 21:41:25 EST 2009
project.organization=org.scala-tools.sbt
project.name=Simple Build Tool
sbt.version=0.5.6
-project.version=0.6.10-SNAPSHOT
+project.version=0.6.11-SNAPSHOT
scala.version=2.7.7
diff --git a/src/main/scala/sbt/BasicProjectTypes.scala b/src/main/scala/sbt/BasicProjectTypes.scala
index 12cfa6f54..581317951 100644
--- a/src/main/scala/sbt/BasicProjectTypes.scala
+++ b/src/main/scala/sbt/BasicProjectTypes.scala
@@ -53,107 +53,53 @@ trait UnmanagedClasspathProject extends ClasspathProject
def fullUnmanagedClasspath(config: Configuration): PathFinder
}
-/** A project that provides automatic dependency management.*/
-trait ManagedProject extends ClasspathProject
+trait IvyTasks extends Project
{
- trait ManagedOption extends ActionOption
- final class ManagedFlagOption extends ManagedOption
- /** An update option that specifies that unneeded files should be pruned from the managed library directory
- * after updating. */
- final val Synchronize = new ManagedFlagOption
- /** An update option that specifies that Ivy should validate configurations.*/
- final val Validate = new ManagedFlagOption
- /** An update option that puts Ivy into a quieter logging mode.*/
- final val QuietUpdate = new ManagedFlagOption
- /** An update option that adds the scala-tools.org releases repository to the set of resolvers, unless
- * no inline repositories are present and an ivysettings.xml file is present.*/
- final val AddScalaToolsReleases = new ManagedFlagOption
- /** An update option that specifies that an error should be generated if no inline dependencies, resolvers,
- * XML file, or Ivy or Maven configuration files are present.*/
- final val ErrorIfNoConfiguration = new ManagedFlagOption
- /** An update option that explicitly specifies the dependency manager to use. This can be used to
- * override the default precendence. */
- final case class LibraryManager(m: Manager) extends ManagedOption
- /** An update option that overrides the default Ivy cache location. */
- final case class CacheDirectory(dir: Path) extends ManagedOption
- final case class CheckScalaVersion(configs: Iterable[Configuration], checkExplicit: Boolean, filterImplicit: Boolean) extends ManagedOption
-
- protected def withConfigurations(outputPattern: String, managedDependencyPath: Path, options: Seq[ManagedOption])
- (doWith: (IvyConfiguration, UpdateConfiguration) => Option[String]) =
- {
- var synchronize = false
- var validate = false
- var quiet = false
- var addScalaTools = false
- var errorIfNoConfiguration = false
- var manager: Manager = new AutoDetectManager(projectID)
- var cacheDirectory: Option[Path] = None
- var checkScalaVersion: Option[IvyScala] = None
- for(option <- options)
- {
- option match
- {
- case Synchronize => synchronize = true
- case Validate => validate = true
- case LibraryManager(m) => manager = m
- case QuietUpdate => quiet = true
- case AddScalaToolsReleases => addScalaTools = true
- case ErrorIfNoConfiguration => errorIfNoConfiguration = true
- case CacheDirectory(dir) => cacheDirectory = Some(dir)
- case CheckScalaVersion(configs, checkExplicit, filterImplicit) =>
- checkScalaVersion = Some(new IvyScala(buildScalaVersion, configs, checkExplicit, filterImplicit))
- case _ => log.warn("Ignored unknown managed option " + option)
- }
- }
- val ivyPaths = new IvyPaths(info.projectPath, managedDependencyPath, cacheDirectory)
- val ivyFlags = new IvyFlags(validate, addScalaTools, errorIfNoConfiguration)
- val ivyConfiguration = new IvyConfiguration(ivyPaths, manager, ivyFlags, checkScalaVersion, log)
- val updateConfiguration = new UpdateConfiguration(outputPattern, synchronize, quiet)
- doWith(ivyConfiguration, updateConfiguration)
- }
- protected def withIvyTask(doTask: => Option[String]) =
+ def ivyTask(action: => Unit) =
task
{
- try { doTask }
- catch
- {
- case e: NoClassDefFoundError =>
+ try { action; None }
+ catch {
+ case e: Exception =>
log.trace(e)
- Some("Apache Ivy is required for dependency management (" + e.toString + ")")
+ log.error(e.toString)
+ Some(e.toString)
}
}
- def updateTask(outputPattern: String, managedDependencyPath: Path, options: ManagedOption*): Task =
- updateTask(outputPattern, managedDependencyPath, options)
- def updateTask(outputPattern: String, managedDependencyPath: Path, options: => Seq[ManagedOption]) =
- withIvyTask(withConfigurations(outputPattern, managedDependencyPath, options)(ManageDependencies.update))
+ def updateTask(module: => IvySbt#Module, configuration: => UpdateConfiguration) =
+ ivyTask { IvyActions.update(module, configuration) }
- def publishTask(publishConfiguration: => PublishConfiguration, options: => Seq[ManagedOption]) =
- withIvyTask
+ def publishTask(module: => IvySbt#Module, publishConfiguration: => PublishConfiguration) =
+ ivyTask
{
val publishConfig = publishConfiguration
import publishConfig._
- withConfigurations("", managedDependencyPath, options) { (ivyConf, ignore) =>
- val delivered = if(publishIvy) Some(deliveredPattern) else None
- ManageDependencies.publish(ivyConf, resolverName, srcArtifactPatterns, delivered, configurations) }
+ val deliveredIvy = if(publishIvy) Some(deliveredPattern) else None
+ IvyActions.publish(module, resolverName, srcArtifactPatterns, deliveredIvy, configurations)
}
- def deliverTask(deliverConfiguration: => PublishConfiguration, options: => Seq[ManagedOption]) =
- withIvyTask
+ def deliverTask(module: => IvySbt#Module, deliverConfiguration: => PublishConfiguration, quiet: Boolean) =
+ ivyTask
{
val deliverConfig = deliverConfiguration
import deliverConfig._
- withConfigurations("", managedDependencyPath, options) { (ivyConf, updateConf) =>
- ManageDependencies.deliver(ivyConf, updateConf, status, deliveredPattern, extraDependencies, configurations)
- }
+ IvyActions.deliver(module, status, deliveredPattern, extraDependencies, configurations, quiet)
}
- def makePomTask(output: => Path, extraDependencies: => Iterable[ModuleID], configurations: => Option[Iterable[Configuration]], options: => Seq[ManagedOption]) =
- withIvyTask(withConfigurations("", managedDependencyPath, options) { (ivyConf, ignore) =>
- ManageDependencies.makePom(ivyConf, extraDependencies, configurations, output.asFile) })
+ def makePomTask(module: => IvySbt#Module, output: => Path, extraDependencies: => Iterable[ModuleID], configurations: => Option[Iterable[Configuration]]) =
+ ivyTask { IvyActions.makePom(module, extraDependencies, configurations, output asFile) }
- def cleanCacheTask(managedDependencyPath: Path, options: => Seq[ManagedOption]) =
- withIvyTask(withConfigurations("", managedDependencyPath, options) { (ivyConf, ignore) => ManageDependencies.cleanCache(ivyConf) })
+ def installTask(module: IvySbt#Module, from: Resolver, to: Resolver) =
+ ivyTask { IvyActions.install(module, from.name, to.name) }
+
+ def cleanCacheTask(ivySbt: => IvySbt) =
+ ivyTask { IvyActions.cleanCache(ivySbt) }
- def cleanLibTask(managedDependencyPath: Path) = task { FileUtilities.clean(managedDependencyPath.get, log) }
+ def cleanLibTask(managedDependencyPath: Path) =
+ task { FileUtilities.clean(managedDependencyPath.get, log) }
+}
+/** A project that provides automatic dependency management.*/
+trait ManagedProject extends ClasspathProject with IvyTasks
+{
/** This is the public ID of the project (used for publishing, for example) */
def moduleID: String = normalizedName + appendable(crossScalaVersionString)
/** This is the full public ID of the project (used for publishing, for example) */
@@ -224,10 +170,73 @@ import ManagedStyle.{Auto, Ivy, Maven, Value => ManagedType}
trait BasicManagedProject extends ManagedProject with ReflectiveManagedProject with BasicDependencyPaths
{
import BasicManagedProject._
- /** The dependency manager that represents inline declarations. The default manager packages the information
- * from 'ivyXML', 'projectID', 'repositories', and 'libraryDependencies' and does not typically need to be
- * be overridden. */
- def manager = new SimpleManager(ivyXML, true, projectID, repositories.toSeq, moduleConfigurations.toSeq, ivyConfigurations, defaultConfiguration, libraryDependencies.toList: _*)
+
+ def ivyUpdateConfiguration = new UpdateConfiguration(managedDependencyPath.asFile, outputPattern, true/*sync*/, true/*quiet*/)
+
+ def ivyRepositories: Seq[Resolver] =
+ {
+ val repos = repositories.toSeq
+ if(repos.isEmpty) Nil else Resolver.withDefaultResolvers(repos)
+ }
+ def ivyValidate = true
+ def ivyScala: Option[IvyScala] = Some(new IvyScala(buildScalaVersion, checkScalaInConfigurations, checkExplicitScalaDependencies, filterScalaJars))
+ def ivyCacheDirectory: Option[Path] = None
+
+ def ivyPaths: IvyPaths = new IvyPaths(info.projectPath.asFile, ivyCacheDirectory.map(_.asFile))
+ def inlineIvyConfiguration = new InlineIvyConfiguration(ivyPaths, ivyRepositories.toSeq, moduleConfigurations.toSeq, log)
+ def ivyConfiguration: IvyConfiguration =
+ {
+ val in = inlineIvyConfiguration
+ def parentIvyConfiguration(default: IvyConfiguration)(p: Project) = p match { case b: BasicManagedProject => b.ivyConfiguration; case _ => default }
+ if(in.resolvers.isEmpty)
+ {
+ if(in.moduleConfigurations.isEmpty)
+ {
+ IvyConfiguration(in.paths, in.log) match
+ {
+ case e: ExternalIvyConfiguration => e
+ case i => info.parent map(parentIvyConfiguration(i)) getOrElse(i)
+ }
+ }
+ else
+ new InlineIvyConfiguration(in.paths, Resolver.withDefaultResolvers(Nil), in.moduleConfigurations, in.log)
+ }
+ else
+ in
+ }
+
+ def moduleSettings: ModuleSettings = defaultModuleSettings
+ def byIvyFile(path: Path): IvyFileConfiguration = new IvyFileConfiguration(path.asFile, ivyScala, ivyValidate)
+ def byPom(path: Path): PomConfiguration = new PomConfiguration(path.asFile, ivyScala, ivyValidate)
+ /** The settings that represent inline declarations. The default settings combines the information
+ * from 'ivyXML', 'projectID', 'repositories', ivyConfigurations, defaultConfiguration,
+ * ivyScala, and 'libraryDependencies' and does not typically need to be be overridden. */
+ def inlineSettings = new InlineConfiguration(projectID, libraryDependencies, ivyXML, ivyConfigurations, defaultConfiguration, ivyScala, ivyValidate)
+ def defaultModuleSettings: ModuleSettings =
+ {
+ val in = inlineSettings
+ if(in.configurations.isEmpty)
+ {
+ if(in.dependencies.isEmpty && in.ivyXML.isEmpty && in.module.explicitArtifacts.isEmpty && in.configurations.isEmpty)
+ externalSettings
+ else if(useDefaultConfigurations)
+ in withConfigurations ( Configurations.defaultMavenConfigurations )
+ else
+ in
+ }
+ else
+ in
+ }
+ def externalSettings = ModuleSettings(ivyScala, ivyValidate, projectID)(info.projectPath.asFile, log)
+
+ def ivySbt: IvySbt = new IvySbt(ivyConfiguration)
+ def ivyModule: IvySbt#Module = newIvyModule(moduleSettings)
+ def newIvyModule(moduleSettings: ModuleSettings): IvySbt#Module =
+ {
+ val i = ivySbt
+ new i.Module(moduleSettings)
+ }
+
/** The pattern for Ivy to use when retrieving dependencies into the local project. Classpath management
* depends on the first directory being [conf] and the extension being [ext].*/
@@ -235,8 +244,11 @@ trait BasicManagedProject extends ManagedProject with ReflectiveManagedProject w
/** Override this to specify the publications, configurations, and/or dependencies sections of an Ivy file.
* See http://code.google.com/p/simple-build-tool/wiki/LibraryManagement for details.*/
def ivyXML: scala.xml.NodeSeq = scala.xml.NodeSeq.Empty
- /** The base options passed to the 'update' action. */
- def baseUpdateOptions = checkScalaVersion :: Validate :: Synchronize :: QuietUpdate :: AddScalaToolsReleases :: Nil
+ def expandedIvyConfigurations =
+ {
+ val confs = ivyConfigurations
+ if(confs.isEmpty) Configurations.defaultMavenConfigurations else confs
+ }
override def ivyConfigurations: Iterable[Configuration] =
{
val reflective = super.ivyConfigurations
@@ -271,20 +283,13 @@ trait BasicManagedProject extends ManagedProject with ReflectiveManagedProject w
case Auto => Resolver.defaultPatterns
}
}
- /** The options provided to the 'update' action. This is by default the options in 'baseUpdateOptions'.
- * If 'manager' has any dependencies, resolvers, or inline Ivy XML (which by default happens when inline
- * dependency management is used), it is passed as the dependency manager.*/
- def updateOptions: Seq[ManagedOption] = baseUpdateOptions ++ managerOption
- def managerOption: Seq[ManagedOption] =
- {
- val m = manager
- if(m.dependencies.isEmpty && m.resolvers.isEmpty && ivyXML.isEmpty && m.module.explicitArtifacts.isEmpty && m.configurations.isEmpty)
- Nil
- else
- LibraryManager(m) :: Nil
- }
- def deliverOptions: Seq[ManagedOption] = updateOptions.filter { case _: CheckScalaVersion => false; case _ => true }
- def publishOptions: Seq[ManagedOption] = deliverOptions
+
+ def updateModuleSettings = moduleSettings
+ def updateIvyModule = newIvyModule(updateModuleSettings)
+ def deliverModuleSettings = moduleSettings.noScala
+ 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. */
@@ -304,7 +309,6 @@ trait BasicManagedProject extends ManagedProject with ReflectiveManagedProject w
else
all
}
- def checkScalaVersion = CheckScalaVersion(checkScalaInConfigurations, checkExplicitScalaDependencies, filterScalaJars)
def defaultPublishRepository: Option[Resolver] =
{
reflectiveRepositories.get("publish-to") orElse
@@ -336,9 +340,9 @@ trait BasicManagedProject extends ManagedProject with ReflectiveManagedProject w
}
}
- protected def updateAction = updateTask(outputPattern, managedDependencyPath, updateOptions) describedAs UpdateDescription
+ protected def updateAction = updateTask(updateIvyModule, ivyUpdateConfiguration) describedAs UpdateDescription
protected def cleanLibAction = cleanLibTask(managedDependencyPath) describedAs CleanLibDescription
- protected def cleanCacheAction = cleanCacheTask(managedDependencyPath, updateOptions) describedAs CleanCacheDescription
+ protected def cleanCacheAction = cleanCacheTask(ivySbt) describedAs CleanCacheDescription
protected def deliverProjectDependencies: Iterable[ModuleID] =
{
@@ -349,19 +353,19 @@ trait BasicManagedProject extends ManagedProject with ReflectiveManagedProject w
interDependencies.readOnly
}
protected def deliverScalaDependencies: Iterable[ModuleID] = Nil
- protected def makePomAction = makePomTask(pomPath, deliverProjectDependencies, None, updateOptions)
- protected def deliverLocalAction = deliverTask(publishLocalConfiguration, deliverOptions)
+ protected def makePomAction = makePomTask(deliverIvyModule, pomPath, deliverProjectDependencies, None)
+ protected def deliverLocalAction = deliverTask(deliverIvyModule, publishLocalConfiguration, true /*quiet*/)
protected def publishLocalAction =
{
val dependencies = deliverLocal :: publishPomDepends
- publishTask(publishLocalConfiguration, publishOptions) dependsOn(dependencies : _*)
+ publishTask(publishIvyModule, publishLocalConfiguration) dependsOn(dependencies : _*)
}
protected def publishLocalConfiguration = new DefaultPublishConfiguration("local", "release", true)
- protected def deliverAction = deliverTask(publishConfiguration, deliverOptions)
+ protected def deliverAction = deliverTask(deliverIvyModule, publishConfiguration, true)
protected def publishAction =
{
val dependencies = deliver :: publishPomDepends
- publishTask(publishConfiguration, publishOptions) dependsOn(dependencies : _*)
+ publishTask(publishIvyModule, publishConfiguration) dependsOn(dependencies : _*)
}
private def publishPomDepends = if(managedStyle == Maven) makePom :: Nil else Nil
protected def publishConfiguration =
@@ -425,19 +429,12 @@ class DefaultInstallProject(val info: ProjectInfo) extends InstallProject with M
}
trait InstallProject extends BasicManagedProject
{
- def installOptions: Seq[ManagedOption] = updateOptions
- override def filterScalaJars = false
- override def checkExplicitScalaDependencies = false
- lazy val install = installTask(updateOptions)
- def installTask(options: => Seq[ManagedOption]) =
- withIvyTask
- {
- withConfigurations("", managedDependencyPath, options) { (ivyConf, ignore) =>
- val toResolver = reflectiveRepositories.get("publish-to").getOrElse(error("No repository to publish to was specified"))
- val fromResolver = reflectiveRepositories.get("retrieve-from").getOrElse(error("No repository to retrieve from was specified"))
- ManageDependencies.install(ivyConf, fromResolver.name, toResolver.name, true, true)
- }
- }
+ def installModuleSettings: ModuleSettings = moduleSettings.noScala
+ def installIvyModule: IvySbt#Module = newIvyModule(installModuleSettings)
+
+ lazy val install = installTask(installIvyModule, fromResolver, toResolver)
+ def toResolver = reflectiveRepositories.get("publish-to").getOrElse(error("No repository to publish to was specified"))
+ def fromResolver = reflectiveRepositories.get("retrieve-from").getOrElse(error("No repository to retrieve from was specified"))
}
trait BasicDependencyPaths extends ManagedProject
@@ -538,7 +535,7 @@ trait ReflectiveProject extends ReflectiveModules with ReflectiveTasks with Refl
/** This Project subclass is used to contain other projects as dependencies.*/
class ParentProject(val info: ProjectInfo) extends BasicDependencyProject
{
- override def managerOption: Seq[ManagedOption] = LibraryManager(new AutoDetectManager(projectID, false)) :: Nil
+ override def moduleSettings = externalSettings
def dependencies: Iterable[Project] = info.dependencies ++ subProjects.values.toList
/** The directories to which a project writes are listed here and is used
* to check a project and its dependencies for collisions.*/
diff --git a/src/main/scala/sbt/BuilderProject.scala b/src/main/scala/sbt/BuilderProject.scala
index 611180c40..dff01c173 100644
--- a/src/main/scala/sbt/BuilderProject.scala
+++ b/src/main/scala/sbt/BuilderProject.scala
@@ -57,7 +57,7 @@ private sealed abstract class BasicBuilderProject extends InternalProject with S
def tpe: String
- import xsbt.{ComponentManager, ScalaInstance}
+ import xsbt.ScalaInstance
val definitionCompileConditional = new BuilderCompileConditional(definitionCompileConfiguration, buildCompiler, tpe)
final class BuilderCompileConditional(config: BuilderCompileConfiguration, compiler: xsbt.AnalyzingCompiler, tpe: String) extends AbstractCompileConditional(config, compiler)
diff --git a/src/main/scala/sbt/Compile.scala b/src/main/scala/sbt/Compile.scala
index ec8f44617..bf65dded7 100644
--- a/src/main/scala/sbt/Compile.scala
+++ b/src/main/scala/sbt/Compile.scala
@@ -4,7 +4,7 @@
package sbt
import java.io.File
-import xsbt.{AnalyzingCompiler, CompileFailed, CompilerArguments, ComponentManager, ScalaInstance}
+import xsbt.{AnalyzingCompiler, CompileFailed, CompilerArguments, ScalaInstance}
object CompileOrder extends Enumeration
{
diff --git a/src/main/scala/sbt/Credentials.scala b/src/main/scala/sbt/Credentials.scala
new file mode 100644
index 000000000..f258296c3
--- /dev/null
+++ b/src/main/scala/sbt/Credentials.scala
@@ -0,0 +1,44 @@
+/* sbt -- Simple Build Tool
+ * Copyright 2009 Mark Harrah
+ */
+package sbt
+
+import java.io.File
+import org.apache.ivy.util.url.CredentialsStore
+
+object Credentials
+{
+ /** Add the provided credentials to Ivy's credentials cache.*/
+ def add(realm: String, host: String, userName: String, passwd: String): Unit =
+ CredentialsStore.INSTANCE.addCredentials(realm, host, userName, passwd)
+ /** Load credentials from the given file into Ivy's credentials cache.*/
+ def apply(file: String, log: Logger): Unit = apply(Path.fromFile(file), log)
+ /** Load credentials from the given file into Ivy's credentials cache.*/
+ def apply(file: File, log: Logger): Unit = apply(Path.fromFile(file), log)
+ /** Load credentials from the given file into Ivy's credentials cache.*/
+ def apply(path: Path, log: Logger)
+ {
+ val msg =
+ if(path.exists)
+ {
+ val properties = new scala.collection.mutable.HashMap[String, String]
+ def get(keys: List[String]) = keys.flatMap(properties.get).firstOption.toRight(keys.head + " not specified in credentials file: " + path)
+
+ impl.MapUtilities.read(properties, path, log) orElse
+ {
+ List.separate( List(RealmKeys, HostKeys, UserKeys, PasswordKeys).map(get) ) match
+ {
+ case (Nil, List(realm, host, user, pass)) => add(realm, host, user, pass); None
+ case (errors, _) => Some(errors.mkString("\n"))
+ }
+ }
+ }
+ else
+ Some("Credentials file " + path + " does not exist")
+ msg.foreach(x => log.warn(x))
+ }
+ private[this] val RealmKeys = List("realm")
+ private[this] val HostKeys = List("host", "hostname")
+ private[this] val UserKeys = List("user", "user.name", "username")
+ private[this] val PasswordKeys = List("password", "pwd", "pass", "passwd")
+}
\ No newline at end of file
diff --git a/src/main/scala/sbt/Logger.scala b/src/main/scala/sbt/Logger.scala
index 86e014125..b71f4b650 100644
--- a/src/main/scala/sbt/Logger.scala
+++ b/src/main/scala/sbt/Logger.scala
@@ -18,7 +18,7 @@ object ControlEvent extends Enumeration
val Start, Header, Finish = Value
}
-abstract class Logger extends xsbt.CompileLogger with xsbt.IvyLogger
+abstract class Logger extends xsbt.CompileLogger with IvyLogger
{
def getLevel: Level.Value
def setLevel(newLevel: Level.Value)
diff --git a/src/main/scala/sbt/ManageDependencies.scala b/src/main/scala/sbt/ManageDependencies.scala
deleted file mode 100644
index adfb6f208..000000000
--- a/src/main/scala/sbt/ManageDependencies.scala
+++ /dev/null
@@ -1,651 +0,0 @@
-/* sbt -- Simple Build Tool
- * Copyright 2008, 2009 Mark Harrah
- */
-package sbt
-
-import java.io.File
-import java.net.URL
-import java.util.Collections
-import scala.collection.mutable.HashSet
-
-import Artifact.{defaultExtension, defaultType}
-
-import org.apache.ivy.{core, plugins, util, Ivy}
-import core.{IvyPatternHelper, LogOptions}
-import core.cache.DefaultRepositoryCacheManager
-import core.deliver.DeliverOptions
-import core.install.InstallOptions
-import core.module.descriptor.{DefaultArtifact, DefaultDependencyArtifactDescriptor, MDArtifact}
-import core.module.descriptor.{DefaultDependencyDescriptor, DefaultModuleDescriptor, DependencyDescriptor, ModuleDescriptor}
-import core.module.descriptor.{DefaultExcludeRule, ExcludeRule}
-import core.module.id.{ArtifactId,ModuleId, ModuleRevisionId}
-import core.publish.PublishOptions
-import core.resolve.ResolveOptions
-import core.retrieve.RetrieveOptions
-import core.settings.IvySettings
-import plugins.matcher.{ExactPatternMatcher, PatternMatcher}
-import plugins.parser.m2.{PomModuleDescriptorParser,PomModuleDescriptorWriter}
-import plugins.parser.xml.XmlModuleDescriptorParser
-import plugins.repository.{BasicResource, Resource}
-import plugins.repository.url.URLResource
-import plugins.resolver.ChainResolver
-import util.Message
-
-final class IvyScala(val scalaVersion: String, val configurations: Iterable[Configuration], val checkExplicit: Boolean, val filterImplicit: Boolean) extends NotNull
-final class IvyPaths(val projectDirectory: Path, val managedLibDirectory: Path, val cacheDirectory: Option[Path]) extends NotNull
-final class IvyFlags(val validate: Boolean, val addScalaTools: Boolean, val errorIfNoConfiguration: Boolean) extends NotNull
-final class IvyConfiguration(val paths: IvyPaths, val manager: Manager, val flags: IvyFlags, val ivyScala: Option[IvyScala], val log: Logger) extends NotNull
-final class UpdateConfiguration(val outputPattern: String, val synchronize: Boolean, val quiet: Boolean) extends NotNull
-object ScalaArtifacts
-{
- val Organization = "org.scala-lang"
- val LibraryID = "scala-library"
- val CompilerID = "scala-compiler"
-}
-object ManageDependencies
-{
- val DefaultIvyConfigFilename = "ivysettings.xml"
- val DefaultIvyFilename = "ivy.xml"
- val DefaultMavenFilename = "pom.xml"
-
- private def defaultIvyFile(project: Path) = project / DefaultIvyFilename
- private def defaultIvyConfiguration(project: File) = new File(project, DefaultIvyConfigFilename)
- private def defaultPOM(project: Path) = project / DefaultMavenFilename
-
- /** Configures Ivy using the provided configuration 'config' and calls 'doWithIvy'. This method takes care of setting up and cleaning up Ivy.*/
- private def withIvy(config: IvyConfiguration)(doWithIvy: (Ivy, ModuleDescriptor, String) => Option[String]) =
- withIvyValue(config)( (ivy, module, default) => doWithIvy(ivy, module, default).toLeft(()) ).left.toOption
- /** Configures Ivy using the provided configuration 'config' and calls 'doWithIvy'. This method takes care of setting up and cleaning up Ivy.*/
- private def withIvyValue[T](config: IvyConfiguration)(doWithIvy: (Ivy, ModuleDescriptor, String) => Either[String, T]) =
- {
- import config._
- log.debug("\nwithIvyValue...\n")
- val logger = new IvyLogger(log)
- val originalLogger = Message.getDefaultLogger
- Message.setDefaultLogger(logger)
- log.debug("\nSet default logger...\n")
- val settings = new IvySettings
- settings.setBaseDir(paths.projectDirectory.asFile)
- log.debug("\nCreated settings...\n")
-
- /** Parses the given Maven pom 'pomFile'.*/
- def readPom(pomFile: File) =
- Control.trap("Could not read pom: ", log)
- { Right((PomModuleDescriptorParser.getInstance.parseDescriptor(settings, toURL(pomFile), flags.validate)), "compile") }
- /** Parses the given Ivy file 'ivyFile'.*/
- def readIvyFile(ivyFile: File) =
- Control.trap("Could not read Ivy file: ", log)
- {
- val url = toURL(ivyFile)
- val parser = new CustomXmlParser.CustomParser(settings, None)
- parser.setValidate(flags.validate)
- parser.setSource(url)
- parser.parse()
- Right((parser.getModuleDescriptor(), parser.getDefaultConf))
- }
- /** Parses the given in-memory Ivy file 'xml', using the existing 'moduleID' and specifying the given 'defaultConfiguration'. */
- def parseXMLDependencies(xml: scala.xml.NodeSeq, moduleID: DefaultModuleDescriptor, defaultConfiguration: String) =
- parseDependencies(xml.toString, moduleID, defaultConfiguration)
- /** Parses the given in-memory Ivy file 'xml', using the existing 'moduleID' and specifying the given 'defaultConfiguration'. */
- def parseDependencies(xml: String, moduleID: DefaultModuleDescriptor, defaultConfiguration: String): Either[String, CustomXmlParser.CustomParser] =
- Control.trap("Could not read dependencies: ", log)
- {
- val parser = new CustomXmlParser.CustomParser(settings, Some(defaultConfiguration))
- parser.setMd(moduleID)
- parser.setValidate(flags.validate)
- val resource = new ByteResource(xml.getBytes)
- parser.setInput(resource.openStream)
- parser.setResource(resource)
- parser.parse()
- Right(parser)
- }
- /** Configures Ivy using the specified Ivy configuration file. This method is used when the manager is explicitly requested to be MavenManager or
- * IvyManager. If a file is not specified, Ivy is configured with defaults.*/
- def configure(configFile: Option[Path])
- {
- configFile match
- {
- case Some(path) => settings.load(path.asFile)
- case None => configureDefaults(defaultResolvers)
- }
- }
- def defaultResolvers: Seq[Resolver] = withDefaultResolvers(Nil)
- def withDefaultResolvers(user: Seq[Resolver]): Seq[Resolver] =
- Seq(Resolver.defaultLocal) ++
- user ++
- Seq(DefaultMavenRepository) ++
- (if(flags.addScalaTools) Seq(ScalaToolsReleases) else Nil)
-
- /** Configures Ivy using defaults. This is done when no ivy-settings.xml exists. */
- def configureDefaults(resolvers: Seq[Resolver])
- {
- configureCache(settings, paths.cacheDirectory)
- setResolvers(settings, resolvers, log)
- }
- /** Called to configure Ivy when the configured dependency manager is SbtManager and inline configuration is specified or if the manager
- * is AutodetectManager. It will configure Ivy with an 'ivy-settings.xml' file if there is one, or configure the defaults and add scala-tools as
- * a repository otherwise.*/
- def autodetectConfiguration()
- {
- log.debug("Autodetecting configuration.")
- def autodetect(dir: File): Boolean =
- (dir != null) &&
- {
- val defaultIvyConfigFile = defaultIvyConfiguration(dir)
- if(defaultIvyConfigFile.canRead)
- {
- settings.load(defaultIvyConfigFile)
- true
- }
- else
- autodetect(dir.getParentFile)
- }
- if(!autodetect(paths.projectDirectory.asFile))
- configureDefaults(defaultResolvers)
- }
- /** Called to determine dependencies when the dependency manager is SbtManager and no inline dependencies (Scala or XML) are defined
- * or if the manager is AutodetectManager. It will try to read from pom.xml first and then ivy.xml if pom.xml is not found. If neither is found,
- * Ivy is configured with defaults unless IvyFlags.errorIfNoConfiguration is true, in which case an error is generated.*/
- def autodetectDependencies(module: ModuleRevisionId, defaultArtifact: Boolean) =
- {
- log.debug("Autodetecting dependencies.")
- val defaultPOMFile = defaultPOM(paths.projectDirectory).asFile
- if(defaultPOMFile.canRead)
- readPom(defaultPOMFile)
- else
- {
- val defaultIvy = defaultIvyFile(paths.projectDirectory).asFile
- if(defaultIvy.canRead)
- readIvyFile(defaultIvy)
- else if(flags.errorIfNoConfiguration)
- Left("No readable dependency configuration found. Need " + DefaultIvyFilename + " or " + DefaultMavenFilename)
- else
- {
- val defaultConf = ModuleDescriptor.DEFAULT_CONFIGURATION
- log.warn("No readable dependency configuration found, using defaults.")
- val moduleID = new DefaultModuleDescriptor(module, "release", null, false)
- moduleID.setLastModified(System.currentTimeMillis)
- moduleID.addConfiguration(toIvyConfiguration(Configurations.Default))
- addMainArtifact(moduleID)
- if(defaultArtifact)
- addDefaultArtifact(defaultConf, moduleID)
- Right((moduleID, defaultConf))
- }
- }
- }
- /** Creates an Ivy module descriptor according the manager configured. The default configuration for dependencies
- * is also returned.*/
- def moduleDescriptor: Either[String, (ModuleDescriptor, String)] =
- config.manager match
- {
- case mm: MavenManager =>
- {
- log.debug("Maven configuration explicitly requested.")
- configure(mm.configuration)
- readPom(mm.pom.asFile)
- }
- case im: IvyManager =>
- {
- log.debug("Ivy configuration explicitly requested.")
- configure(im.configuration)
- readIvyFile(im.dependencies.asFile)
- }
- case adm: AutoDetectManager =>
- {
- log.debug("No dependency manager explicitly specified.")
- autodetectConfiguration()
- autodetectDependencies(toID(adm.module), adm.defaultArtifact)
- }
- case sm: SbtManager =>
- {
- import sm._
- if(resolvers.isEmpty && moduleConfigurations.isEmpty && autodetectUnspecified)
- autodetectConfiguration()
- else
- {
- log.debug("Using inline repositories.")
- configureDefaults(withDefaultResolvers(resolvers))
- setModuleConfigurations(settings, moduleConfigurations)
- }
- if(autodetect)
- autodetectDependencies(toID(module), true)
- else
- {
- val moduleID =
- {
- val mod = new DefaultModuleDescriptor(toID(module), "release", null, false)
- mod.setLastModified(System.currentTimeMillis)
- configurations.foreach(config => mod.addConfiguration(toIvyConfiguration(config)))
- mod
- }
- val defaultConf = defaultConfiguration getOrElse Configurations.config(ModuleDescriptor.DEFAULT_CONFIGURATION)
- log.debug("Using inline dependencies specified in Scala" + (if(dependenciesXML.isEmpty) "." else " and XML."))
- for(parser <- parseXMLDependencies(wrapped(module, dependenciesXML), moduleID, defaultConf.name).right) yield
- {
- addArtifacts(moduleID, module.explicitArtifacts)
- addDependencies(moduleID, dependencies, parser)
- addMainArtifact(moduleID)
- (moduleID, parser.getDefaultConf)
- }
- }
- }
- }
- /** Creates a full ivy file for 'module' using the 'dependencies' XML as the part after the <info>...</info> section. */
- def wrapped(module: ModuleID, dependencies: scala.xml.NodeSeq) =
- {
- import module._
-
- { if(hasInfo(dependencies))
- scala.xml.NodeSeq.Empty
- else
-
- }
- {dependencies}
-
- }
- def hasInfo(x: scala.xml.NodeSeq) = !({x} \ "info").isEmpty
- /** Performs checks/adds filters on Scala dependencies (if enabled in IvyScala). */
- def checkModule(moduleAndConf: (ModuleDescriptor, String)): Either[String, (ModuleDescriptor, String)] =
- ivyScala match
- {
- case Some(check) =>
- val (module, conf) = moduleAndConf
- val explicitCheck =
- if(check.checkExplicit)
- {
- log.debug("Checking explicit Scala dependencies")
- checkDependencies(module, check.scalaVersion, check.configurations)
- }
- else
- None
- explicitCheck match
- {
- case None =>
- if(check.filterImplicit)
- {
- log.debug("Filtering transitive Scala dependencies")
- val asDefault = toDefaultModuleDescriptor(module)
- excludeScalaJars(asDefault, check.configurations, config.log)
- Right( (asDefault, conf) )
- }
- else
- Right(moduleAndConf)
- case Some(err) => Left(err)
- }
- case None =>
- log.debug("Not checking Scala dependencies")
- Right(moduleAndConf)
- }
-
- this.synchronized // Ivy is not thread-safe. In particular, it uses a static DocumentBuilder, which is not thread-safe
- {
- val ivy = Ivy.newInstance(settings)
- ivy.getLoggerEngine.pushLogger(logger)
- ivy.pushContext()
- try
- {
- moduleDescriptor.right.flatMap(checkModule).right.flatMap { case (md, conf) =>
- addExtraNamespaces(toDefaultModuleDescriptor(md))
- doWithIvy(ivy, md, conf)
- }
- }
- finally
- {
- ivy.popContext()
- Message.setDefaultLogger(originalLogger)
- }
- }
- }
- private def addExtraNamespaces(md: DefaultModuleDescriptor): Unit =
- md.getExtraAttributesNamespaces.asInstanceOf[java.util.Map[String,String]].put("e", "http://ant.apache.org/ivy/extra")
- /** Checks the immediate dependencies of module for dependencies on scala jars and verifies that the version on the
- * dependencies matches scalaVersion. */
- private def checkDependencies(module: ModuleDescriptor, scalaVersion: String, configurations: Iterable[Configuration]): Option[String] =
- {
- val configSet = configurationSet(configurations)
- Control.lazyFold(module.getDependencies.toList)
- { dep =>
- val id = dep.getDependencyRevisionId
- if(id.getOrganisation == ScalaArtifacts.Organization && id.getRevision != scalaVersion && dep.getModuleConfigurations.exists(configSet.contains))
- Some("Different Scala version specified in dependency ("+ id.getRevision + ") than in project (" + scalaVersion + ").")
- else
- None
- }
- }
- private def configurationSet(configurations: Iterable[Configuration]) =
- HashSet(configurations.map(_.toString).toSeq : _*)
- /** Adds exclusions for the scala library and compiler jars so that they are not downloaded. This is
- * done because normally these jars are already on the classpath and cannot/should not be overridden. The version
- * of Scala to use is done by setting scala.version in the project definition. */
- private def excludeScalaJars(module: DefaultModuleDescriptor, configurations: Iterable[Configuration], log: Logger)
- {
- val configurationNames =
- {
- val names = module.getConfigurationsNames
- if(configurations.isEmpty)
- names
- else
- {
- import scala.collection.mutable.HashSet
- val configSet = configurationSet(configurations)
- configSet.intersect(HashSet(names : _*))
- configSet.toArray
- }
- }
- def excludeScalaJar(name: String): Unit =
- module.addExcludeRule(excludeRule(ScalaArtifacts.Organization, name, configurationNames, log))
- excludeScalaJar(ScalaArtifacts.LibraryID)
- excludeScalaJar(ScalaArtifacts.CompilerID)
- }
- private def configureCache(settings: IvySettings, dir: Option[Path])
- {
- val cacheDir = dir.map(_.asFile).getOrElse(settings.getDefaultRepositoryCacheBasedir())
- val manager = new DefaultRepositoryCacheManager("default-cache", settings, cacheDir)
- manager.setUseOrigin(true)
- manager.setChangingMatcher(PatternMatcher.REGEXP);
- manager.setChangingPattern(".*-SNAPSHOT");
- settings.setDefaultRepositoryCacheManager(manager)
- dir.foreach(dir => settings.setDefaultResolutionCacheBasedir(dir.absolutePath))
- }
- /** Creates an ExcludeRule that excludes artifacts with the given module organization and name for
- * the given configurations. */
- private def excludeRule(organization: String, name: String, configurationNames: Iterable[String], log: Logger): ExcludeRule =
- {
- val artifact = new ArtifactId(ModuleId.newInstance(organization, name), "*", "*", "*")
- log.debug("Excluding " + artifact + " in " + configurationNames.mkString(", "))
- val rule = new DefaultExcludeRule(artifact, ExactPatternMatcher.INSTANCE, Collections.emptyMap[AnyRef,AnyRef])
- configurationNames.foreach(rule.addConfiguration)
- rule
- }
- /** Clears the Ivy cache, as configured by 'config'. */
- def cleanCache(config: IvyConfiguration) =
- {
- def doClean(ivy: Ivy, module: ModuleDescriptor, default: String) =
- Control.trapUnit("Could not clean cache: ", config.log)
- { ivy.getSettings.getRepositoryCacheManagers.foreach(_.clean()); None }
-
- withIvy(config)(doClean)
- }
- /** Creates a Maven pom from the given Ivy configuration*/
- def makePom(config: IvyConfiguration, extraDependencies: Iterable[ModuleID], configurations: Option[Iterable[Configuration]], output: File) =
- {
- def doMakePom(ivy: Ivy, md: ModuleDescriptor, default: String) =
- Control.trapUnit("Could not make pom: ", config.log)
- {
- val module = addLateDependencies(ivy, md, default, extraDependencies)
- val pomModule = keepConfigurations(module, configurations)
- PomModuleDescriptorWriter.write(pomModule, DefaultConfigurationMapping, output)
- config.log.info("Wrote " + output.getAbsolutePath)
- None
- }
- withIvy(config)(doMakePom)
- }
- private def addDefaultArtifact(defaultConf: String, moduleID: DefaultModuleDescriptor) =
- moduleID.addArtifact(defaultConf, new MDArtifact(moduleID, moduleID.getModuleRevisionId.getName, defaultType, defaultExtension))
- // todo: correct default configuration for extra dependencies
- private def addLateDependencies(ivy: Ivy, md: ModuleDescriptor, defaultConfiguration: String, extraDependencies: Iterable[ModuleID]) =
- {
- val module = toDefaultModuleDescriptor(md)
- val parser = new CustomXmlParser.CustomParser(ivy.getSettings, Some(defaultConfiguration))
- parser.setMd(module)
- addDependencies(module, extraDependencies, parser)
- module
- }
- private def getConfigurations(module: ModuleDescriptor, configurations: Option[Iterable[Configuration]]) =
- configurations match
- {
- case Some(confs) => confs.map(_.name).toList.toArray
- case None => module.getPublicConfigurationsNames
- }
- /** Retain dependencies only with the configurations given, or all public configurations of `module` if `configurations` is None.
- * This is currently only preserves the information required by makePom*/
- private def keepConfigurations(module: ModuleDescriptor, configurations: Option[Iterable[Configuration]]): ModuleDescriptor =
- {
- val keepConfigurations = getConfigurations(module, configurations)
- val keepSet = Set(keepConfigurations.toSeq : _*)
- def translate(dependency: DependencyDescriptor) =
- {
- val keep = dependency.getModuleConfigurations.filter(keepSet.contains)
- if(keep.isEmpty)
- None
- else // TODO: translate the dependency to contain only configurations to keep
- Some(dependency)
- }
- val newModule = new DefaultModuleDescriptor(module.getModuleRevisionId, "", null)
- newModule.setHomePage(module.getHomePage)
- for(dependency <- module.getDependencies; translated <- translate(dependency))
- newModule.addDependency(translated)
- newModule
- }
- def install(ivyConfig: IvyConfiguration, from: String, to: String, validate: Boolean, overwrite: Boolean) =
- {
- def doInstall(ivy: Ivy, md: ModuleDescriptor, default: String) =
- Control.trapUnit("Could not install: ", ivyConfig.log)
- {
- for(dependency <- md.getDependencies)
- {
- ivyConfig.log.info("Installing " + dependency)
- val options = new InstallOptions
- options.setOverwrite(overwrite)
- options.setValidate(validate)
- options.setTransitive(dependency.isTransitive)
- ivy.install(dependency.getDependencyRevisionId, from, to, options)
- }
- None
- }
- withIvy(ivyConfig)(doInstall)
- }
- def deliver(ivyConfig: IvyConfiguration, updateConfig: UpdateConfiguration, status: String, deliverIvyPattern: String, extraDependencies: Iterable[ModuleID], configurations: Option[Iterable[Configuration]]) =
- {
- def doDeliver(ivy: Ivy, md: ModuleDescriptor, default: String) =
- Control.trapUnit("Could not deliver: ", ivyConfig.log)
- {
- val module = addLateDependencies(ivy, md, default, extraDependencies)
- resolve(ivy, updateConfig, module) orElse // todo: set download = false for resolve
- {
- val revID = module.getModuleRevisionId
- val options = DeliverOptions.newInstance(ivy.getSettings).setStatus(status)
- options.setConfs(getConfigurations(module, configurations))
-
- ivy.deliver(revID, revID.getRevision, deliverIvyPattern, options)
- None
- }
- }
- withIvy(ivyConfig)(doDeliver)
- }
- // todo: map configurations, extra dependencies
- def publish(ivyConfig: IvyConfiguration, resolverName: String, srcArtifactPatterns: Iterable[String], deliveredIvyPattern: Option[String], configurations: Option[Iterable[Configuration]]) =
- {
- def doPublish(ivy: Ivy, md: ModuleDescriptor, default: String) =
- Control.trapUnit("Could not publish: ", ivyConfig.log)
- {
- val revID = md.getModuleRevisionId
- val patterns = new java.util.ArrayList[String]
- srcArtifactPatterns.foreach(pattern => patterns.add(pattern))
- val options = (new PublishOptions).setOverwrite(true)
- deliveredIvyPattern.foreach(options.setSrcIvyPattern)
- options.setConfs(getConfigurations(md, configurations))
- ivy.publish(revID, patterns, resolverName, options)
- None
- }
- withIvy(ivyConfig)(doPublish)
- }
- /** Resolves and retrieves dependencies. 'ivyConfig' is used to produce an Ivy file and configuration.
- * 'updateConfig' configures the actual resolution and retrieval process. */
- def update(ivyConfig: IvyConfiguration, updateConfig: UpdateConfiguration) =
- {
- def processModule(ivy: Ivy, module: ModuleDescriptor, default: String) =
- {
- import updateConfig._
- Control.trapUnit("Could not process dependencies: ", ivyConfig.log)
- {
- resolve(ivy, updateConfig, module) orElse
- {
- val retrieveOptions = new RetrieveOptions
- retrieveOptions.setSync(synchronize)
- val patternBase = ivyConfig.paths.managedLibDirectory.absolutePath
- val pattern =
- if(patternBase.endsWith(File.separator))
- patternBase + outputPattern
- else
- patternBase + File.separatorChar + outputPattern
- ivy.retrieve(module.getModuleRevisionId, pattern, retrieveOptions)
- None
- }
- }
- }
-
- withIvy(ivyConfig)(processModule)
- }
- private def resolve(ivy: Ivy, updateConfig: UpdateConfiguration, module: ModuleDescriptor) =
- {
- import updateConfig._
- val resolveOptions = new ResolveOptions
- if(quiet)
- resolveOptions.setLog(LogOptions.LOG_DOWNLOAD_ONLY)
- val resolveReport = ivy.resolve(module, resolveOptions)
- if(resolveReport.hasError)
- Some(Set(resolveReport.getAllProblemMessages.toArray: _*).mkString(System.getProperty("line.separator")))
- else
- None
- }
- /** This method is used to add inline dependencies to the provided module. */
- private def addDependencies(moduleID: DefaultModuleDescriptor, dependencies: Iterable[ModuleID], parser: CustomXmlParser.CustomParser)
- {
- for(dependency <- dependencies)
- {
- val dependencyDescriptor = new DefaultDependencyDescriptor(moduleID, toID(dependency), false, dependency.isChanging, dependency.isTransitive)
- dependency.configurations match
- {
- case None => // The configuration for this dependency was not explicitly specified, so use the default
- parser.parseDepsConfs(parser.getDefaultConf, dependencyDescriptor)
- case Some(confs) => // The configuration mapping (looks like: test->default) was specified for this dependency
- parser.parseDepsConfs(confs, dependencyDescriptor)
- }
- for(artifact <- dependency.explicitArtifacts)
- {
- import artifact.{name, classifier, `type`, extension, url}
- val extraMap = extra(artifact)
- val ivyArtifact = new DefaultDependencyArtifactDescriptor(dependencyDescriptor, name, `type`, extension, url.getOrElse(null), extraMap)
- for(conf <- dependencyDescriptor.getModuleConfigurations)
- dependencyDescriptor.addDependencyArtifact(conf, ivyArtifact)
- }
- moduleID.addDependency(dependencyDescriptor)
- }
- }
- private def addArtifacts(moduleID: DefaultModuleDescriptor, artifacts: Iterable[Artifact])
- {
- val allConfigurations = moduleID.getPublicConfigurationsNames.toSeq
- for(artifact <- artifacts)
- {
- val configurationStrings =
- {
- val artifactConfigurations = artifact.configurations
- if(artifactConfigurations.isEmpty)
- allConfigurations
- else
- artifactConfigurations.map(_.name)
- }
- val ivyArtifact = toIvyArtifact(moduleID, artifact, configurationStrings)
- configurationStrings.foreach(configuration => moduleID.addArtifact(configuration, ivyArtifact))
- }
- }
- private def extra(artifact: Artifact) =
- {
- val ea = artifact.classifier match { case Some(c) => artifact.extra("e:classifier" -> c); case None => artifact }
- javaMap(ea.extraAttributes)
- }
- private def javaMap(map: Map[String,String]) = if(map.isEmpty) null else wrap.Wrappers.javaMap(map.toSeq : _*)
- private def toURL(file: File) = file.toURI.toURL
- /** Adds the ivy.xml main artifact. */
- private def addMainArtifact(moduleID: DefaultModuleDescriptor)
- {
- val artifact = DefaultArtifact.newIvyArtifact(moduleID.getResolvedModuleRevisionId, moduleID.getPublicationDate)
- moduleID.setModuleArtifact(artifact)
- moduleID.check()
- }
- private def setModuleConfigurations(settings: IvySettings, moduleConfigurations: Seq[ModuleConfiguration])
- {
- val existing = settings.getResolverNames
- for(moduleConf <- moduleConfigurations)
- {
- import moduleConf._
- import IvyPatternHelper._
- import PatternMatcher._
- if(!existing.contains(resolver.name))
- settings.addResolver(ConvertResolver(resolver))
- val attributes = javaMap(Map(MODULE_KEY -> name, ORGANISATION_KEY -> organization, REVISION_KEY -> revision))
- settings.addModuleConfiguration(attributes, settings.getMatcher(EXACT_OR_REGEXP), resolver.name, null, null, null)
- }
- }
- /** Sets the resolvers for 'settings' to 'resolvers'. This is done by creating a new chain and making it the default. */
- private def setResolvers(settings: IvySettings, resolvers: Seq[Resolver], log: Logger)
- {
- val newDefault = new ChainResolver
- newDefault.setName("sbt-chain")
- newDefault.setReturnFirst(true)
- newDefault.setCheckmodified(true)
- resolvers.foreach(r => newDefault.add(ConvertResolver(r)))
- settings.addResolver(newDefault)
- settings.setDefaultResolver(newDefault.getName)
- if(log.atLevel(Level.Debug))
- {
- log.debug("Using repositories:")
- resolvers.foreach(r => log.debug("\t" + r.toString))
- }
- }
- private def toIvyConfiguration(configuration: Configuration) =
- {
- import org.apache.ivy.core.module.descriptor.{Configuration => IvyConfig}
- import IvyConfig.Visibility._
- import configuration._
- new IvyConfig(name, if(isPublic) PUBLIC else PRIVATE, description, extendsConfigs.map(_.name).toArray, transitive, null)
- }
- /** Converts the given sbt module id into an Ivy ModuleRevisionId.*/
- private def toID(m: ModuleID) =
- {
- import m._
- ModuleRevisionId.newInstance(organization, name, revision, javaMap(extraAttributes))
- }
- private def toIvyArtifact(moduleID: ModuleDescriptor, a: Artifact, configurations: Iterable[String]): MDArtifact =
- {
- val artifact = new MDArtifact(moduleID, a.name, a.`type`, a.extension, null, extra(a))
- configurations.foreach(artifact.addConfiguration)
- artifact
- }
- /** An implementation of Ivy's Resource class that provides the Ivy file from a byte array. This is used to support
- * inline Ivy file XML.*/
- private class ByteResource(bytes: Array[Byte]) extends
- BasicResource("Inline XML dependencies", true, bytes.length, System.currentTimeMillis, true)
- {
- override def openStream = new java.io.ByteArrayInputStream(bytes)
- }
- /** Subclasses the default Ivy file parser in order to provide access to protected methods.*/
- private object CustomXmlParser extends XmlModuleDescriptorParser with NotNull
- {
- import XmlModuleDescriptorParser.Parser
- class CustomParser(settings: IvySettings, defaultConfig: Option[String]) extends Parser(CustomXmlParser, settings) with NotNull
- {
- if(defaultConfig.isDefined) setDefaultConfMapping("*->default(compile)")
-
- def setSource(url: URL) =
- {
- super.setResource(new URLResource(url))
- super.setInput(url)
- }
- /** Overridden because the super implementation overwrites the module descriptor.*/
- override def setResource(res: Resource) {}
- override def setMd(md: DefaultModuleDescriptor) = super.setMd(md)
- override def parseDepsConfs(confs: String, dd: DefaultDependencyDescriptor): Unit = super.parseDepsConfs(confs, dd)
- override def getDefaultConf = defaultConfig.getOrElse(super.getDefaultConf)
- }
- }
- /** This code converts the given ModuleDescriptor to a DefaultModuleDescriptor by casting or generating an error.
- * Ivy always produces a DefaultModuleDescriptor, so this should be reasonable. */
- private def toDefaultModuleDescriptor(md: ModuleDescriptor) =
- md match
- {
- case dmd: DefaultModuleDescriptor => dmd
- case _ => error("Unknown ModuleDescriptor type.")
- }
-}
diff --git a/src/main/scala/sbt/ManagedInterface.scala b/src/main/scala/sbt/ManagedInterface.scala
deleted file mode 100644
index 0274f59da..000000000
--- a/src/main/scala/sbt/ManagedInterface.scala
+++ /dev/null
@@ -1,426 +0,0 @@
-/* sbt -- Simple Build Tool
- * Copyright 2008, 2009 Mark Harrah
- */
-package sbt
-
-import java.io.File
-import java.net.{URI, URL}
-import scala.xml.NodeSeq
-import org.apache.ivy.plugins.resolver.IBiblioResolver
-import org.apache.ivy.util.url.CredentialsStore
-
-sealed abstract class Manager extends NotNull
-/** This explicitly requests auto detection as a dependency manager. It will first check for a 'pom.xml' file and if that does not exist, an 'ivy.xml' file.
-* Ivy is configured using the detected file or uses defaults.*/
-final class AutoDetectManager(val module: ModuleID, val defaultArtifact: Boolean) extends Manager
-{
- def this(module: ModuleID) = this(module, true)
-}
-/** This explicitly requests that the Maven pom 'pom' be used to determine dependencies. An Ivy configuration file to use may be specified in
-* 'configuration', since Ivy currently cannot extract Maven repositories from a pom file. Otherwise, defaults are used.*/
-final class MavenManager(val configuration: Option[Path], val pom: Path) extends Manager
-/** This explicitly requests that the Ivy file 'dependencies' be used to determine dependencies. An Ivy configuration file to use may be specified in
-* 'configuration'. Otherwise, defaults are used.*/
-final class IvyManager(val configuration: Option[Path], val dependencies: Path) extends Manager
-/** This manager directly specifies the dependencies, resolvers, and configurations through sbt wrapper classes and through an in-memory
-* Ivy XML file. */
-sealed trait SbtManager extends Manager
-{
- def autodetect: Boolean
- def module: ModuleID
- def resolvers: Seq[Resolver]
- def moduleConfigurations: Seq[ModuleConfiguration]
- def dependencies: Iterable[ModuleID]
- def autodetectUnspecified: Boolean
- def dependenciesXML: NodeSeq
- def configurations: Iterable[Configuration]
- def defaultConfiguration: Option[Configuration]
-}
-final class SimpleManager private[sbt] (val dependenciesXML: NodeSeq, val autodetectUnspecified: Boolean,
- val module: ModuleID, val resolvers: Seq[Resolver], val moduleConfigurations: Seq[ModuleConfiguration],
- explicitConfigurations: Iterable[Configuration], val defaultConfiguration: Option[Configuration],
- val dependencies: ModuleID*) extends SbtManager
-{
- def autodetect = dependencies.isEmpty && dependenciesXML.isEmpty && module.explicitArtifacts.isEmpty && explicitConfigurations.isEmpty && autodetectUnspecified
- def configurations =
- if(explicitConfigurations.isEmpty && !autodetect)
- {
- defaultConfiguration match
- {
- case Some(Configurations.DefaultIvyConfiguration) => Configurations.Default :: Nil
- case Some(Configurations.DefaultMavenConfiguration) => Configurations.defaultMavenConfigurations
- case _ => Nil
- }
- }
- else
- explicitConfigurations
-}
-final case class ModuleConfiguration(organization: String, name: String, revision: String, resolver: Resolver) extends NotNull
-object ModuleConfiguration
-{
- def apply(org: String, resolver: Resolver): ModuleConfiguration = apply(org, "*", "*", resolver)
- def apply(org: String, name: String, resolver: Resolver): ModuleConfiguration = ModuleConfiguration(org, name, "*", resolver)
-}
-final case class ModuleID(organization: String, name: String, revision: String, configurations: Option[String], isChanging: Boolean, isTransitive: Boolean, explicitArtifacts: Seq[Artifact], extraAttributes: Map[String,String]) extends NotNull
-{
- override def toString = organization + ":" + name + ":" + revision
- // () required for chaining
- def notTransitive() = intransitive()
- def intransitive() = ModuleID(organization, name, revision, configurations, isChanging, false, explicitArtifacts, extraAttributes)
- def changing() = ModuleID(organization, name, revision, configurations, true, isTransitive, explicitArtifacts, extraAttributes)
- def from(url: String) = artifacts(Artifact(name, new URL(url)))
- def classifier(c: String) = artifacts(Artifact(name, c))
- def artifacts(newArtifacts: Artifact*) = ModuleID(organization, name, revision, configurations, isChanging, isTransitive, newArtifacts ++ explicitArtifacts, extraAttributes)
- def extra(attributes: (String,String)*) = ModuleID(organization, name, revision, configurations, isChanging, isTransitive, explicitArtifacts, extraAttributes ++ ModuleID.checkE(attributes))
- def sources() = artifacts(Artifact(name, "sources", "jar", "sources"))
- def javadoc() = artifacts(Artifact(name, "javadoc", "jar", "javadoc"))
- def withSources() = jarIfEmpty.sources()
- def withJavadoc() = jarIfEmpty.javadoc()
- private def jarIfEmpty = if(explicitArtifacts.isEmpty) jar() else this
- def jar() = artifacts(Artifact(name, "jar", "jar"))
-}
-object ModuleID
-{
- def apply(organization: String, name: String, revision: String): ModuleID = ModuleID(organization, name, revision, None)
- def apply(organization: String, name: String, revision: String, configurations: Option[String]): ModuleID =
- ModuleID(organization, name, revision, configurations, false, true)
- def apply(organization: String, name: String, revision: String, configurations: Option[String], isChanging: Boolean, isTransitive: Boolean): ModuleID =
- ModuleID(organization, name, revision, configurations, isChanging, isTransitive, Nil)
- def apply(organization: String, name: String, revision: String, configurations: Option[String], isChanging: Boolean, isTransitive: Boolean, explicitArtifacts: Seq[Artifact]): ModuleID =
- ModuleID(organization, name, revision, configurations, isChanging, isTransitive, explicitArtifacts, Map.empty)
-
- def checkE(attributes: Seq[(String, String)]) =
- for ( (key, value) <- attributes) yield
- if(key.startsWith("e:")) (key, value) else ("e:" + key, value)
-}
-sealed trait Resolver extends NotNull
-{
- def name: String
-}
-sealed case class MavenRepository(name: String, root: String) extends Resolver
-{
- override def toString = name + ": " + root
-}
-
-final class Patterns(val ivyPatterns: Seq[String], val artifactPatterns: Seq[String], val isMavenCompatible: Boolean) extends NotNull
-{
- private[sbt] def mavenStyle(): Patterns = Patterns(ivyPatterns, artifactPatterns, true)
- private[sbt] def withIvys(patterns: Seq[String]): Patterns = Patterns(patterns ++ ivyPatterns, artifactPatterns, isMavenCompatible)
- private[sbt] def withArtifacts(patterns: Seq[String]): Patterns = Patterns(ivyPatterns, patterns ++ artifactPatterns, isMavenCompatible)
-}
-object Patterns
-{
- def apply(artifactPatterns: String*): Patterns = Patterns(true, artifactPatterns : _*)
- def apply(isMavenCompatible: Boolean, artifactPatterns: String*): Patterns = Patterns(Nil, artifactPatterns, isMavenCompatible)
- def apply(ivyPatterns: Seq[String], artifactPatterns: Seq[String], isMavenCompatible: Boolean): Patterns = new Patterns(ivyPatterns, artifactPatterns, isMavenCompatible)
-}
-object RepositoryHelpers
-{
- final case class SshConnection(authentication: Option[SshAuthentication], hostname: Option[String], port: Option[Int]) extends NotNull
- {
- def copy(authentication: Option[SshAuthentication]) = SshConnection(authentication, hostname, port)
- }
- /** Configuration specific to an Ivy filesystem resolver. */
- final case class FileConfiguration(isLocal: Boolean, isTransactional: Option[Boolean]) extends NotNull
- {
- def transactional() = FileConfiguration(isLocal, Some(true))
- def nontransactional() = FileConfiguration(isLocal, Some(false))
- def nonlocal() = FileConfiguration(false, isTransactional)
- }
- sealed trait SshAuthentication extends NotNull
- final case class PasswordAuthentication(user: String, password: String) extends SshAuthentication
- final case class KeyFileAuthentication(keyfile: File, password: String) extends SshAuthentication
-}
-import RepositoryHelpers.{SshConnection, FileConfiguration}
-import RepositoryHelpers.{KeyFileAuthentication, PasswordAuthentication, SshAuthentication}
-
-/** sbt interface to an Ivy repository based on patterns, which is most Ivy repositories.*/
-sealed abstract class PatternsBasedRepository extends Resolver
-{
- type RepositoryType <: PatternsBasedRepository
- /** Should be implemented to create a new copy of this repository but with `patterns` as given.*/
- protected def copy(patterns: Patterns): RepositoryType
-
- /** The object representing the configured patterns for this repository. */
- def patterns: Patterns
-
- /** Enables maven 2 compatibility for this repository. */
- def mavenStyle() = copy(patterns.mavenStyle())
- /** Adds the given patterns for resolving/publishing Ivy files.*/
- def ivys(ivyPatterns: String*): RepositoryType = copy(patterns.withIvys(ivyPatterns))
- /** Adds the given patterns for resolving/publishing artifacts.*/
- def artifacts(artifactPatterns: String*): RepositoryType = copy(patterns.withArtifacts(artifactPatterns))
-}
-/** sbt interface for an Ivy filesystem repository. More convenient construction is done using Resolver.file. */
-final case class FileRepository(name: String, configuration: FileConfiguration, patterns: Patterns) extends PatternsBasedRepository
-{
- type RepositoryType = FileRepository
- protected def copy(patterns: Patterns): FileRepository = FileRepository(name, configuration, patterns)
- private def copy(configuration: FileConfiguration) = FileRepository(name, configuration, patterns)
- def transactional() = copy(configuration.transactional())
- def nonlocal() = copy(configuration.nonlocal())
-}
-final case class URLRepository(name: String, patterns: Patterns) extends PatternsBasedRepository
-{
- type RepositoryType = URLRepository
- protected def copy(patterns: Patterns): URLRepository = URLRepository(name, patterns)
-}
-/** sbt interface for an Ivy ssh-based repository (ssh and sftp). Requires the Jsch library.. */
-sealed abstract class SshBasedRepository extends PatternsBasedRepository
-{
- type RepositoryType <: SshBasedRepository
- protected def copy(connection: SshConnection): RepositoryType
- private def copy(authentication: SshAuthentication): RepositoryType = copy(connection.copy(Some(authentication)))
-
- /** The object representing the configured ssh connection for this repository. */
- def connection: SshConnection
-
- /** Configures this to use the specified user name and password when connecting to the remote repository. */
- def as(user: String, password: String): RepositoryType = copy(new PasswordAuthentication(user, password))
- /** Configures this to use the specified keyfile and password for the keyfile when connecting to the remote repository. */
- def as(keyfile: File, password: String): RepositoryType = copy(new KeyFileAuthentication(keyfile, password))
-}
-/** sbt interface for an Ivy repository over ssh. More convenient construction is done using Resolver.ssh. */
-final case class SshRepository(name: String, connection: SshConnection, patterns: Patterns, publishPermissions: Option[String]) extends SshBasedRepository
-{
- type RepositoryType = SshRepository
- protected def copy(patterns: Patterns): SshRepository = SshRepository(name, connection, patterns, publishPermissions)
- protected def copy(connection: SshConnection): SshRepository = SshRepository(name, connection, patterns, publishPermissions)
- /** Defines the permissions to set when publishing to this repository. */
- def withPermissions(publishPermissions: String): SshRepository = withPermissions(Some(publishPermissions))
- def withPermissions(publishPermissions: Option[String]): SshRepository = SshRepository(name, connection, patterns, publishPermissions)
-}
-/** sbt interface for an Ivy repository over sftp. More convenient construction is done using Resolver.sftp. */
-final case class SftpRepository(name: String, connection: SshConnection, patterns: Patterns) extends SshBasedRepository
-{
- type RepositoryType = SftpRepository
- protected def copy(patterns: Patterns): SftpRepository = SftpRepository(name, connection, patterns)
- protected def copy(connection: SshConnection): SftpRepository = SftpRepository(name, connection, patterns)
-}
-
-import Resolver._
-object ScalaToolsReleases extends MavenRepository(ScalaToolsReleasesName, ScalaToolsReleasesRoot)
-object ScalaToolsSnapshots extends MavenRepository(ScalaToolsSnapshotsName, ScalaToolsSnapshotsRoot)
-object DefaultMavenRepository extends MavenRepository("public", IBiblioResolver.DEFAULT_M2_ROOT)
-object JavaNet1Repository extends Resolver
-{
- def name = "java.net Maven1 Repository"
-}
-
-object Resolver
-{
- val ScalaToolsReleasesName = "Scala-Tools Maven2 Repository"
- val ScalaToolsSnapshotsName = "Scala-Tools Maven2 Snapshots Repository"
- val ScalaToolsReleasesRoot = "http://scala-tools.org/repo-releases"
- val ScalaToolsSnapshotsRoot = "http://scala-tools.org/repo-snapshots"
-
- /** A base class for defining factories for interfaces to Ivy repositories that require a hostname , port, and patterns. */
- sealed abstract class Define[RepositoryType <: SshBasedRepository] extends NotNull
- {
- /** Subclasses should implement this method to */
- protected def construct(name: String, connection: SshConnection, patterns: Patterns): RepositoryType
- /** Constructs this repository type with the given `name`. `basePatterns` are the initial patterns to use. A ManagedProject
- * has an implicit defining these initial patterns based on a setting for either Maven or Ivy style patterns.*/
- def apply(name: String)(implicit basePatterns: Patterns): RepositoryType =
- apply(name, None, None, None)
- /** Constructs this repository type with the given `name` and `hostname`. `basePatterns` are the initial patterns to use.
- * A ManagedProject has an implicit defining these initial patterns based on a setting for either Maven or Ivy style patterns.*/
- def apply(name: String, hostname: String)(implicit basePatterns: Patterns): RepositoryType =
- apply(name, Some(hostname), None, None)
- /** Constructs this repository type with the given `name`, `hostname`, and the `basePath` against which the initial
- * patterns will be resolved. `basePatterns` are the initial patterns to use.
- * A ManagedProject has an implicit defining these initial patterns based on a setting for either Maven or Ivy style patterns.*/
- def apply(name: String, hostname: String, basePath: String)(implicit basePatterns: Patterns): RepositoryType =
- apply(name, Some(hostname), None, Some(basePath))
- /** Constructs this repository type with the given `name`, `hostname`, and `port`. `basePatterns` are the initial patterns to use.
- * A ManagedProject has an implicit defining these initial patterns based on a setting for either Maven or Ivy style patterns.*/
- def apply(name: String, hostname: String, port: Int)(implicit basePatterns: Patterns): RepositoryType =
- apply(name, Some(hostname), Some(port), None)
- /** Constructs this repository type with the given `name`, `hostname`, `port`, and the `basePath` against which the initial
- * patterns will be resolved. `basePatterns` are the initial patterns to use.
- * A ManagedProject has an implicit defining these initial patterns based on a setting for either Maven or Ivy style patterns.*/
- def apply(name: String, hostname: String, port: Int, basePath: String)(implicit basePatterns: Patterns): RepositoryType =
- apply(name, Some(hostname), Some(port), Some(basePath))
- /** Constructs this repository type with the given `name`, `hostname`, `port`, and the `basePath` against which the initial
- * patterns will be resolved. `basePatterns` are the initial patterns to use. All but the `name` are optional (use None).
- * A ManagedProject has an implicit defining these initial patterns based on a setting for either Maven or Ivy style patterns.*/
- def apply(name: String, hostname: Option[String], port: Option[Int], basePath: Option[String])(implicit basePatterns: Patterns): RepositoryType =
- construct(name, SshConnection(None, hostname, port), resolvePatterns(basePath, basePatterns))
- }
- /** A factory to construct an interface to an Ivy SSH resolver.*/
- object ssh extends Define[SshRepository]
- {
- protected def construct(name: String, connection: SshConnection, patterns: Patterns) = SshRepository(name, connection, patterns, None)
- }
- /** A factory to construct an interface to an Ivy SFTP resolver.*/
- object sftp extends Define[SftpRepository]
- {
- protected def construct(name: String, connection: SshConnection, patterns: Patterns) = SftpRepository(name, connection, patterns)
- }
- /** A factory to construct an interface to an Ivy filesytem resolver. */
- object file
- {
- /** Constructs a file resolver with the given name. The patterns to use must be explicitly specified
- * using the `ivys` or `artifacts` methods on the constructed resolver object.*/
- def apply(name: String): FileRepository = FileRepository(name, defaultFileConfiguration, Patterns(false))
- /** Constructs a file resolver with the given name and base directory. */
- def apply(name: String, baseDirectory: File)(implicit basePatterns: Patterns): FileRepository =
- {
- if(baseDirectory.exists && !baseDirectory.isDirectory) error("Not a directory: " + baseDirectory.getAbsolutePath)
- baseRepository(new File(baseDirectory.toURI.normalize) getAbsolutePath)(FileRepository(name, defaultFileConfiguration, _))
- }
- }
- object url
- {
- /** Constructs a URL resolver with the given name. The patterns to use must be explicitly specified
- * using the `ivys` or `artifacts` methods on the constructed resolver object.*/
- def apply(name: String): URLRepository = URLRepository(name, Patterns(false))
- /** Constructs a file resolver with the given name and base directory. */
- def apply(name: String, baseURL: URL)(implicit basePatterns: Patterns): URLRepository =
- baseRepository(baseURL.toURI.normalize.toString)(URLRepository(name, _))
- }
- private def baseRepository[T](base: String)(construct: Patterns => T)(implicit basePatterns: Patterns): T =
- construct(resolvePatterns(base, basePatterns))
-
- /** If `base` is None, `patterns` is returned unchanged.
- * Otherwise, the ivy file and artifact patterns in `patterns` are resolved against the given base. */
- private def resolvePatterns(base: Option[String], patterns: Patterns): Patterns =
- base match
- {
- case Some(path) => resolvePatterns(path, patterns)
- case None => patterns
- }
- /** Resolves the ivy file and artifact patterns in `patterns` against the given base. */
- private def resolvePatterns(base: String, basePatterns: Patterns): Patterns =
- {
- val normBase = base.replace('\\', '/')
- def resolve(pattern: String) = if(normBase.endsWith("/") || pattern.startsWith("/")) normBase +pattern else normBase + "/" + pattern
- def resolveAll(patterns: Seq[String]) = patterns.map(resolve)
- Patterns(resolveAll(basePatterns.ivyPatterns), resolveAll(basePatterns.artifactPatterns), basePatterns.isMavenCompatible)
- }
-
- def defaultFileConfiguration = FileConfiguration(true, None)
- def mavenStylePatterns = Patterns(Nil, mavenStyleBasePattern :: Nil, true)
- def ivyStylePatterns = defaultIvyPatterns//Patterns(Nil, mavenStyleBasePattern :: Nil, false)
-
- def defaultPatterns = mavenStylePatterns
- def mavenStyleBasePattern = "[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
- def localBasePattern = "[organisation]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]"
-
- def userRoot = System.getProperty("user.home")
- def userMavenRoot = userRoot + "/.m2/repository/"
- def userIvyRoot = userRoot + "/.ivy2/"
-
- def defaultLocal = defaultUserFileRepository("local")
- def defaultShared = defaultUserFileRepository("shared")
- def defaultUserFileRepository(id: String) = file(id, new File(userIvyRoot, id))(defaultIvyPatterns)
- def defaultIvyPatterns =
- {
- val pList = List(localBasePattern)
- Patterns(pList, pList, false)
- }
-}
-
-object Configurations
-{
- def config(name: String) = new Configuration(name)
- def defaultMavenConfigurations = Compile :: Runtime :: Test :: Provided :: System :: Optional :: Sources :: Javadoc :: Nil
-
- lazy val Default = config("default")
- lazy val Compile = config("compile")
- lazy val IntegrationTest = config("it") hide
- lazy val Provided = config("provided")
- lazy val Javadoc = config("javadoc")
- lazy val Runtime = config("runtime")
- lazy val Test = config("test") hide
- lazy val Sources = config("sources")
- lazy val System = config("system")
- lazy val Optional = config("optional")
-
- lazy val CompilerPlugin = config("plugin") hide
-
- def allPredefined = Default :: IntegrationTest :: CompilerPlugin :: defaultMavenConfigurations
-
- private[sbt] val DefaultMavenConfiguration = defaultConfiguration(true)
- private[sbt] val DefaultIvyConfiguration = defaultConfiguration(false)
- private[sbt] def DefaultConfiguration(mavenStyle: Boolean) = if(mavenStyle) DefaultMavenConfiguration else DefaultIvyConfiguration
- private[sbt] def defaultConfiguration(mavenStyle: Boolean) = if(mavenStyle) Configurations.Compile else Configurations.Default
- private[sbt] def removeDuplicates(configs: Iterable[Configuration]) = Set(scala.collection.mutable.Map(configs.map(config => (config.name, config)).toSeq: _*).values.toList: _*)
-}
-/** Represents an Ivy configuration. */
-final case class Configuration(name: String, description: String, isPublic: Boolean, extendsConfigs: List[Configuration], transitive: Boolean) extends NotNull
-{
- require(name != null && !name.isEmpty)
- require(description != null)
- def this(name: String) = this(name, "", true, Nil, true)
- def describedAs(newDescription: String) = Configuration(name, newDescription, isPublic, extendsConfigs, transitive)
- def extend(configs: Configuration*) = Configuration(name, description, isPublic, configs.toList ::: extendsConfigs, transitive)
- def notTransitive = intransitive
- def intransitive = Configuration(name, description, isPublic, extendsConfigs, false)
- def hide = Configuration(name, description, false, extendsConfigs, transitive)
- override def toString = name
-}
-
-final case class Artifact(name: String, `type`: String, extension: String, classifier: Option[String], configurations: Iterable[Configuration], url: Option[URL], extraAttributes: Map[String,String]) extends NotNull
-{
- def extra(attributes: (String,String)*) = Artifact(name, `type`, extension, classifier, configurations, url, extraAttributes ++ attributes)
-}
-object Artifact
-{
- def apply(name: String): Artifact = Artifact(name, defaultType, defaultExtension, None, Nil, None)
- def apply(name: String, extra: Map[String,String]): Artifact = Artifact(name, defaultType, defaultExtension, None, Nil, None, extra)
- def apply(name: String, classifier: String): Artifact = Artifact(name, defaultType, defaultExtension, Some(classifier), Nil, None)
- def apply(name: String, `type`: String, extension: String): Artifact = Artifact(name, `type`, extension, None, Nil, None)
- def apply(name: String, `type`: String, extension: String, classifier: String): Artifact = Artifact(name, `type`, extension, Some(classifier), Nil, None)
- def apply(name: String, url: URL): Artifact =Artifact(name, extract(url, defaultType), extract(url, defaultExtension), None, Nil, Some(url))
- def apply(name: String, `type`: String, extension: String, classifier: Option[String], configurations: Iterable[Configuration], url: Option[URL]): Artifact =
- Artifact(name, `type`, extension, classifier, configurations, url, Map.empty)
- val defaultExtension = "jar"
- val defaultType = "jar"
- private[this] def extract(url: URL, default: String) =
- {
- val s = url.toString
- val i = s.lastIndexOf('.')
- if(i >= 0)
- s.substring(i+1)
- else
- default
- }
-}
-
-object Credentials
-{
- /** Add the provided credentials to Ivy's credentials cache.*/
- def add(realm: String, host: String, userName: String, passwd: String): Unit =
- CredentialsStore.INSTANCE.addCredentials(realm, host, userName, passwd)
- /** Load credentials from the given file into Ivy's credentials cache.*/
- def apply(file: String, log: Logger): Unit = apply(Path.fromFile(file), log)
- /** Load credentials from the given file into Ivy's credentials cache.*/
- def apply(file: File, log: Logger): Unit = apply(Path.fromFile(file), log)
- /** Load credentials from the given file into Ivy's credentials cache.*/
- def apply(path: Path, log: Logger)
- {
- val msg =
- if(path.exists)
- {
- val properties = new scala.collection.mutable.HashMap[String, String]
- def get(keys: List[String]) = keys.flatMap(properties.get).firstOption.toRight(keys.head + " not specified in credentials file: " + path)
-
- impl.MapUtilities.read(properties, path, log) orElse
- {
- List.separate( List(RealmKeys, HostKeys, UserKeys, PasswordKeys).map(get) ) match
- {
- case (Nil, List(realm, host, user, pass)) => add(realm, host, user, pass); None
- case (errors, _) => Some(errors.mkString("\n"))
- }
- }
- }
- else
- Some("Credentials file " + path + " does not exist")
- msg.foreach(x => log.warn(x))
- }
- private[this] val RealmKeys = List("realm")
- private[this] val HostKeys = List("host", "hostname")
- private[this] val UserKeys = List("user", "user.name", "username")
- private[this] val PasswordKeys = List("password", "pwd", "pass", "passwd")
-}
\ No newline at end of file
diff --git a/src/main/scala/sbt/Project.scala b/src/main/scala/sbt/Project.scala
index ca3dda3de..9e7422699 100644
--- a/src/main/scala/sbt/Project.scala
+++ b/src/main/scala/sbt/Project.scala
@@ -4,7 +4,7 @@
package sbt
import xsbti.{AppProvider, ScalaProvider}
-import xsbt.{AnalyzingCompiler, ComponentManager, ScalaInstance}
+import xsbt.{AnalyzingCompiler, ScalaInstance}
import java.io.File
import java.net.URLClassLoader
import scala.collection._
@@ -228,7 +228,7 @@ trait Project extends TaskManager with Dag[Project] with BasicEnvironment
def buildScalaVersion = info.buildScalaVersion.getOrElse(crossScalaVersions.first)
- def componentManager = new xsbt.ComponentManager(info.launcher.globalLock, info.app.components, log)
+ def componentManager = new ComponentManager(info.launcher.globalLock, info.app.components, log)
def buildScalaInstance = buildScalaInstance0
final def buildScalaInstance0: ScalaInstance =
{
diff --git a/src/main/scala/sbt/impl/ConvertResolver.scala b/src/main/scala/sbt/impl/ConvertResolver.scala
deleted file mode 100644
index 1d9ec9414..000000000
--- a/src/main/scala/sbt/impl/ConvertResolver.scala
+++ /dev/null
@@ -1,100 +0,0 @@
-/* sbt -- Simple Build Tool
- * Copyright 2008, 2009 Mark Harrah
- */
-package sbt
-
-import org.apache.ivy.{core,plugins}
-import core.module.id.ModuleRevisionId
-import plugins.resolver.{ChainResolver, DependencyResolver, IBiblioResolver}
-import plugins.resolver.{AbstractPatternsBasedResolver, AbstractSshBasedResolver, FileSystemResolver, SFTPResolver, SshResolver, URLResolver}
-
-private object ConvertResolver
-{
- /** Converts the given sbt resolver into an Ivy resolver..*/
- def apply(r: Resolver) =
- {
- r match
- {
- case repo: MavenRepository =>
- {
- val resolver = new IBiblioResolver
- initializeMavenStyle(resolver, repo.name, repo.root)
- resolver
- }
- case JavaNet1Repository =>
- {
- // Thanks to Matthias Pfau for posting how to use the Maven 1 repository on java.net with Ivy:
- // http://www.nabble.com/Using-gradle-Ivy-with-special-maven-repositories-td23775489.html
- val resolver = new IBiblioResolver { override def convertM2IdForResourceSearch(mrid: ModuleRevisionId) = mrid }
- initializeMavenStyle(resolver, JavaNet1Repository.name, "http://download.java.net/maven/1/")
- resolver.setPattern("[organisation]/[ext]s/[module]-[revision](-[classifier]).[ext]")
- resolver
- }
- case repo: SshRepository =>
- {
- val resolver = new SshResolver
- initializeSSHResolver(resolver, repo)
- repo.publishPermissions.foreach(perm => resolver.setPublishPermissions(perm))
- resolver
- }
- case repo: SftpRepository =>
- {
- val resolver = new SFTPResolver
- initializeSSHResolver(resolver, repo)
- resolver
- }
- case repo: FileRepository =>
- {
- val resolver = new FileSystemResolver
- resolver.setName(repo.name)
- initializePatterns(resolver, repo.patterns)
- import repo.configuration.{isLocal, isTransactional}
- resolver.setLocal(isLocal)
- isTransactional.foreach(value => resolver.setTransactional(value.toString))
- resolver
- }
- case repo: URLRepository =>
- {
- val resolver = new URLResolver
- resolver.setName(repo.name)
- initializePatterns(resolver, repo.patterns)
- resolver
- }
- }
- }
- private def initializeMavenStyle(resolver: IBiblioResolver, name: String, root: String)
- {
- resolver.setName(name)
- resolver.setM2compatible(true)
- resolver.setRoot(root)
- }
- private def initializeSSHResolver(resolver: AbstractSshBasedResolver, repo: SshBasedRepository)
- {
- resolver.setName(repo.name)
- resolver.setPassfile(null)
- initializePatterns(resolver, repo.patterns)
- initializeConnection(resolver, repo.connection)
- }
- private def initializeConnection(resolver: AbstractSshBasedResolver, connection: RepositoryHelpers.SshConnection)
- {
- import resolver._
- import connection._
- hostname.foreach(setHost)
- port.foreach(setPort)
- authentication foreach
- {
- case RepositoryHelpers.PasswordAuthentication(user, password) =>
- setUser(user)
- setUserPassword(password)
- case RepositoryHelpers.KeyFileAuthentication(file, password) =>
- setKeyFile(file)
- setKeyFilePassword(password)
- }
- }
- private def initializePatterns(resolver: AbstractPatternsBasedResolver, patterns: Patterns)
- {
- resolver.setM2compatible(patterns.isMavenCompatible)
- patterns.ivyPatterns.foreach(resolver.addIvyPattern)
- patterns.artifactPatterns.foreach(resolver.addArtifactPattern)
- }
-}
diff --git a/src/main/scala/sbt/impl/ManagedImpl.scala b/src/main/scala/sbt/impl/ManagedImpl.scala
deleted file mode 100644
index e1f13b892..000000000
--- a/src/main/scala/sbt/impl/ManagedImpl.scala
+++ /dev/null
@@ -1,71 +0,0 @@
-/* sbt -- Simple Build Tool
- * Copyright 2008, 2009 Mark Harrah
- */
-package sbt
-
-import org.apache.ivy.{plugins, util}
-import plugins.parser.m2.PomModuleDescriptorWriter
-import util.{Message, MessageLogger}
-
-private object DefaultConfigurationMapping extends PomModuleDescriptorWriter.ConfigurationScopeMapping(new java.util.HashMap)
-{
- override def getScope(confs: Array[String]) =
- {
- Configurations.defaultMavenConfigurations.find(conf => confs.contains(conf.name)) match
- {
- case Some(conf) => conf.name
- case None =>
- if(confs.isEmpty || confs(0) == Configurations.Default.name)
- null
- else
- confs(0)
- }
- }
- override def isOptional(confs: Array[String]) = confs.isEmpty || (confs.length == 1 && confs(0) == Configurations.Optional.name)
-}
-
-/** Interface between Ivy logging and sbt logging. */
-private final class IvyLogger(log: Logger) extends MessageLogger
-{
- private var progressEnabled = false
-
- def log(msg: String, level: Int)
- {
- import Message.{MSG_DEBUG, MSG_VERBOSE, MSG_INFO, MSG_WARN, MSG_ERR}
- level match
- {
- case MSG_DEBUG | MSG_VERBOSE => debug(msg)
- case MSG_INFO => info(msg)
- case MSG_WARN => warn(msg)
- case MSG_ERR => error(msg)
- }
- }
- def rawlog(msg: String, level: Int)
- {
- log(msg, level)
- }
- import Level.{Debug, Info, Warn, Error}
- def debug(msg: String) = logImpl(msg, Debug)
- def verbose(msg: String) = debug(msg)
- def deprecated(msg: String) = warn(msg)
- def info(msg: String) = logImpl(msg, Info)
- def rawinfo(msg: String) = info(msg)
- def warn(msg: String) = logImpl(msg, Warn)
- def error(msg: String) = logImpl(msg, Error)
-
- private def logImpl(msg: String, level: Level.Value) = log.log(level, msg)
-
- private def emptyList = java.util.Collections.emptyList[T forSome { type T}]
- def getProblems = emptyList
- def getWarns = emptyList
- def getErrors = emptyList
-
- def clearProblems = ()
- def sumupProblems = ()
- def progress = ()
- def endProgress = ()
-
- def endProgress(msg: String) = info(msg)
- def isShowProgress = false
- def setShowProgress(progress: Boolean) {}
-}
diff --git a/src/sbt-test/dependency-management/artifact/project/build/ArtifactTest.scala b/src/sbt-test/dependency-management/artifact/project/build/ArtifactTest.scala
index f2dcc858d..3c61d9f35 100644
--- a/src/sbt-test/dependency-management/artifact/project/build/ArtifactTest.scala
+++ b/src/sbt-test/dependency-management/artifact/project/build/ArtifactTest.scala
@@ -3,8 +3,7 @@ import sbt._
class ArtifactTest(info: ProjectInfo) extends DefaultProject(info)
{
// use cache specific to this test
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
// define a test repository to publish to
override def managedStyle = ManagedStyle.Maven
diff --git a/src/sbt-test/dependency-management/classifier/project/build/Test.scala b/src/sbt-test/dependency-management/classifier/project/build/Test.scala
index b658907e1..9cf18923a 100644
--- a/src/sbt-test/dependency-management/classifier/project/build/Test.scala
+++ b/src/sbt-test/dependency-management/classifier/project/build/Test.scala
@@ -2,7 +2,6 @@ import sbt._
class Test(info: ProjectInfo) extends DefaultProject(info)
{
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
val testng = "org.testng" % "testng" % "5.7" classifier "jdk15"
}
\ No newline at end of file
diff --git a/src/sbt-test/dependency-management/extra/changes/UseColor.scala b/src/sbt-test/dependency-management/extra/changes/UseColor.scala
index 4371704fd..2b0093e76 100644
--- a/src/sbt-test/dependency-management/extra/changes/UseColor.scala
+++ b/src/sbt-test/dependency-management/extra/changes/UseColor.scala
@@ -2,8 +2,7 @@ import sbt._
class UseColor(info: ProjectInfo) extends DefaultProject(info)
{
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
override def managedStyle = ManagedStyle.Ivy
val repo = Resolver.file("test-repo", ("repo" / "test").asFile)
diff --git a/src/sbt-test/dependency-management/extra/project/build/DefineColor.scala b/src/sbt-test/dependency-management/extra/project/build/DefineColor.scala
index 658c6c063..5d337e24f 100644
--- a/src/sbt-test/dependency-management/extra/project/build/DefineColor.scala
+++ b/src/sbt-test/dependency-management/extra/project/build/DefineColor.scala
@@ -2,8 +2,7 @@ import sbt._
class DefineColor(info: ProjectInfo) extends DefaultProject(info)
{
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
override def managedStyle = ManagedStyle.Ivy
val publishTo = Resolver.file("test-repo", ("repo" / "test").asFile)
diff --git a/src/sbt-test/dependency-management/info/project/build/InfoTest.scala b/src/sbt-test/dependency-management/info/project/build/InfoTest.scala
index dc71382d8..037d065ce 100644
--- a/src/sbt-test/dependency-management/info/project/build/InfoTest.scala
+++ b/src/sbt-test/dependency-management/info/project/build/InfoTest.scala
@@ -2,8 +2,7 @@ import sbt._
class InfoTest(info: ProjectInfo) extends DefaultProject(info)
{
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
override def ivyXML =
if(customInfo)
diff --git a/src/sbt-test/dependency-management/inherit-repo/changes/CorrectProject.scala b/src/sbt-test/dependency-management/inherit-repo/changes/CorrectProject.scala
index 6a247bcd2..1969db32a 100644
--- a/src/sbt-test/dependency-management/inherit-repo/changes/CorrectProject.scala
+++ b/src/sbt-test/dependency-management/inherit-repo/changes/CorrectProject.scala
@@ -4,13 +4,11 @@ class TestProject(info: ProjectInfo) extends ParentProject(info)
{
val addRepo = "Extra Test Repository" at "http://dev.camptocamp.com/files/m2_repo/"
val sub = project("sub", "Sub Project", new SubProject(_))
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
class SubProject(info: ProjectInfo) extends DefaultProject(info)
{
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
override def ivyXML =
diff --git a/src/sbt-test/dependency-management/inherit-repo/changes/CorrectProject2.scala b/src/sbt-test/dependency-management/inherit-repo/changes/CorrectProject2.scala
index a51ad119d..853ae1f6b 100644
--- a/src/sbt-test/dependency-management/inherit-repo/changes/CorrectProject2.scala
+++ b/src/sbt-test/dependency-management/inherit-repo/changes/CorrectProject2.scala
@@ -4,15 +4,13 @@ class TestProject(info: ProjectInfo) extends ParentProject(info)
{
val addRepo = "Extra Test Repository" at "http://dev.camptocamp.com/files/m2_repo/"
val sub = project("sub", "Sub Project", new SubProject(_))
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
class SubProject(info: ProjectInfo) extends DefaultProject(info)
{
val addRepo = "Extra Test Repository" at "http://dev.camptocamp.com/files/m2_repo/"
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
override def ivyXML =
diff --git a/src/sbt-test/dependency-management/inherit-repo/changes/CorrectProject3.scala b/src/sbt-test/dependency-management/inherit-repo/changes/CorrectProject3.scala
index a51ad119d..a26de6c2b 100644
--- a/src/sbt-test/dependency-management/inherit-repo/changes/CorrectProject3.scala
+++ b/src/sbt-test/dependency-management/inherit-repo/changes/CorrectProject3.scala
@@ -4,15 +4,13 @@ class TestProject(info: ProjectInfo) extends ParentProject(info)
{
val addRepo = "Extra Test Repository" at "http://dev.camptocamp.com/files/m2_repo/"
val sub = project("sub", "Sub Project", new SubProject(_))
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
class SubProject(info: ProjectInfo) extends DefaultProject(info)
{
val addRepo = "Extra Test Repository" at "http://dev.camptocamp.com/files/m2_repo/"
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
override def ivyXML =
diff --git a/src/sbt-test/dependency-management/inherit-repo/project/build/src/TestProject.scala b/src/sbt-test/dependency-management/inherit-repo/project/build/src/TestProject.scala
index a576d9609..510c38fe4 100644
--- a/src/sbt-test/dependency-management/inherit-repo/project/build/src/TestProject.scala
+++ b/src/sbt-test/dependency-management/inherit-repo/project/build/src/TestProject.scala
@@ -3,13 +3,11 @@ import sbt._
class TestProject(info: ProjectInfo) extends ParentProject(info)
{
val sub = project("sub", "Sub Project", new SubProject(_))
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
class SubProject(info: ProjectInfo) extends DefaultProject(info)
{
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
override def ivyXML =
diff --git a/src/sbt-test/dependency-management/inline-dependencies-a/project/build/src/UpdateTestProject.scala b/src/sbt-test/dependency-management/inline-dependencies-a/project/build/src/UpdateTestProject.scala
index 09885508b..8f7323f9e 100644
--- a/src/sbt-test/dependency-management/inline-dependencies-a/project/build/src/UpdateTestProject.scala
+++ b/src/sbt-test/dependency-management/inline-dependencies-a/project/build/src/UpdateTestProject.scala
@@ -3,7 +3,6 @@ import sbt._
class UpdateTestProject(info: ProjectInfo) extends DefaultProject(info)
{
val sc = "org.scalacheck" % "scalacheck" % "1.5"
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
override def disableCrossPaths = true
}
\ No newline at end of file
diff --git a/src/sbt-test/dependency-management/ivy-settings-a/project/build/TestProject.scala b/src/sbt-test/dependency-management/ivy-settings-a/project/build/TestProject.scala
index f8cb6a639..eb083fd84 100644
--- a/src/sbt-test/dependency-management/ivy-settings-a/project/build/TestProject.scala
+++ b/src/sbt-test/dependency-management/ivy-settings-a/project/build/TestProject.scala
@@ -2,5 +2,6 @@ import sbt._
class TestProject(info: ProjectInfo) extends DefaultProject(info)
{
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
override def disableCrossPaths = true
}
\ No newline at end of file
diff --git a/src/sbt-test/dependency-management/ivy-settings-b/project/build/src/UpdateTestProject.scala b/src/sbt-test/dependency-management/ivy-settings-b/project/build/src/UpdateTestProject.scala
index 005f0cb62..8f7323f9e 100644
--- a/src/sbt-test/dependency-management/ivy-settings-b/project/build/src/UpdateTestProject.scala
+++ b/src/sbt-test/dependency-management/ivy-settings-b/project/build/src/UpdateTestProject.scala
@@ -3,5 +3,6 @@ import sbt._
class UpdateTestProject(info: ProjectInfo) extends DefaultProject(info)
{
val sc = "org.scalacheck" % "scalacheck" % "1.5"
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
override def disableCrossPaths = true
}
\ No newline at end of file
diff --git a/src/sbt-test/dependency-management/java.net/project/build/src/TestProject.scala b/src/sbt-test/dependency-management/java.net/project/build/src/TestProject.scala
index c98c0e6b0..fd31e81f4 100644
--- a/src/sbt-test/dependency-management/java.net/project/build/src/TestProject.scala
+++ b/src/sbt-test/dependency-management/java.net/project/build/src/TestProject.scala
@@ -2,6 +2,7 @@ import sbt._
class TestProject(info: ProjectInfo) extends DefaultProject(info)
{
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
val javaNet = JavaNet1Repository
val ejb = "javax.ejb" % "ejb-api" % "3.0"
}
\ No newline at end of file
diff --git a/src/sbt-test/dependency-management/module-confs/changes/WrongOrg.scala b/src/sbt-test/dependency-management/module-confs/changes/WrongOrg.scala
index 52240e06a..47f80c36c 100644
--- a/src/sbt-test/dependency-management/module-confs/changes/WrongOrg.scala
+++ b/src/sbt-test/dependency-management/module-confs/changes/WrongOrg.scala
@@ -2,13 +2,12 @@ import sbt._
class Test(info: ProjectInfo) extends DefaultProject(info)
{
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
def snapshotPattern = "http://scala-tools.org/repo-snapshots/[organization]/[module]/2.8.0-SNAPSHOT/[artifact]-[revision].[ext]"
def scalaSnapshots = Resolver.url("Scala Tools Snapshots") artifacts(snapshotPattern) ivys(snapshotPattern) mavenStyle()
val scOnly = ModuleConfiguration("org.not-scala-lang", "*", "2.8.0-.*", scalaSnapshots)
- val uniqueScala = "org.scala-lang" % "scala-compiler" % "2.8.0-20090910.003346-219"
+ val uniqueScala = "org.scala-lang" % "scala-compiler" % "2.8.0-20100115.022156-304"
val otherDep = "org.scala-tools.sxr" % "sxr_2.7.5" % "0.2.3"
}
\ No newline at end of file
diff --git a/src/sbt-test/dependency-management/module-confs/changes/WrongPattern.scala b/src/sbt-test/dependency-management/module-confs/changes/WrongPattern.scala
index 4fc451b24..f999c459b 100644
--- a/src/sbt-test/dependency-management/module-confs/changes/WrongPattern.scala
+++ b/src/sbt-test/dependency-management/module-confs/changes/WrongPattern.scala
@@ -2,13 +2,12 @@ import sbt._
class Test(info: ProjectInfo) extends DefaultProject(info)
{
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
def snapshotPattern = "http://scala-tools.org/repo-snapshots/[organization]/[module]/2.8.a-SNAPSHOT/[artifact]-[revision].[ext]"
def scalaSnapshots = Resolver.url("Scala Tools Snapshots") artifacts(snapshotPattern) ivys(snapshotPattern) mavenStyle()
val scOnly = ModuleConfiguration("org.scala-lang", "*", "2.8.0-.*", scalaSnapshots)
- val uniqueScala = "org.scala-lang" % "scala-compiler" % "2.8.0-20090910.003346-219"
+ val uniqueScala = "org.scala-lang" % "scala-compiler" % "2.8.0-20100115.022156-304"
val otherDep = "org.scala-tools.sxr" % "sxr_2.7.5" % "0.2.3"
}
\ No newline at end of file
diff --git a/src/sbt-test/dependency-management/module-confs/changes/WrongVersion.scala b/src/sbt-test/dependency-management/module-confs/changes/WrongVersion.scala
index 4ac6d5a3e..687e9121d 100644
--- a/src/sbt-test/dependency-management/module-confs/changes/WrongVersion.scala
+++ b/src/sbt-test/dependency-management/module-confs/changes/WrongVersion.scala
@@ -2,13 +2,12 @@ import sbt._
class Test(info: ProjectInfo) extends DefaultProject(info)
{
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
def snapshotPattern = "http://scala-tools.org/repo-snapshots/[organization]/[module]/2.8.0-SNAPSHOT/[artifact]-[revision].[ext]"
def scalaSnapshots = Resolver.url("Scala Tools Snapshots") artifacts(snapshotPattern) ivys(snapshotPattern) mavenStyle()
val scOnly = ModuleConfiguration("org.scala-lang", "*", "2.8.0-.*", scalaSnapshots)
- val uniqueScala = "org.scala-lang" % "scala-compiler" % "2.8.0-20090910.003346-218"
+ val uniqueScala = "org.scala-lang" % "scala-compiler" % "2.8.0-20100115.022156-305"
val otherDep = "org.scala-tools.sxr" % "sxr_2.7.5" % "0.2.3"
}
\ No newline at end of file
diff --git a/src/sbt-test/dependency-management/module-confs/project/build/Test.scala b/src/sbt-test/dependency-management/module-confs/project/build/Test.scala
index 83b398a03..b274c8724 100644
--- a/src/sbt-test/dependency-management/module-confs/project/build/Test.scala
+++ b/src/sbt-test/dependency-management/module-confs/project/build/Test.scala
@@ -2,14 +2,13 @@ import sbt._
class Test(info: ProjectInfo) extends DefaultProject(info)
{
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
def snapshotPattern = "http://scala-tools.org/repo-snapshots/[organization]/[module]/2.8.0-SNAPSHOT/[artifact]-[revision].[ext]"
def scalaSnapshots = Resolver.url("Scala Tools Snapshots") artifacts(snapshotPattern) ivys(snapshotPattern) mavenStyle()
val scOnly = ModuleConfiguration("org.scala-lang", "*", "2.8.0-.*", scalaSnapshots)
- val uniqueScala = "org.scala-lang" % "scala-compiler" % "2.8.0-20091017.011744-240"
+ val uniqueScala = "org.scala-lang" % "scala-compiler" % "2.8.0-20100115.022156-304"
val otherDep = "org.scala-tools.sxr" % "sxr_2.7.5" % "0.2.3"
override def checkExplicitScalaDependencies = false
diff --git a/src/sbt-test/dependency-management/package-to-publish/project/build/Test.scala b/src/sbt-test/dependency-management/package-to-publish/project/build/Test.scala
index f7a1dd0f2..00c3f923c 100644
--- a/src/sbt-test/dependency-management/package-to-publish/project/build/Test.scala
+++ b/src/sbt-test/dependency-management/package-to-publish/project/build/Test.scala
@@ -2,8 +2,7 @@ import sbt._
class Test(info: ProjectInfo) extends DefaultProject(info)
{
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
override def managedStyle = ManagedStyle.Maven
def testRepoPath = path("test-repo")
diff --git a/src/sbt-test/dependency-management/publish-local/project/build/MultiPublishTest.scala b/src/sbt-test/dependency-management/publish-local/project/build/MultiPublishTest.scala
index fadb0a30f..c16f029fb 100644
--- a/src/sbt-test/dependency-management/publish-local/project/build/MultiPublishTest.scala
+++ b/src/sbt-test/dependency-management/publish-local/project/build/MultiPublishTest.scala
@@ -7,8 +7,7 @@ class MultiPublishTest(info: ProjectInfo) extends ParentProject(info)
ManagedStyle.Maven
else
ManagedStyle.Auto
- def ivyCacheDirectory = outputPath / "ivy-cache"
- override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
+ override def ivyCacheDirectory = Some(outputPath / "ivy-cache")
lazy val sub = project("sub", "Sub Project", new SubProject(_))
class SubProject(info: ProjectInfo) extends DefaultProject(info)