Merge pull request #47 from dwijnand/cleanups

Cleanups
This commit is contained in:
eugene yokota 2016-06-21 23:20:09 +02:00 committed by GitHub
commit e7ca095303
29 changed files with 40 additions and 175 deletions

View File

@ -1,7 +1,7 @@
language: scala language: scala
scala: scala:
- 2.10.6 - 2.11.8
- 2.11.7
jdk: jdk:
- oraclejdk8 - openjdk7
- oraclejdk7 - oraclejdk7
- oraclejdk8

View File

@ -14,23 +14,10 @@ def commonSettings: Seq[Setting[_]] = Seq(
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"), javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
incOptions := incOptions.value.withNameHashing(true), incOptions := incOptions.value.withNameHashing(true),
crossScalaVersions := Seq(scala210, scala211), crossScalaVersions := Seq(scala211),
resolvers += Resolver.sonatypeRepo("public"), resolvers += Resolver.sonatypeRepo("public"),
scalacOptions ++= Seq( scalacOptions += "-Ywarn-unused",
"-encoding", "utf8", scalacOptions += "-Ywarn-unused-import",
"-deprecation",
"-feature",
"-unchecked",
"-Xlint",
"-language:higherKinds",
"-language:implicitConversions",
"-Xfuture",
"-Yinline-warnings",
"-Xfatal-warnings",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard"),
previousArtifact := None, // Some(organization.value %% moduleName.value % "1.0.0"), previousArtifact := None, // Some(organization.value %% moduleName.value % "1.0.0"),
publishArtifact in Compile := true, publishArtifact in Compile := true,
publishArtifact in Test := false publishArtifact in Test := false
@ -51,7 +38,6 @@ lazy val root = (project in file(".")).
publish := {}, publish := {},
publishLocal := {}, publishLocal := {},
publishArtifact in Compile := false, publishArtifact in Compile := false,
publishArtifact in Test := false,
publishArtifact := false, publishArtifact := false,
customCommands customCommands
) )
@ -64,7 +50,6 @@ lazy val lm = (project in file("librarymanagement")).
utilLogging, sbtIO, utilTesting % Test, utilLogging, sbtIO, utilTesting % Test,
utilCollection, utilCompletion, ivy, jsch, sbtSerialization, scalaReflect.value, launcherInterface), utilCollection, utilCompletion, ivy, jsch, sbtSerialization, scalaReflect.value, launcherInterface),
resourceGenerators in Compile <+= (version, resourceManaged, streams, compile in Compile) map Util.generateVersionFile, resourceGenerators in Compile <+= (version, resourceManaged, streams, compile in Compile) map Util.generateVersionFile,
publishArtifact in Test := false,
binaryIssueFilters ++= Seq() binaryIssueFilters ++= Seq()
) )

View File

@ -3,7 +3,7 @@
*/ */
package sbt.internal.librarymanagement package sbt.internal.librarymanagement
import java.io.{ File, FileOutputStream } import java.io.File
import java.util.concurrent.Callable import java.util.concurrent.Callable
import sbt.util.Logger import sbt.util.Logger
import sbt.librarymanagement._ import sbt.librarymanagement._
@ -57,7 +57,6 @@ class ComponentManager(globalLock: xsbti.GlobalLock, provider: xsbti.ComponentPr
case xs => invalid("Expected single file for component '" + id + "', found: " + xs.mkString(", ")) case xs => invalid("Expected single file for component '" + id + "', found: " + xs.mkString(", "))
} }
private def invalid(msg: String) = throw new InvalidComponent(msg) private def invalid(msg: String) = throw new InvalidComponent(msg)
private def invalid(e: NotInCache) = throw new InvalidComponent(e.getMessage, e)
def define(id: String, files: Iterable[File]) = lockLocalCache { provider.defineComponent(id, files.toSeq.toArray) } def define(id: String, files: Iterable[File]) = lockLocalCache { provider.defineComponent(id, files.toSeq.toArray) }
/** Retrieve the file for component 'id' from the local repository. */ /** Retrieve the file for component 'id' from the local repository. */

View File

@ -5,7 +5,6 @@ package sbt.internal.librarymanagement
import java.net.URL import java.net.URL
import java.util.Collections import java.util.Collections
import org.apache.ivy.core.module.id.ModuleRevisionId
import org.apache.ivy.core.module.descriptor.DependencyDescriptor import org.apache.ivy.core.module.descriptor.DependencyDescriptor
import org.apache.ivy.core.resolve.ResolveData import org.apache.ivy.core.resolve.ResolveData
import org.apache.ivy.core.settings.IvySettings import org.apache.ivy.core.settings.IvySettings
@ -245,7 +244,7 @@ private[sbt] object ConvertResolver {
} }
fireTransferInitiated(resource, TransferEvent.REQUEST_PUT); fireTransferInitiated(resource, TransferEvent.REQUEST_PUT);
try { try {
var totalLength = source.length val totalLength = source.length
if (totalLength > 0) { if (totalLength > 0) {
progress.setTotalLength(totalLength); progress.setTotalLength(totalLength);
} }

View File

@ -11,10 +11,8 @@ import org.apache.ivy.util.extendable.ExtendableItem
import java.io.{ File, InputStream } import java.io.{ File, InputStream }
import java.net.URL import java.net.URL
import java.util.regex.Pattern
import sbt.internal.librarymanagement.mavenint.{ PomExtraDependencyAttributes, SbtPomExtraProperties } import sbt.internal.librarymanagement.mavenint.{ PomExtraDependencyAttributes, SbtPomExtraProperties }
import sbt.io.Hash import sbt.io.Hash
import sbt.librarymanagement._
// @deprecated("We now use an Aether-based pom parser.", "0.13.8") // @deprecated("We now use an Aether-based pom parser.", "0.13.8")
final class CustomPomParser(delegate: ModuleDescriptorParser, transform: (ModuleDescriptorParser, ModuleDescriptor) => ModuleDescriptor) extends ModuleDescriptorParser { final class CustomPomParser(delegate: ModuleDescriptorParser, transform: (ModuleDescriptorParser, ModuleDescriptor) => ModuleDescriptor) extends ModuleDescriptorParser {
@ -99,12 +97,6 @@ object CustomPomParser {
// parses the immediate text nodes of the property. // parses the immediate text nodes of the property.
val extraDepAttributes = getDependencyExtra(filtered) val extraDepAttributes = getDependencyExtra(filtered)
// Fixes up the detected extension in some cases missed by Ivy.
val convertArtifacts = artifactExtIncorrect(md)
// Merges artifact sections for duplicate dependency definitions
val mergeDuplicates = IvySbt.hasDuplicateDependencies(md.getDependencies)
val unqualify = toUnqualify(filtered) val unqualify = toUnqualify(filtered)
// Here we always add extra attributes. There's a scenario where parent-pom information corrupts child-poms with "e:" namespaced xml elements // Here we always add extra attributes. There's a scenario where parent-pom information corrupts child-poms with "e:" namespaced xml elements
@ -123,12 +115,8 @@ object CustomPomParser {
private[sbt] def toUnqualify(propertyAttributes: Map[String, String]): Map[String, String] = private[sbt] def toUnqualify(propertyAttributes: Map[String, String]): Map[String, String] =
(propertyAttributes - ExtraAttributesKey) map { case (k, v) => ("e:" + k, v) } (propertyAttributes - ExtraAttributesKey) map { case (k, v) => ("e:" + k, v) }
private[this] def artifactExtIncorrect(md: ModuleDescriptor): Boolean =
md.getConfigurations.exists(conf => md.getArtifacts(conf.getName).exists(art => JarPackagings(art.getExt)))
private[this] def shouldBeUnqualified(m: Map[String, String]): Map[String, String] = m.filterKeys(unqualifiedKeys) private[this] def shouldBeUnqualified(m: Map[String, String]): Map[String, String] = m.filterKeys(unqualifiedKeys)
private[this] def condAddExtra(properties: Map[String, String], id: ModuleRevisionId): ModuleRevisionId =
if (properties.isEmpty) id else addExtra(properties, id)
private[this] def addExtra(properties: Map[String, String], id: ModuleRevisionId): ModuleRevisionId = private[this] def addExtra(properties: Map[String, String], id: ModuleRevisionId): ModuleRevisionId =
{ {
import collection.JavaConverters._ import collection.JavaConverters._
@ -167,8 +155,6 @@ object CustomPomParser {
} }
private[this] def transform(dep: DependencyDescriptor, f: ModuleRevisionId => ModuleRevisionId): DependencyDescriptor = private[this] def transform(dep: DependencyDescriptor, f: ModuleRevisionId => ModuleRevisionId): DependencyDescriptor =
DefaultDependencyDescriptor.transformInstance(dep, namespaceTransformer(dep.getDependencyRevisionId, f), false) DefaultDependencyDescriptor.transformInstance(dep, namespaceTransformer(dep.getDependencyRevisionId, f), false)
private[this] def extraTransformer(txId: ModuleRevisionId, extra: Map[String, String]): NamespaceTransformer =
namespaceTransformer(txId, revId => addExtra(extra, revId))
private[this] def namespaceTransformer(txId: ModuleRevisionId, f: ModuleRevisionId => ModuleRevisionId): NamespaceTransformer = private[this] def namespaceTransformer(txId: ModuleRevisionId, f: ModuleRevisionId => ModuleRevisionId): NamespaceTransformer =
new NamespaceTransformer { new NamespaceTransformer {

View File

@ -11,7 +11,6 @@ import org.apache.ivy.core.settings.IvySettings
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser
import org.apache.ivy.plugins.repository.Resource import org.apache.ivy.plugins.repository.Resource
import org.apache.ivy.plugins.repository.url.URLResource import org.apache.ivy.plugins.repository.url.URLResource
import sbt.librarymanagement._
/** Subclasses the default Ivy file parser in order to provide access to protected methods.*/ /** Subclasses the default Ivy file parser in order to provide access to protected methods.*/
private[sbt] object CustomXmlParser extends XmlModuleDescriptorParser { private[sbt] object CustomXmlParser extends XmlModuleDescriptorParser {

View File

@ -14,7 +14,6 @@ import org.apache.ivy.core.resolve.{ DownloadOptions, ResolveData, ResolvedModul
import org.apache.ivy.core.search.{ ModuleEntry, OrganisationEntry, RevisionEntry } import org.apache.ivy.core.search.{ ModuleEntry, OrganisationEntry, RevisionEntry }
import org.apache.ivy.core.settings.IvySettings import org.apache.ivy.core.settings.IvySettings
import org.apache.ivy.plugins.namespace.Namespace import org.apache.ivy.plugins.namespace.Namespace
import org.apache.ivy.plugins.repository.url.URLResource
import org.apache.ivy.plugins.resolver.{ DependencyResolver, ResolverSettings } import org.apache.ivy.plugins.resolver.{ DependencyResolver, ResolverSettings }
import org.apache.ivy.plugins.resolver.util.ResolvedResource import org.apache.ivy.plugins.resolver.util.ResolvedResource
@ -77,7 +76,6 @@ private[sbt] class FakeResolver(private var name: String, cacheDir: File, module
val report = new DownloadReport val report = new DownloadReport
artifacts foreach { art => artifacts foreach { art =>
val artifactOrigin = locate(art)
Option(locate(art)) foreach (o => report.addArtifactReport(download(o, options))) Option(locate(art)) foreach (o => report.addArtifactReport(download(o, options)))
} }
@ -177,10 +175,6 @@ private[sbt] class FakeResolver(private var name: String, cacheDir: File, module
override def setSettings(settings: ResolverSettings): Unit = () override def setSettings(settings: ResolverSettings): Unit = ()
private class LocalURLResource(jar: File) extends URLResource(jar.toURI.toURL) {
override def isLocal(): Boolean = true
}
} }
private[sbt] object FakeResolver { private[sbt] object FakeResolver {

View File

@ -5,35 +5,25 @@ package sbt.internal.librarymanagement
import java.io.File import java.io.File
import java.net.URI import java.net.URI
import java.text.ParseException
import java.util.concurrent.Callable import java.util.concurrent.Callable
import java.util.{ Collection, Collections => CS, Date }
import CS.singleton
import org.apache.ivy.Ivy import org.apache.ivy.Ivy
import org.apache.ivy.core.report.ResolveReport import org.apache.ivy.core.IvyPatternHelper
import org.apache.ivy.core.{ IvyPatternHelper, LogOptions, IvyContext } import org.apache.ivy.core.cache.{ CacheMetadataOptions, DefaultRepositoryCacheManager }
import org.apache.ivy.core.cache.{ ResolutionCacheManager, CacheMetadataOptions, DefaultRepositoryCacheManager, ModuleDescriptorWriter }
import org.apache.ivy.core.event.EventManager import org.apache.ivy.core.event.EventManager
import org.apache.ivy.core.module.descriptor.{ Artifact => IArtifact, DefaultArtifact, DefaultDependencyArtifactDescriptor, MDArtifact } import org.apache.ivy.core.module.descriptor.{ Artifact => IArtifact, DefaultArtifact, DefaultDependencyArtifactDescriptor, MDArtifact }
import org.apache.ivy.core.module.descriptor.{ DefaultDependencyDescriptor, DefaultModuleDescriptor, DependencyDescriptor, ModuleDescriptor, License } import org.apache.ivy.core.module.descriptor.{ DefaultDependencyDescriptor, DefaultModuleDescriptor, DependencyDescriptor, ModuleDescriptor, License }
import org.apache.ivy.core.module.descriptor.OverrideDependencyDescriptorMediator import org.apache.ivy.core.module.descriptor.OverrideDependencyDescriptorMediator
import org.apache.ivy.core.module.id.{ ArtifactId, ModuleId, ModuleRevisionId } import org.apache.ivy.core.module.id.{ ModuleId, ModuleRevisionId }
import org.apache.ivy.core.resolve._ import org.apache.ivy.core.resolve._
import org.apache.ivy.core.settings.IvySettings import org.apache.ivy.core.settings.IvySettings
import org.apache.ivy.core.sort.SortEngine import org.apache.ivy.core.sort.SortEngine
import org.apache.ivy.plugins.latest.{ LatestStrategy, LatestRevisionStrategy, ArtifactInfo }
import org.apache.ivy.plugins.matcher.PatternMatcher import org.apache.ivy.plugins.matcher.PatternMatcher
import org.apache.ivy.plugins.parser.m2.{ PomModuleDescriptorParser } import org.apache.ivy.plugins.resolver.DependencyResolver
import org.apache.ivy.plugins.resolver.{ ChainResolver, DependencyResolver, BasicResolver } import org.apache.ivy.util.{ Message, MessageLogger }
import org.apache.ivy.plugins.resolver.util.{ HasLatestStrategy, ResolvedResource }
import org.apache.ivy.plugins.version.ExactVersionMatcher
import org.apache.ivy.plugins.repository.file.{ FileResource, FileRepository => IFileRepository }
import org.apache.ivy.plugins.repository.url.URLResource
import org.apache.ivy.util.{ Message, MessageLogger, StringUtils => IvyStringUtils }
import org.apache.ivy.util.extendable.ExtendableItem import org.apache.ivy.util.extendable.ExtendableItem
import scala.xml.{ NodeSeq, Text } import scala.xml.NodeSeq
import scala.collection.mutable import scala.collection.mutable
import sbt.util.Logger import sbt.util.Logger
@ -44,12 +34,13 @@ import ivyint.{ CachedResolutionResolveEngine, CachedResolutionResolveCache, Sbt
final class IvySbt(val configuration: IvyConfiguration) { final class IvySbt(val configuration: IvyConfiguration) {
import configuration.baseDirectory import configuration.baseDirectory
/** /*
* ========== Configuration/Setup ============ * ========== Configuration/Setup ============
* This part configures the Ivy instance by first creating the logger interface to ivy, then IvySettings, and then the Ivy instance. * This part configures the Ivy instance by first creating the logger interface to ivy, then IvySettings, and then the Ivy instance.
* These are lazy so that they are loaded within the right context. This is important so that no Ivy XML configuration needs to be loaded, * These are lazy so that they are loaded within the right context. This is important so that no Ivy XML configuration needs to be loaded,
* saving some time. This is necessary because Ivy has global state (IvyContext, Message, DocumentBuilder, ...). * saving some time. This is necessary because Ivy has global state (IvyContext, Message, DocumentBuilder, ...).
*/ */
private def withDefaultLogger[T](logger: MessageLogger)(f: => T): T = private def withDefaultLogger[T](logger: MessageLogger)(f: => T): T =
{ {
def action() = def action() =
@ -119,7 +110,8 @@ final class IvySbt(val configuration: IvyConfiguration) {
private lazy val ivy: Ivy = mkIvy private lazy val ivy: Ivy = mkIvy
// Must be the same file as is used in Update in the launcher // Must be the same file as is used in Update in the launcher
private lazy val ivyLockFile = new File(settings.getDefaultIvyUserDir, ".sbt.ivy.lock") private lazy val ivyLockFile = new File(settings.getDefaultIvyUserDir, ".sbt.ivy.lock")
/** ========== End Configuration/Setup ============*/
// ========== End Configuration/Setup ============
/** Uses the configured Ivy instance within a safe context.*/ /** Uses the configured Ivy instance within a safe context.*/
def withIvy[T](log: Logger)(f: Ivy => T): T = def withIvy[T](log: Logger)(f: Ivy => T): T =
@ -269,7 +261,7 @@ private[sbt] object IvySbt {
settings.addResolver(chain) settings.addResolver(chain)
chain chain
} }
val otherChain = makeChain("Other", "sbt-other", other) makeChain("Other", "sbt-other", other)
val mainChain = makeChain("Default", "sbt-chain", resolvers) val mainChain = makeChain("Default", "sbt-chain", resolvers)
settings.setDefaultResolver(mainChain.getName) settings.setDefaultResolver(mainChain.getName)
} }
@ -461,15 +453,6 @@ private[sbt] object IvySbt {
if (map.isEmpty) null else scala.collection.JavaConversions.mapAsJavaMap(map) if (map.isEmpty) null else scala.collection.JavaConversions.mapAsJavaMap(map)
} }
private object javaMap {
import java.util.{ HashMap, Map }
def apply[K, V](pairs: (K, V)*): Map[K, V] =
{
val map = new HashMap[K, V]
pairs.foreach { case (key, value) => map.put(key, value) }
map
}
}
/** Creates a full ivy file for 'module' using the 'dependencies' XML as the part after the &lt;info&gt;...&lt;/info&gt; section. */ /** Creates a full ivy file for 'module' using the 'dependencies' XML as the part after the &lt;info&gt;...&lt;/info&gt; section. */
private def wrapped(module: ModuleID, dependencies: NodeSeq) = private def wrapped(module: ModuleID, dependencies: NodeSeq) =
{ {
@ -608,7 +591,7 @@ private[sbt] object IvySbt {
parser.parseDepsConfs(confs, dependencyDescriptor) parser.parseDepsConfs(confs, dependencyDescriptor)
} }
for (artifact <- dependency.explicitArtifacts) { for (artifact <- dependency.explicitArtifacts) {
import artifact.{ name, classifier, `type`, extension, url } import artifact.{ name, `type`, extension, url }
val extraMap = extra(artifact) val extraMap = extra(artifact)
val ivyArtifact = new DefaultDependencyArtifactDescriptor(dependencyDescriptor, name, `type`, extension, url.orNull, extraMap) val ivyArtifact = new DefaultDependencyArtifactDescriptor(dependencyDescriptor, name, `type`, extension, url.orNull, extraMap)
copyConfigurations(artifact, ivyArtifact.addConfiguration) copyConfigurations(artifact, ivyArtifact.addConfiguration)

View File

@ -4,7 +4,6 @@
package sbt.internal.librarymanagement package sbt.internal.librarymanagement
import java.io.File import java.io.File
import java.net.URL
import org.apache.ivy.core.cache.{ ArtifactOrigin, CacheDownloadOptions, DefaultRepositoryCacheManager } import org.apache.ivy.core.cache.{ ArtifactOrigin, CacheDownloadOptions, DefaultRepositoryCacheManager }
import org.apache.ivy.core.module.descriptor.{ Artifact => IvyArtifact, DefaultArtifact } import org.apache.ivy.core.module.descriptor.{ Artifact => IvyArtifact, DefaultArtifact }
@ -69,7 +68,7 @@ class IvyCache(val ivyHome: Option[File]) {
/** Calls the given function with the default Ivy cache.*/ /** Calls the given function with the default Ivy cache.*/
def withDefaultCache[T](lock: Option[xsbti.GlobalLock], log: Logger)(f: DefaultRepositoryCacheManager => T): T = def withDefaultCache[T](lock: Option[xsbti.GlobalLock], log: Logger)(f: DefaultRepositoryCacheManager => T): T =
{ {
val (ivy, local) = basicLocalIvy(lock, log) val (ivy, _) = basicLocalIvy(lock, log)
ivy.withIvy(log) { ivy => ivy.withIvy(log) { ivy =>
val cache = ivy.getSettings.getDefaultRepositoryCacheManager.asInstanceOf[DefaultRepositoryCacheManager] val cache = ivy.getSettings.getDefaultRepositoryCacheManager.asInstanceOf[DefaultRepositoryCacheManager]
cache.setUseOrigin(false) cache.setUseOrigin(false)

View File

@ -4,7 +4,7 @@
package sbt.internal.librarymanagement package sbt.internal.librarymanagement
import java.io.File import java.io.File
import java.net.{ URI, URL } import java.net.URI
import scala.xml.NodeSeq import scala.xml.NodeSeq
import sbt.util.Logger import sbt.util.Logger
import sbt.librarymanagement._ import sbt.librarymanagement._

View File

@ -5,7 +5,6 @@ package sbt.internal.librarymanagement
import org.apache.ivy.util.{ Message, MessageLogger, MessageLoggerEngine } import org.apache.ivy.util.{ Message, MessageLogger, MessageLoggerEngine }
import sbt.util.Logger import sbt.util.Logger
import sbt.librarymanagement._
/** Interface to Ivy logging. */ /** Interface to Ivy logging. */
private final class IvyLoggerInterface(logger: Logger) extends MessageLogger { private final class IvyLoggerInterface(logger: Logger) extends MessageLogger {
@ -52,4 +51,4 @@ private final class SbtMessageLoggerEngine extends MessageLoggerEngine {
private object SbtIvyLogger { private object SbtIvyLogger {
val UnknownResolver = "unknown resolver" val UnknownResolver = "unknown resolver"
def acceptError(msg: String) = (msg ne null) && !msg.startsWith(UnknownResolver) def acceptError(msg: String) = (msg ne null) && !msg.startsWith(UnknownResolver)
} }

View File

@ -6,7 +6,6 @@ package sbt.internal.librarymanagement
import java.io.File import java.io.File
import java.{ util => ju } import java.{ util => ju }
import collection.mutable import collection.mutable
import java.net.URL
import org.apache.ivy.core.{ module, report, resolve } import org.apache.ivy.core.{ module, report, resolve }
import module.descriptor.{ Artifact => IvyArtifact, License => IvyLicense } import module.descriptor.{ Artifact => IvyArtifact, License => IvyLicense }
import module.id.{ ModuleRevisionId, ModuleId => IvyModuleId } import module.id.{ ModuleRevisionId, ModuleId => IvyModuleId }
@ -52,7 +51,6 @@ object IvyRetrieve {
// only the revolved modules. // only the revolved modules.
// Sometimes the entire module can be excluded via rules etc. // Sometimes the entire module can be excluded via rules etc.
private[sbt] def organizationArtifactReports(confReport: ConfigurationResolveReport): Seq[OrganizationArtifactReport] = { private[sbt] def organizationArtifactReports(confReport: ConfigurationResolveReport): Seq[OrganizationArtifactReport] = {
val dependencies = confReport.getModuleRevisionIds.toArray.toVector collect { case revId: ModuleRevisionId => revId }
val moduleIds = confReport.getModuleIds.toArray.toVector collect { case mId: IvyModuleId => mId } val moduleIds = confReport.getModuleIds.toArray.toVector collect { case mId: IvyModuleId => mId }
def organizationArtifact(mid: IvyModuleId): OrganizationArtifactReport = { def organizationArtifact(mid: IvyModuleId): OrganizationArtifactReport = {
val deps = confReport.getNodes(mid).toArray.toVector collect { case node: IvyNode => node } val deps = confReport.getNodes(mid).toArray.toVector collect { case node: IvyNode => node }

View File

@ -1,11 +1,9 @@
package sbt.internal.librarymanagement package sbt.internal.librarymanagement
import java.io.File import java.io.File
import java.net.URL
import org.apache.ivy.core import org.apache.ivy.core
import core.module.descriptor.ModuleDescriptor import core.module.descriptor.ModuleDescriptor
import sbt.serialization._ import sbt.serialization._
import java.net.{ URLEncoder, URLDecoder }
import sbt.util.Logger import sbt.util.Logger
import sbt.librarymanagement._ import sbt.librarymanagement._

View File

@ -369,7 +369,6 @@ class MakePom(val log: Logger) {
def makeRepositories(settings: IvySettings, includeAll: Boolean, filterRepositories: MavenRepository => Boolean) = def makeRepositories(settings: IvySettings, includeAll: Boolean, filterRepositories: MavenRepository => Boolean) =
{ {
class MavenRepo(name: String, snapshots: Boolean, releases: Boolean)
val repositories = if (includeAll) allResolvers(settings) else resolvers(settings.getDefaultResolver) val repositories = if (includeAll) allResolvers(settings) else resolvers(settings.getDefaultResolver)
val mavenRepositories = val mavenRepositories =
repositories.flatMap { repositories.flatMap {

View File

@ -7,15 +7,14 @@ import java.io.File
import java.util.Date import java.util.Date
import org.apache.ivy.core.{ cache, module, report, resolve, search } import org.apache.ivy.core.{ cache, module, report, resolve, search }
import cache.{ ArtifactOrigin, RepositoryCacheManager } import cache.ArtifactOrigin
import search.{ ModuleEntry, OrganisationEntry, RevisionEntry } import search.{ ModuleEntry, OrganisationEntry, RevisionEntry }
import module.id.ModuleRevisionId import module.id.ModuleRevisionId
import module.descriptor.{ Artifact => IArtifact, DefaultArtifact, DependencyDescriptor, ModuleDescriptor } import module.descriptor.{ Artifact => IArtifact, DefaultArtifact, DependencyDescriptor, ModuleDescriptor }
import org.apache.ivy.plugins.namespace.Namespace import org.apache.ivy.plugins.namespace.Namespace
import org.apache.ivy.plugins.resolver.{ DependencyResolver, ResolverSettings } import org.apache.ivy.plugins.resolver.ResolverSettings
import report.{ ArtifactDownloadReport, DownloadReport, DownloadStatus, MetadataArtifactDownloadReport } import report.{ ArtifactDownloadReport, DownloadReport, DownloadStatus, MetadataArtifactDownloadReport }
import resolve.{ DownloadOptions, ResolveData, ResolvedModuleRevision } import resolve.{ DownloadOptions, ResolveData, ResolvedModuleRevision }
import sbt.librarymanagement._
/** /**
* A Resolver that uses a predefined mapping from module ids to in-memory descriptors. * A Resolver that uses a predefined mapping from module ids to in-memory descriptors.

View File

@ -1,13 +1,11 @@
package sbt.internal.librarymanagement package sbt.internal.librarymanagement
import java.io.File import java.io.File
import java.io.FileInputStream
import java.util.Properties
import org.apache.ivy.core import org.apache.ivy.core
import org.apache.ivy.plugins.parser import org.apache.ivy.plugins.parser
import core.IvyPatternHelper import core.IvyPatternHelper
import core.settings.IvySettings import core.settings.IvySettings
import core.cache.{ CacheMetadataOptions, DefaultRepositoryCacheManager, DefaultResolutionCacheManager, ResolutionCacheManager } import core.cache.ResolutionCacheManager
import core.module.id.ModuleRevisionId import core.module.id.ModuleRevisionId
import core.module.descriptor.ModuleDescriptor import core.module.descriptor.ModuleDescriptor
import ResolutionCache.{ Name, ReportDirectory, ResolvedName, ResolvedPattern } import ResolutionCache.{ Name, ReportDirectory, ResolvedName, ResolvedPattern }
@ -78,9 +76,6 @@ private[sbt] object ResolutionCache {
private val ReportDirectory = "reports" private val ReportDirectory = "reports"
// name of the file providing a dependency resolution report for a configuration
private val ReportFileName = "report.xml"
// base name (name except for extension) of resolution report file // base name (name except for extension) of resolution report file
private val ResolvedName = "resolved.xml" private val ResolvedName = "resolved.xml"

View File

@ -3,7 +3,6 @@ package internal
package librarymanagement package librarymanagement
import java.io.File import java.io.File
import java.net.URL
import sbt.librarymanagement._ import sbt.librarymanagement._
/** Provides extra methods for filtering the contents of an `UpdateReport` and for obtaining references to a selected subset of the underlying files. */ /** Provides extra methods for filtering the contents of an `UpdateReport` and for obtaining references to a selected subset of the underlying files. */

View File

@ -29,17 +29,11 @@ final class GroupID private[sbt] (private[sbt] val groupID: String) {
def %(artifactID: String) = groupArtifact(artifactID, CrossVersion.Disabled) def %(artifactID: String) = groupArtifact(artifactID, CrossVersion.Disabled)
def %%(artifactID: String): GroupArtifactID = groupArtifact(artifactID, CrossVersion.binary) def %%(artifactID: String): GroupArtifactID = groupArtifact(artifactID, CrossVersion.binary)
@deprecated(deprecationMessage, "0.12.0")
def %%(artifactID: String, crossVersion: String => String) = groupArtifact(artifactID, CrossVersion.binaryMapped(crossVersion))
@deprecated(deprecationMessage, "0.12.0")
def %%(artifactID: String, alternatives: (String, String)*) = groupArtifact(artifactID, CrossVersion.binaryMapped(Map(alternatives: _*) orElse { case s => s }))
private def groupArtifact(artifactID: String, cross: CrossVersion) = private def groupArtifact(artifactID: String, cross: CrossVersion) =
{ {
nonEmpty(artifactID, "Artifact ID") nonEmpty(artifactID, "Artifact ID")
new GroupArtifactID(groupID, artifactID, cross) new GroupArtifactID(groupID, artifactID, cross)
} }
private[this] def deprecationMessage = """Use the cross method on the constructed ModuleID. For example: ("a" % "b" % "1").cross(...)"""
} }
final class GroupArtifactID private[sbt] ( final class GroupArtifactID private[sbt] (
private[sbt] val groupID: String, private[sbt] val groupID: String,

View File

@ -2,7 +2,6 @@ package sbt.internal.librarymanagement
package ivyint package ivyint
import java.util.Date import java.util.Date
import java.net.URL
import java.io.File import java.io.File
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import collection.concurrent import collection.concurrent
@ -12,19 +11,18 @@ import org.apache.ivy.Ivy
import org.apache.ivy.core import org.apache.ivy.core
import core.resolve._ import core.resolve._
import core.module.id.{ ModuleRevisionId, ModuleId => IvyModuleId } import core.module.id.{ ModuleRevisionId, ModuleId => IvyModuleId }
import core.report.{ ResolveReport, ConfigurationResolveReport, DownloadReport } import core.report.ResolveReport
import core.module.descriptor.{ DefaultModuleDescriptor, ModuleDescriptor, DefaultDependencyDescriptor, DependencyDescriptor, Configuration => IvyConfiguration, ExcludeRule, IncludeRule } import core.module.descriptor.{ DefaultModuleDescriptor, ModuleDescriptor, DefaultDependencyDescriptor, DependencyDescriptor, Configuration => IvyConfiguration, ExcludeRule, IncludeRule }
import core.module.descriptor.{ OverrideDependencyDescriptorMediator, DependencyArtifactDescriptor, DefaultDependencyArtifactDescriptor } import core.module.descriptor.{ OverrideDependencyDescriptorMediator, DependencyArtifactDescriptor }
import core.{ IvyPatternHelper, LogOptions } import core.IvyPatternHelper
import org.apache.ivy.util.{ Message, MessageLogger } import org.apache.ivy.util.{ Message, MessageLogger }
import org.apache.ivy.plugins.latest.{ ArtifactInfo => IvyArtifactInfo } import org.apache.ivy.plugins.latest.{ ArtifactInfo => IvyArtifactInfo }
import org.apache.ivy.plugins.matcher.{ MapMatcher, PatternMatcher } import org.apache.ivy.plugins.matcher.{ MapMatcher, PatternMatcher }
import annotation.tailrec import annotation.tailrec
import scala.concurrent.duration._ import scala.concurrent.duration._
import sbt.io.{ DirectoryFilter, Hash, IO, Path } import sbt.io.{ DirectoryFilter, Hash, IO }
import sbt.util.Logger import sbt.util.Logger
import sbt.librarymanagement._ import sbt.librarymanagement._
import Configurations.{ System => _, _ }
import sbt.internal.librarymanagement.syntax._ import sbt.internal.librarymanagement.syntax._
private[sbt] object CachedResolutionResolveCache { private[sbt] object CachedResolutionResolveCache {
@ -254,8 +252,6 @@ private[sbt] trait ArtificialModuleDescriptor { self: DefaultModuleDescriptor =>
} }
private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine { private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
import CachedResolutionResolveCache._
private[sbt] def cachedResolutionResolveCache: CachedResolutionResolveCache private[sbt] def cachedResolutionResolveCache: CachedResolutionResolveCache
private[sbt] def projectResolver: Option[ProjectResolver] private[sbt] def projectResolver: Option[ProjectResolver]
private[sbt] def makeInstance: Ivy private[sbt] def makeInstance: Ivy
@ -313,7 +309,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
def doWorkUsingIvy(md: ModuleDescriptor): Either[ResolveException, UpdateReport] = def doWorkUsingIvy(md: ModuleDescriptor): Either[ResolveException, UpdateReport] =
{ {
val options1 = new ResolveOptions(options0) val options1 = new ResolveOptions(options0)
var rr = withIvy(log) { ivy => val rr = withIvy(log) { ivy =>
ivy.resolve(md, options1) ivy.resolve(md, options1)
} }
if (!rr.hasError || missingOk) Right(IvyRetrieve.updateReport(rr, cachedDescriptor)) if (!rr.hasError || missingOk) Right(IvyRetrieve.updateReport(rr, cachedDescriptor))
@ -718,7 +714,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
val (surviving, evicted) = cache.getOrElseUpdateConflict(cf0, cf1, conflicts) { doResolveConflict } val (surviving, evicted) = cache.getOrElseUpdateConflict(cf0, cf1, conflicts) { doResolveConflict }
(surviving, evicted) (surviving, evicted)
} else { } else {
val (surviving, evicted, mgr) = doResolveConflict val (surviving, evicted, _) = doResolveConflict
(surviving, evicted) (surviving, evicted)
} }
} }

View File

@ -1,17 +1,10 @@
package sbt.internal.librarymanagement package sbt.internal.librarymanagement
package ivyint package ivyint
import java.io.File import org.apache.ivy.core
import java.net.URI
import java.util.{ Collection, Collections => CS }
import CS.singleton
import org.apache.ivy.{ core, plugins, util, Ivy }
import core.module.descriptor.{ DependencyArtifactDescriptor, DefaultDependencyArtifactDescriptor } import core.module.descriptor.{ DependencyArtifactDescriptor, DefaultDependencyArtifactDescriptor }
import core.module.descriptor.{ DefaultDependencyDescriptor => DDD, DependencyDescriptor } import core.module.descriptor.DependencyDescriptor
import core.module.id.{ ArtifactId, ModuleId, ModuleRevisionId } import core.module.id.{ ArtifactId, ModuleRevisionId }
import plugins.namespace.Namespace
import util.extendable.ExtendableItem
private[sbt] object MergeDescriptors { private[sbt] object MergeDescriptors {
def mergeable(a: DependencyDescriptor, b: DependencyDescriptor): Boolean = def mergeable(a: DependencyDescriptor, b: DependencyDescriptor): Boolean =

View File

@ -11,7 +11,7 @@ final case class Artifact(name: String, `type`: String, extension: String, class
def extra(attributes: (String, String)*) = copy(extraAttributes = extraAttributes ++ ModuleID.checkE(attributes)) def extra(attributes: (String, String)*) = copy(extraAttributes = extraAttributes ++ ModuleID.checkE(attributes))
} }
import Configurations.{ config, Optional, Pom, Test } import Configurations.{ Optional, Pom, Test }
object Artifact { object Artifact {
def apply(name: String): Artifact = Artifact(name, DefaultType, DefaultExtension, None, Nil, None) def apply(name: String): Artifact = Artifact(name, DefaultType, DefaultExtension, None, Nil, None)

View File

@ -1,6 +1,5 @@
package sbt.librarymanagement package sbt.librarymanagement
import sbt.internal.librarymanagement.DependencyFilter._
import sbt.util.{ Logger, Level } import sbt.util.{ Logger, Level }
/** /**
@ -13,7 +12,6 @@ final case class ConflictWarning(label: String, level: Level.Value, failOnConfli
object ConflictWarning { object ConflictWarning {
def disable: ConflictWarning = ConflictWarning("", Level.Debug, false) def disable: ConflictWarning = ConflictWarning("", Level.Debug, false)
private def org = (_: ModuleID).organization
private[this] def idString(org: String, name: String) = s"$org:$name" private[this] def idString(org: String, name: String) = s"$org:$name"
def default(label: String): ConflictWarning = ConflictWarning(label, Level.Error, true) def default(label: String): ConflictWarning = ConflictWarning(label, Level.Error, true)

View File

@ -3,11 +3,7 @@
*/ */
package sbt.librarymanagement package sbt.librarymanagement
import java.io.File import java.net.URL
import java.net.{ URI, URL }
import scala.xml.NodeSeq
import org.apache.ivy.plugins.resolver.{ DependencyResolver, IBiblioResolver }
import org.apache.ivy.util.url.CredentialsStore
import org.apache.ivy.core.module.descriptor import org.apache.ivy.core.module.descriptor
import org.apache.ivy.util.filter.{ Filter => IvyFilter } import org.apache.ivy.util.filter.{ Filter => IvyFilter }
import sbt.serialization._ import sbt.serialization._

View File

@ -5,7 +5,7 @@ package sbt.librarymanagement
import java.io.{ IOException, File } import java.io.{ IOException, File }
import java.net.URL import java.net.URL
import scala.xml.{ Text, NodeSeq, Elem, XML } import scala.xml.XML
import org.apache.ivy.plugins.resolver.DependencyResolver import org.apache.ivy.plugins.resolver.DependencyResolver
import org.xml.sax.SAXParseException import org.xml.sax.SAXParseException

View File

@ -1,6 +1,5 @@
package sbt.librarymanagement package sbt.librarymanagement
import java.io.File
import org.apache.ivy.plugins.resolver.DependencyResolver import org.apache.ivy.plugins.resolver.DependencyResolver
import org.apache.ivy.core.settings.IvySettings import org.apache.ivy.core.settings.IvySettings
import sbt.util.Logger import sbt.util.Logger
@ -23,7 +22,7 @@ final class UpdateOptions private[sbt] (
val consolidatedResolution: Boolean, val consolidatedResolution: Boolean,
// If set to true, use cached resolution. // If set to true, use cached resolution.
val cachedResolution: Boolean, val cachedResolution: Boolean,
// Extention point for an alternative resolver converter. // Extension point for an alternative resolver converter.
val resolverConverter: UpdateOptions.ResolverConverter val resolverConverter: UpdateOptions.ResolverConverter
) { ) {
def withCircularDependencyLevel(circularDependencyLevel: CircularDependencyLevel): UpdateOptions = def withCircularDependencyLevel(circularDependencyLevel: CircularDependencyLevel): UpdateOptions =

View File

@ -4,10 +4,8 @@
package sbt.librarymanagement package sbt.librarymanagement
import java.io.File import java.io.File
import java.net.URL
import java.{ util => ju } import java.{ util => ju }
import sbt.serialization._ import sbt.serialization._
import sbt.internal.librarymanagement.{ DependencyFilter, ConfigurationFilter, ModuleFilter, ArtifactFilter }
/** /**
* Provides information about resolution of a single configuration. * Provides information about resolution of a single configuration.

View File

@ -2,7 +2,6 @@ import sbt._
import Keys._ import Keys._
object Dependencies { object Dependencies {
lazy val scala210 = "2.10.6"
lazy val scala211 = "2.11.8" lazy val scala211 = "2.11.8"
val ioVersion = "1.0.0-M6" val ioVersion = "1.0.0-M6"

View File

@ -1,36 +0,0 @@
lazy val check = taskKey[Unit]("Runs the check")
def commonSettings: Seq[Def.Setting[_]] =
Seq(
ivyPaths := new IvyPaths( (baseDirectory in ThisBuild).value, Some((target in LocalRootProject).value / "ivy-cache")),
scalaVersion in ThisBuild := "2.11.7",
organization in ThisBuild := "com.example",
version in ThisBuild := "0.1.0-SNAPSHOT",
autoScalaLibrary := false,
crossPaths := false
)
lazy val realCommonsIoClient = project.
settings(
commonSettings,
name := "a",
libraryDependencies := Seq(
"commons-io" % "commons-io" % "1.3"
),
fullResolvers := fullResolvers.value.filterNot(_.name == "inter-project")
)
lazy val fakeCommonsIo = project.
settings(
commonSettings,
organization := "commons-io",
name := "commons-io",
version := "1.3"
)
lazy val fakeCommonsIoClient = project.
dependsOn(fakeCommonsIo % "test->test").
settings(
commonSettings,
name := "c"
)

View File

@ -1,3 +0,0 @@
> realCommonsIoClient/update
> fakeCommonsIoClient/update