Update to latest sbt-houserules, formatting

This commit is contained in:
Martin Duhem 2015-09-16 14:57:00 +02:00
parent 8bf3873d3b
commit 699dcfdee5
24 changed files with 221 additions and 121 deletions

View File

@ -1,5 +1,6 @@
import Dependencies._ import Dependencies._
def baseVersion = "0.1.0"
def internalPath = file("internal") def internalPath = file("internal")
def commonSettings: Seq[Setting[_]] = Seq( def commonSettings: Seq[Setting[_]] = Seq(
@ -40,7 +41,6 @@ lazy val root = (project in file(".")).
settings( settings(
inThisBuild(Seq( inThisBuild(Seq(
organization := "org.scala-sbt", organization := "org.scala-sbt",
version := "0.1.0-SNAPSHOT",
homepage := Some(url("https://github.com/sbt/librarymanagement")), homepage := Some(url("https://github.com/sbt/librarymanagement")),
description := "Library management module for sbt", description := "Library management module for sbt",
licenses := List("BSD New" -> url("https://github.com/sbt/sbt/blob/0.13/LICENSE")), licenses := List("BSD New" -> url("https://github.com/sbt/sbt/blob/0.13/LICENSE")),
@ -54,7 +54,8 @@ lazy val root = (project in file(".")).
bintrayReleaseOnPublish := false, bintrayReleaseOnPublish := false,
bintrayOrganization := Some("sbt"), bintrayOrganization := Some("sbt"),
bintrayRepository := "maven-releases", bintrayRepository := "maven-releases",
bintrayPackage := "librarymanagement" bintrayPackage := "librarymanagement",
git.baseVersion := baseVersion
)), )),
commonSettings, commonSettings,
name := "LM Root", name := "LM Root",

View File

@ -49,13 +49,17 @@ private[sbt] object ConvertResolver {
private val signerNameField: Option[java.lang.reflect.Field] = private val signerNameField: Option[java.lang.reflect.Field] =
reflectiveLookup(_.getDeclaredField("signerName")) reflectiveLookup(_.getDeclaredField("signerName"))
private val putChecksumMethod: Option[java.lang.reflect.Method] = private val putChecksumMethod: Option[java.lang.reflect.Method] =
reflectiveLookup(_.getDeclaredMethod("putChecksum", reflectiveLookup(_.getDeclaredMethod(
"putChecksum",
classOf[IArtifact], classOf[File], classOf[String], classOf[IArtifact], classOf[File], classOf[String],
classOf[Boolean], classOf[String])) classOf[Boolean], classOf[String]
))
private val putSignatureMethod: Option[java.lang.reflect.Method] = private val putSignatureMethod: Option[java.lang.reflect.Method] =
reflectiveLookup(_.getDeclaredMethod("putSignature", reflectiveLookup(_.getDeclaredMethod(
"putSignature",
classOf[IArtifact], classOf[File], classOf[String], classOf[IArtifact], classOf[File], classOf[String],
classOf[Boolean])) classOf[Boolean]
))
} }
/** /**
* The default behavior of ivy's overwrite flags ignores the fact that a lot of repositories * The default behavior of ivy's overwrite flags ignores the fact that a lot of repositories
@ -93,7 +97,7 @@ private[sbt] object ConvertResolver {
if (signerName != null) { if (signerName != null) {
putSignatureMethod match { putSignatureMethod match {
case None => () case None => ()
case Some(method) => method.invoke(artifact, src, dest, true: java.lang.Boolean) ; () case Some(method) => method.invoke(artifact, src, dest, true: java.lang.Boolean); ()
} }
} }
} }

View File

@ -290,11 +290,13 @@ private[sbt] object IvySbt {
val delegate = new ivyint.SbtChainResolver(name + "-delegate", mapResolvers(rest), settings, updateOptions, log) val delegate = new ivyint.SbtChainResolver(name + "-delegate", mapResolvers(rest), settings, updateOptions, log)
val prs = mapResolvers(projectResolvers) val prs = mapResolvers(projectResolvers)
// Here we construct a chain resolver which will FORCE looking at the project resolver first. // Here we construct a chain resolver which will FORCE looking at the project resolver first.
new ivyint.SbtChainResolver(name, new ivyint.SbtChainResolver(
name,
prs :+ delegate, prs :+ delegate,
settings, settings,
UpdateOptions().withLatestSnapshots(false), UpdateOptions().withLatestSnapshots(false),
log) log
)
} }
} }

View File

@ -32,7 +32,8 @@ final class UpdateConfiguration(val retrieve: Option[RetrieveConfiguration], val
private[sbt] def copy( private[sbt] def copy(
retrieve: Option[RetrieveConfiguration] = this.retrieve, retrieve: Option[RetrieveConfiguration] = this.retrieve,
missingOk: Boolean = this.missingOk, missingOk: Boolean = this.missingOk,
logging: UpdateLogging.Value = this.logging): UpdateConfiguration = logging: UpdateLogging.Value = this.logging
): UpdateConfiguration =
new UpdateConfiguration(retrieve, missingOk, logging) new UpdateConfiguration(retrieve, missingOk, logging)
} }
final class RetrieveConfiguration(val retrieveDirectory: File, val outputPattern: String, val sync: Boolean, val configurationsToRetrieve: Option[Set[Configuration]]) { final class RetrieveConfiguration(val retrieveDirectory: File, val outputPattern: String, val sync: Boolean, val configurationsToRetrieve: Option[Set[Configuration]]) {
@ -45,7 +46,8 @@ final case class GetClassifiersConfiguration(module: GetClassifiersModule, exclu
final case class GetClassifiersModule(id: ModuleID, modules: Seq[ModuleID], configurations: Seq[Configuration], classifiers: Seq[String]) final case class GetClassifiersModule(id: ModuleID, modules: Seq[ModuleID], configurations: Seq[Configuration], classifiers: Seq[String])
final class UnresolvedWarningConfiguration private[sbt] ( final class UnresolvedWarningConfiguration private[sbt] (
val modulePositions: Map[ModuleID, SourcePosition]) val modulePositions: Map[ModuleID, SourcePosition]
)
object UnresolvedWarningConfiguration { object UnresolvedWarningConfiguration {
def apply(): UnresolvedWarningConfiguration = apply(Map()) def apply(): UnresolvedWarningConfiguration = apply(Map())
def apply(modulePositions: Map[ModuleID, SourcePosition]): UnresolvedWarningConfiguration = def apply(modulePositions: Map[ModuleID, SourcePosition]): UnresolvedWarningConfiguration =
@ -380,7 +382,8 @@ object IvyActions {
final class ResolveException( final class ResolveException(
val messages: Seq[String], val messages: Seq[String],
val failed: Seq[ModuleID], val failed: Seq[ModuleID],
val failedPaths: Map[ModuleID, Seq[ModuleID]]) extends RuntimeException(messages.mkString("\n")) { val failedPaths: Map[ModuleID, Seq[ModuleID]]
) extends RuntimeException(messages.mkString("\n")) {
def this(messages: Seq[String], failed: Seq[ModuleID]) = def this(messages: Seq[String], failed: Seq[ModuleID]) =
this(messages, failed, Map(failed map { m => m -> Nil }: _*)) this(messages, failed, Map(failed map { m => m -> Nil }: _*))
} }
@ -390,7 +393,8 @@ final class ResolveException(
*/ */
final class UnresolvedWarning private[sbt] ( final class UnresolvedWarning private[sbt] (
val resolveException: ResolveException, val resolveException: ResolveException,
val failedPaths: Seq[Seq[(ModuleID, Option[SourcePosition])]]) val failedPaths: Seq[Seq[(ModuleID, Option[SourcePosition])]]
)
object UnresolvedWarning { object UnresolvedWarning {
private[sbt] def apply(err: ResolveException, config: UnresolvedWarningConfiguration): UnresolvedWarning = { private[sbt] def apply(err: ResolveException, config: UnresolvedWarningConfiguration): UnresolvedWarning = {
def modulePosition(m0: ModuleID): Option[SourcePosition] = def modulePosition(m0: ModuleID): Option[SourcePosition] =

View File

@ -21,9 +21,9 @@ sealed trait IvyConfiguration {
def updateOptions: UpdateOptions def updateOptions: UpdateOptions
} }
final class InlineIvyConfiguration(val paths: IvyPaths, val resolvers: Seq[Resolver], val otherResolvers: Seq[Resolver], final class InlineIvyConfiguration(val paths: IvyPaths, val resolvers: Seq[Resolver], val otherResolvers: Seq[Resolver],
val moduleConfigurations: Seq[ModuleConfiguration], val localOnly: Boolean, val lock: Option[xsbti.GlobalLock], val moduleConfigurations: Seq[ModuleConfiguration], val localOnly: Boolean, val lock: Option[xsbti.GlobalLock],
val checksums: Seq[String], val resolutionCacheDir: Option[File], val updateOptions: UpdateOptions, val checksums: Seq[String], val resolutionCacheDir: Option[File], val updateOptions: UpdateOptions,
val log: Logger) extends IvyConfiguration { val log: Logger) extends IvyConfiguration {
@deprecated("Use the variant that accepts resolutionCacheDir and updateOptions.", "0.13.0") @deprecated("Use the variant that accepts resolutionCacheDir and updateOptions.", "0.13.0")
def this(paths: IvyPaths, resolvers: Seq[Resolver], otherResolvers: Seq[Resolver], def this(paths: IvyPaths, resolvers: Seq[Resolver], otherResolvers: Seq[Resolver],
moduleConfigurations: Seq[ModuleConfiguration], localOnly: Boolean, lock: Option[xsbti.GlobalLock], moduleConfigurations: Seq[ModuleConfiguration], localOnly: Boolean, lock: Option[xsbti.GlobalLock],
@ -74,7 +74,7 @@ final class InlineIvyConfiguration(val paths: IvyPaths, val resolvers: Seq[Resol
} }
} }
final class ExternalIvyConfiguration(val baseDirectory: File, val uri: URI, val lock: Option[xsbti.GlobalLock], final class ExternalIvyConfiguration(val baseDirectory: File, val uri: URI, val lock: Option[xsbti.GlobalLock],
val extraResolvers: Seq[Resolver], val updateOptions: UpdateOptions, val log: Logger) extends IvyConfiguration { val extraResolvers: Seq[Resolver], val updateOptions: UpdateOptions, val log: Logger) extends IvyConfiguration {
@deprecated("Use the variant that accepts updateOptions.", "0.13.6") @deprecated("Use the variant that accepts updateOptions.", "0.13.6")
def this(baseDirectory: File, uri: URI, lock: Option[xsbti.GlobalLock], extraResolvers: Seq[Resolver], log: Logger) = def this(baseDirectory: File, uri: URI, lock: Option[xsbti.GlobalLock], extraResolvers: Seq[Resolver], log: Logger) =
this(baseDirectory, uri, lock, extraResolvers, UpdateOptions(), log) this(baseDirectory, uri, lock, extraResolvers, UpdateOptions(), log)
@ -139,23 +139,26 @@ object InlineConfiguration {
explicitConfigurations explicitConfigurations
} }
final class InlineConfigurationWithExcludes private[sbt] (val module: ModuleID, final class InlineConfigurationWithExcludes private[sbt] (
val moduleInfo: ModuleInfo, val module: ModuleID,
val dependencies: Seq[ModuleID], val moduleInfo: ModuleInfo,
val overrides: Set[ModuleID], val dependencies: Seq[ModuleID],
val excludes: Seq[SbtExclusionRule], val overrides: Set[ModuleID],
val ivyXML: NodeSeq, val excludes: Seq[SbtExclusionRule],
val configurations: Seq[Configuration], val ivyXML: NodeSeq,
val defaultConfiguration: Option[Configuration], val configurations: Seq[Configuration],
val ivyScala: Option[IvyScala], val defaultConfiguration: Option[Configuration],
val validate: Boolean, val ivyScala: Option[IvyScala],
val conflictManager: ConflictManager) extends ModuleSettings { val validate: Boolean,
val conflictManager: ConflictManager
) extends ModuleSettings {
def withConfigurations(configurations: Seq[Configuration]) = copy(configurations = configurations) def withConfigurations(configurations: Seq[Configuration]) = copy(configurations = configurations)
def noScala = copy(ivyScala = None) def noScala = copy(ivyScala = None)
def withOverrides(overrides: Set[ModuleID]): ModuleSettings = def withOverrides(overrides: Set[ModuleID]): ModuleSettings =
copy(overrides = overrides) copy(overrides = overrides)
private[sbt] def copy(module: ModuleID = this.module, private[sbt] def copy(
module: ModuleID = this.module,
moduleInfo: ModuleInfo = this.moduleInfo, moduleInfo: ModuleInfo = this.moduleInfo,
dependencies: Seq[ModuleID] = this.dependencies, dependencies: Seq[ModuleID] = this.dependencies,
overrides: Set[ModuleID] = this.overrides, overrides: Set[ModuleID] = this.overrides,
@ -165,7 +168,8 @@ final class InlineConfigurationWithExcludes private[sbt] (val module: ModuleID,
defaultConfiguration: Option[Configuration] = this.defaultConfiguration, defaultConfiguration: Option[Configuration] = this.defaultConfiguration,
ivyScala: Option[IvyScala] = this.ivyScala, ivyScala: Option[IvyScala] = this.ivyScala,
validate: Boolean = this.validate, validate: Boolean = this.validate,
conflictManager: ConflictManager = this.conflictManager): InlineConfigurationWithExcludes = conflictManager: ConflictManager = this.conflictManager
): InlineConfigurationWithExcludes =
InlineConfigurationWithExcludes(module, moduleInfo, dependencies, overrides, excludes, ivyXML, InlineConfigurationWithExcludes(module, moduleInfo, dependencies, overrides, excludes, ivyXML,
configurations, defaultConfiguration, ivyScala, validate, conflictManager) configurations, defaultConfiguration, ivyScala, validate, conflictManager)
@ -206,7 +210,8 @@ final class InlineConfigurationWithExcludes private[sbt] (val module: ModuleID,
} }
} }
object InlineConfigurationWithExcludes { object InlineConfigurationWithExcludes {
def apply(module: ModuleID, def apply(
module: ModuleID,
moduleInfo: ModuleInfo, moduleInfo: ModuleInfo,
dependencies: Seq[ModuleID], dependencies: Seq[ModuleID],
overrides: Set[ModuleID] = Set.empty, overrides: Set[ModuleID] = Set.empty,
@ -216,7 +221,8 @@ object InlineConfigurationWithExcludes {
defaultConfiguration: Option[Configuration] = None, defaultConfiguration: Option[Configuration] = None,
ivyScala: Option[IvyScala] = None, ivyScala: Option[IvyScala] = None,
validate: Boolean = false, validate: Boolean = false,
conflictManager: ConflictManager = ConflictManager.default): InlineConfigurationWithExcludes = conflictManager: ConflictManager = ConflictManager.default
): InlineConfigurationWithExcludes =
new InlineConfigurationWithExcludes(module, moduleInfo, dependencies, overrides, excludes, ivyXML, new InlineConfigurationWithExcludes(module, moduleInfo, dependencies, overrides, excludes, ivyXML,
configurations, defaultConfiguration, ivyScala, validate, conflictManager) configurations, defaultConfiguration, ivyScala, validate, conflictManager)

View File

@ -93,10 +93,12 @@ object IvyRetrieve {
val branch = nonEmptyString(revId.getBranch) val branch = nonEmptyString(revId.getBranch)
val (status, publicationDate, resolver, artifactResolver) = dep.isLoaded match { val (status, publicationDate, resolver, artifactResolver) = dep.isLoaded match {
case true => case true =>
(nonEmptyString(dep.getDescriptor.getStatus), (
nonEmptyString(dep.getDescriptor.getStatus),
Some(new ju.Date(dep.getPublication)), Some(new ju.Date(dep.getPublication)),
nonEmptyString(dep.getModuleRevision.getResolver.getName), nonEmptyString(dep.getModuleRevision.getResolver.getName),
nonEmptyString(dep.getModuleRevision.getArtifactResolver.getName)) nonEmptyString(dep.getModuleRevision.getArtifactResolver.getName)
)
case _ => (None, None, None, None) case _ => (None, None, None, None)
} }
val (evicted, evictedData, evictedReason) = dep.isEvicted(confReport.getConfiguration) match { val (evicted, evictedData, evictedReason) = dep.isEvicted(confReport.getConfiguration) match {

View File

@ -39,7 +39,8 @@ private[sbt] object JsonUtil {
mr.evicted, mr.evictedData, mr.evictedReason, mr.evicted, mr.evictedData, mr.evictedReason,
mr.problem, mr.homepage, mr.extraAttributes, mr.problem, mr.homepage, mr.extraAttributes,
mr.isDefault, mr.branch, mr.configurations, mr.licenses, mr.isDefault, mr.branch, mr.configurations, mr.licenses,
filterOutArtificialCallers(mr.callers)) filterOutArtificialCallers(mr.callers)
)
}) })
}) })
}) })

View File

@ -244,7 +244,8 @@ class MakePom(val log: Logger) {
log.warn( log.warn(
s"""Translating intransitive dependency (${dependency.getDependencyId}) into pom.xml, but maven does not support intransitive dependencies. s"""Translating intransitive dependency (${dependency.getDependencyId}) into pom.xml, but maven does not support intransitive dependencies.
| Please use exclusions instead so transitive dependencies will be correctly excluded in dependent projects. | Please use exclusions instead so transitive dependencies will be correctly excluded in dependent projects.
""".stripMargin) """.stripMargin
)
else () else ()
val artifacts = dependency.getAllDependencyArtifacts val artifacts = dependency.getAllDependencyArtifacts
val includeArtifacts = artifacts.filter(d => includeTypes(d.getType)) val includeArtifacts = artifacts.filter(d => includeTypes(d.getType))
@ -372,7 +373,8 @@ class MakePom(val log: Logger) {
<exclusion> <exclusion>
<groupId>{ g }</groupId> <groupId>{ g }</groupId>
<artifactId>{ a }</artifactId> <artifactId>{ a }</artifactId>
</exclusion>) </exclusion>
)
} }
def makeRepositories(settings: IvySettings, includeAll: Boolean, filterRepositories: MavenRepository => Boolean) = def makeRepositories(settings: IvySettings, includeAll: Boolean, filterRepositories: MavenRepository => Boolean) =

View File

@ -8,18 +8,23 @@ final class SbtExclusionRule(
val name: String, val name: String,
val artifact: String, val artifact: String,
val configurations: Seq[String], val configurations: Seq[String],
val crossVersion: CrossVersion) { val crossVersion: CrossVersion
) {
def copy(organization: String = this.organization, def copy(
organization: String = this.organization,
name: String = this.name, name: String = this.name,
artifact: String = this.artifact, artifact: String = this.artifact,
configurations: Seq[String] = this.configurations, configurations: Seq[String] = this.configurations,
crossVersion: CrossVersion = this.crossVersion): SbtExclusionRule = crossVersion: CrossVersion = this.crossVersion
SbtExclusionRule(organization = organization, ): SbtExclusionRule =
SbtExclusionRule(
organization = organization,
name = name, name = name,
artifact = artifact, artifact = artifact,
configurations = configurations, configurations = configurations,
crossVersion = crossVersion) crossVersion = crossVersion
)
} }
object SbtExclusionRule { object SbtExclusionRule {
@ -29,11 +34,13 @@ object SbtExclusionRule {
def apply(organization: String, name: String): SbtExclusionRule = def apply(organization: String, name: String): SbtExclusionRule =
new SbtExclusionRule(organization, name, "*", Nil, CrossVersion.Disabled) new SbtExclusionRule(organization, name, "*", Nil, CrossVersion.Disabled)
def apply(organization: String, def apply(
organization: String,
name: String, name: String,
artifact: String, artifact: String,
configurations: Seq[String], configurations: Seq[String],
crossVersion: CrossVersion): SbtExclusionRule = crossVersion: CrossVersion
): SbtExclusionRule =
new SbtExclusionRule(organization, name, artifact, configurations, crossVersion) new SbtExclusionRule(organization, name, artifact, configurations, crossVersion)
implicit def groupIdToExclusionRule(organization: GroupID): SbtExclusionRule = implicit def groupIdToExclusionRule(organization: GroupID): SbtExclusionRule =

View File

@ -44,7 +44,8 @@ final class GroupID private[sbt] (private[sbt] val groupID: String) {
final class GroupArtifactID private[sbt] ( final class GroupArtifactID private[sbt] (
private[sbt] val groupID: String, private[sbt] val groupID: String,
private[sbt] val artifactID: String, private[sbt] val artifactID: String,
private[sbt] val crossVersion: CrossVersion) { private[sbt] val crossVersion: CrossVersion
) {
def %(revision: String): ModuleID = def %(revision: String): ModuleID =
{ {
nonEmpty(revision, "Revision") nonEmpty(revision, "Revision")

View File

@ -492,9 +492,11 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
breakLoops(loop) breakLoops(loop)
// sort the all modules such that less called modules comes earlier // sort the all modules such that less called modules comes earlier
@tailrec def sortModules(cs: Vector[(String, String)], @tailrec def sortModules(
cs: Vector[(String, String)],
acc: Vector[(String, String)], extra: Vector[(String, String)], acc: Vector[(String, String)], extra: Vector[(String, String)],
n: Int, guard: Int): Vector[(String, String)] = n: Int, guard: Int
): Vector[(String, String)] =
{ {
// println(s"sortModules: $n / $guard") // println(s"sortModules: $n / $guard")
val keys = cs.toSet val keys = cs.toSet
@ -522,8 +524,10 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
sortModules(cs.tail, acc, extra :+ cs.head, n + 1, guard) sortModules(cs.tail, acc, extra :+ cs.head, n + 1, guard)
} else sortModules(called, acc ++ notCalled, extra, 0, called.size * called.size + 1)) } else sortModules(called, acc ++ notCalled, extra, 0, called.size * called.size + 1))
} }
def resolveConflicts(cs: List[(String, String)], def resolveConflicts(
allModules: Map[(String, String), Vector[OrganizationArtifactReport]]): List[OrganizationArtifactReport] = cs: List[(String, String)],
allModules: Map[(String, String), Vector[OrganizationArtifactReport]]
): List[OrganizationArtifactReport] =
cs match { cs match {
case Nil => Nil case Nil => Nil
case (organization, name) :: rest => case (organization, name) :: rest =>

View File

@ -114,7 +114,8 @@ private[sbt] final class ErrorMessageAuthenticator(original: Option[Authenticato
getRequestingPort, getRequestingPort,
getRequestingProtocol, getRequestingProtocol,
getRequestingPrompt, getRequestingPrompt,
getRequestingScheme)) getRequestingScheme
))
finally Authenticator.setDefault(this) finally Authenticator.setDefault(this)
} }
originalAuthentication.orNull originalAuthentication.orNull

View File

@ -23,7 +23,8 @@ private[sbt] case class SbtChainResolver(
resolvers: Seq[DependencyResolver], resolvers: Seq[DependencyResolver],
settings: IvySettings, settings: IvySettings,
updateOptions: UpdateOptions, updateOptions: UpdateOptions,
log: Logger) extends ChainResolver { log: Logger
) extends ChainResolver {
override def equals(o: Any): Boolean = o match { override def equals(o: Any): Boolean = o match {
case o: SbtChainResolver => case o: SbtChainResolver =>
@ -139,7 +140,8 @@ private[sbt] case class SbtChainResolver(
else if (useLatest) temp map { x => else if (useLatest) temp map { x =>
(reparseModuleDescriptor(dd, data, resolver, x), resolver) (reparseModuleDescriptor(dd, data, resolver, x), resolver)
} }
else temp map { x => (forcedRevision(x), resolver) }) else temp map { x => (forcedRevision(x), resolver) }
)
} catch { } catch {
case ex: Exception => case ex: Exception =>
Message.verbose("problem occurred while resolving " + dd + " with " + resolver Message.verbose("problem occurred while resolving " + dd + " with " + resolver

View File

@ -79,7 +79,7 @@ object CrossVersion {
/** /**
* Cross-versions a module with the result of applying `remapVersion` to the full version * Cross-versions a module with the result of applying `remapVersion` to the full version
* (typically the full Scala version). See also [[sbt.CrossVersion.Full]]. * (typically the full Scala version). See also [[sbt.librarymanagement.CrossVersion.Full]].
*/ */
def fullMapped(remapVersion: String => String): CrossVersion = new Full(remapVersion) def fullMapped(remapVersion: String => String): CrossVersion = new Full(remapVersion)
@ -88,7 +88,7 @@ object CrossVersion {
/** /**
* Cross-versions a module with the result of applying `remapVersion` to the binary version * Cross-versions a module with the result of applying `remapVersion` to the binary version
* (typically the binary Scala version). See also [[sbt.CrossVersion.Binary]]. * (typically the binary Scala version). See also [[sbt.librarymanagement.CrossVersion.Binary]].
*/ */
def binaryMapped(remapVersion: String => String): CrossVersion = new Binary(remapVersion) def binaryMapped(remapVersion: String => String): CrossVersion = new Binary(remapVersion)
@ -99,7 +99,7 @@ object CrossVersion {
/** /**
* Construct a cross-versioning function given cross-versioning configuration `cross`, * Construct a cross-versioning function given cross-versioning configuration `cross`,
* full version `fullVersion` and binary version `binaryVersion`. The behavior of the * full version `fullVersion` and binary version `binaryVersion`. The behavior of the
* constructed function is as documented for the [[sbt.CrossVersion]] datatypes. * constructed function is as documented for the [[sbt.librarymanagement.CrossVersion]] datatypes.
*/ */
def apply(cross: CrossVersion, fullVersion: String, binaryVersion: String): Option[String => String] = def apply(cross: CrossVersion, fullVersion: String, binaryVersion: String): Option[String => String] =
cross match { cross match {
@ -191,13 +191,13 @@ object CrossVersion {
/** /**
* Computes the binary Scala version from the `full` version. * Computes the binary Scala version from the `full` version.
* Full Scala versions earlier than [[sbt.CrossVersion.TransitionScalaVersion]] are returned as is. * Full Scala versions earlier than [[sbt.librarymanagement.CrossVersion.TransitionScalaVersion]] are returned as is.
*/ */
def binaryScalaVersion(full: String): String = CrossVersionUtil.binaryScalaVersion(full) def binaryScalaVersion(full: String): String = CrossVersionUtil.binaryScalaVersion(full)
/** /**
* Computes the binary sbt version from the `full` version. * Computes the binary sbt version from the `full` version.
* Full sbt versions earlier than [[sbt.CrossVersion.TransitionSbtVersion]] are returned as is. * Full sbt versions earlier than [[sbt.librarymanagement.CrossVersion.TransitionSbtVersion]] are returned as is.
*/ */
def binarySbtVersion(full: String): String = CrossVersionUtil.binarySbtVersion(full) def binarySbtVersion(full: String): String = CrossVersionUtil.binarySbtVersion(full)

View File

@ -14,7 +14,8 @@ final class EvictionWarningOptions private[sbt] (
val warnTransitiveEvictions: Boolean, val warnTransitiveEvictions: Boolean,
val infoAllEvictions: Boolean, val infoAllEvictions: Boolean,
val showCallers: Boolean, val showCallers: Boolean,
val guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean]) { val guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean]
) {
private[sbt] def configStrings = configurations map { _.name } private[sbt] def configStrings = configurations map { _.name }
def withConfigurations(configurations: Seq[Configuration]): EvictionWarningOptions = def withConfigurations(configurations: Seq[Configuration]): EvictionWarningOptions =
@ -32,20 +33,24 @@ final class EvictionWarningOptions private[sbt] (
def withGuessCompatible(guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean]): EvictionWarningOptions = def withGuessCompatible(guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean]): EvictionWarningOptions =
copy(guessCompatible = guessCompatible) copy(guessCompatible = guessCompatible)
private[sbt] def copy(configurations: Seq[Configuration] = configurations, private[sbt] def copy(
configurations: Seq[Configuration] = configurations,
warnScalaVersionEviction: Boolean = warnScalaVersionEviction, warnScalaVersionEviction: Boolean = warnScalaVersionEviction,
warnDirectEvictions: Boolean = warnDirectEvictions, warnDirectEvictions: Boolean = warnDirectEvictions,
warnTransitiveEvictions: Boolean = warnTransitiveEvictions, warnTransitiveEvictions: Boolean = warnTransitiveEvictions,
infoAllEvictions: Boolean = infoAllEvictions, infoAllEvictions: Boolean = infoAllEvictions,
showCallers: Boolean = showCallers, showCallers: Boolean = showCallers,
guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean] = guessCompatible): EvictionWarningOptions = guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean] = guessCompatible
new EvictionWarningOptions(configurations = configurations, ): EvictionWarningOptions =
new EvictionWarningOptions(
configurations = configurations,
warnScalaVersionEviction = warnScalaVersionEviction, warnScalaVersionEviction = warnScalaVersionEviction,
warnDirectEvictions = warnDirectEvictions, warnDirectEvictions = warnDirectEvictions,
warnTransitiveEvictions = warnTransitiveEvictions, warnTransitiveEvictions = warnTransitiveEvictions,
infoAllEvictions = infoAllEvictions, infoAllEvictions = infoAllEvictions,
showCallers = showCallers, showCallers = showCallers,
guessCompatible = guessCompatible) guessCompatible = guessCompatible
)
} }
object EvictionWarningOptions { object EvictionWarningOptions {
@ -85,7 +90,8 @@ final class EvictionPair private[sbt] (
val winner: Option[ModuleReport], val winner: Option[ModuleReport],
val evicteds: Seq[ModuleReport], val evicteds: Seq[ModuleReport],
val includesDirect: Boolean, val includesDirect: Boolean,
val showCallers: Boolean) { val showCallers: Boolean
) {
override def toString: String = override def toString: String =
EvictionPair.evictionPairLines.showLines(this).mkString EvictionPair.evictionPairLines.showLines(this).mkString
override def equals(o: Any): Boolean = o match { override def equals(o: Any): Boolean = o match {
@ -125,7 +131,8 @@ final class EvictionWarning private[sbt] (
val scalaEvictions: Seq[EvictionPair], val scalaEvictions: Seq[EvictionPair],
val directEvictions: Seq[EvictionPair], val directEvictions: Seq[EvictionPair],
val transitiveEvictions: Seq[EvictionPair], val transitiveEvictions: Seq[EvictionPair],
val allEvictions: Seq[EvictionPair]) { val allEvictions: Seq[EvictionPair]
) {
def reportedEvictions: Seq[EvictionPair] = scalaEvictions ++ directEvictions ++ transitiveEvictions def reportedEvictions: Seq[EvictionPair] = scalaEvictions ++ directEvictions ++ transitiveEvictions
private[sbt] def infoAllTheThings: List[String] = EvictionWarning.infoAllTheThings(this) private[sbt] def infoAllTheThings: List[String] = EvictionWarning.infoAllTheThings(this)
} }

View File

@ -21,7 +21,8 @@ object ScalaArtifacts {
private[sbt] def toolDependencies(org: String, version: String): Seq[ModuleID] = Seq( private[sbt] def toolDependencies(org: String, version: String): Seq[ModuleID] = Seq(
scalaToolDependency(org, ScalaArtifacts.CompilerID, version), scalaToolDependency(org, ScalaArtifacts.CompilerID, version),
scalaToolDependency(org, ScalaArtifacts.LibraryID, version)) scalaToolDependency(org, ScalaArtifacts.LibraryID, version)
)
private[this] def scalaToolDependency(org: String, id: String, version: String): ModuleID = private[this] def scalaToolDependency(org: String, id: String, version: String): ModuleID =
ModuleID(org, id, version, Some(Configurations.ScalaTool.name + "->default,optional(default)")) ModuleID(org, id, version, Some(Configurations.ScalaTool.name + "->default,optional(default)"))
} }

View File

@ -22,18 +22,23 @@ final class UpdateOptions private[sbt] (
/** 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. */ /** Extention point for an alternative resolver converter. */
val resolverConverter: UpdateOptions.ResolverConverter) { val resolverConverter: UpdateOptions.ResolverConverter
) {
def withCircularDependencyLevel(circularDependencyLevel: CircularDependencyLevel): UpdateOptions = def withCircularDependencyLevel(circularDependencyLevel: CircularDependencyLevel): UpdateOptions =
copy(circularDependencyLevel = circularDependencyLevel) copy(circularDependencyLevel = circularDependencyLevel)
def withLatestSnapshots(latestSnapshots: Boolean): UpdateOptions = def withLatestSnapshots(latestSnapshots: Boolean): UpdateOptions =
copy(latestSnapshots = latestSnapshots) copy(latestSnapshots = latestSnapshots)
@deprecated("Use withCachedResolution instead.", "0.13.7") @deprecated("Use withCachedResolution instead.", "0.13.7")
def withConsolidatedResolution(consolidatedResolution: Boolean): UpdateOptions = def withConsolidatedResolution(consolidatedResolution: Boolean): UpdateOptions =
copy(consolidatedResolution = consolidatedResolution, copy(
cachedResolution = consolidatedResolution) consolidatedResolution = consolidatedResolution,
cachedResolution = consolidatedResolution
)
def withCachedResolution(cachedResoluton: Boolean): UpdateOptions = def withCachedResolution(cachedResoluton: Boolean): UpdateOptions =
copy(cachedResolution = cachedResoluton, copy(
consolidatedResolution = cachedResolution) cachedResolution = cachedResoluton,
consolidatedResolution = cachedResolution
)
/** Extention point for an alternative resolver converter. */ /** Extention point for an alternative resolver converter. */
def withResolverConverter(resolverConverter: UpdateOptions.ResolverConverter): UpdateOptions = def withResolverConverter(resolverConverter: UpdateOptions.ResolverConverter): UpdateOptions =
copy(resolverConverter = resolverConverter) copy(resolverConverter = resolverConverter)
@ -43,12 +48,15 @@ final class UpdateOptions private[sbt] (
latestSnapshots: Boolean = this.latestSnapshots, latestSnapshots: Boolean = this.latestSnapshots,
consolidatedResolution: Boolean = this.consolidatedResolution, consolidatedResolution: Boolean = this.consolidatedResolution,
cachedResolution: Boolean = this.cachedResolution, cachedResolution: Boolean = this.cachedResolution,
resolverConverter: UpdateOptions.ResolverConverter = this.resolverConverter): UpdateOptions = resolverConverter: UpdateOptions.ResolverConverter = this.resolverConverter
new UpdateOptions(circularDependencyLevel, ): UpdateOptions =
new UpdateOptions(
circularDependencyLevel,
latestSnapshots, latestSnapshots,
consolidatedResolution, consolidatedResolution,
cachedResolution, cachedResolution,
resolverConverter) resolverConverter
)
override def equals(o: Any): Boolean = o match { override def equals(o: Any): Boolean = o match {
case o: UpdateOptions => case o: UpdateOptions =>
@ -79,5 +87,6 @@ object UpdateOptions {
latestSnapshots = false, latestSnapshots = false,
consolidatedResolution = false, consolidatedResolution = false,
cachedResolution = false, cachedResolution = false,
resolverConverter = PartialFunction.empty) resolverConverter = PartialFunction.empty
)
} }

View File

@ -19,7 +19,8 @@ import sbt.internal.librarymanagement.{ DependencyFilter, ConfigurationFilter, M
final class ConfigurationReport( final class ConfigurationReport(
val configuration: String, val configuration: String,
val modules: Seq[ModuleReport], val modules: Seq[ModuleReport],
val details: Seq[OrganizationArtifactReport]) { val details: Seq[OrganizationArtifactReport]
) {
def evicted: Seq[ModuleID] = def evicted: Seq[ModuleID] =
details flatMap (_.modules) filter (_.evicted) map (_.module) details flatMap (_.modules) filter (_.evicted) map (_.module)
@ -56,7 +57,8 @@ object ConfigurationReport {
final class OrganizationArtifactReport private[sbt] ( final class OrganizationArtifactReport private[sbt] (
val organization: String, val organization: String,
val name: String, val name: String,
val modules: Seq[ModuleReport]) { val modules: Seq[ModuleReport]
) {
override def toString: String = { override def toString: String = {
val details = modules map { _.detailReport } val details = modules map { _.detailReport }
s"\t$organization:$name\n${details.mkString}\n" s"\t$organization:$name\n${details.mkString}\n"
@ -94,7 +96,8 @@ final class ModuleReport(
val branch: Option[String], val branch: Option[String],
val configurations: Seq[String], val configurations: Seq[String],
val licenses: Seq[(String, Option[String])], val licenses: Seq[(String, Option[String])],
val callers: Seq[Caller]) { val callers: Seq[Caller]
) {
private[this] lazy val arts: Seq[String] = artifacts.map(_.toString) ++ missingArtifacts.map(art => "(MISSING) " + art) private[this] lazy val arts: Seq[String] = artifacts.map(_.toString) ++ missingArtifacts.map(art => "(MISSING) " + art)
override def toString: String = { override def toString: String = {
@ -113,20 +116,28 @@ final class ModuleReport(
reportStr("evictedReason", evictedReason) + reportStr("evictedReason", evictedReason) +
reportStr("problem", problem) + reportStr("problem", problem) +
reportStr("homepage", homepage) + reportStr("homepage", homepage) +
reportStr("textraAttributes", reportStr(
"textraAttributes",
if (extraAttributes.isEmpty) None if (extraAttributes.isEmpty) None
else { Some(extraAttributes.toString) }) + else { Some(extraAttributes.toString) }
) +
reportStr("isDefault", isDefault map { _.toString }) + reportStr("isDefault", isDefault map { _.toString }) +
reportStr("branch", branch) + reportStr("branch", branch) +
reportStr("configurations", reportStr(
"configurations",
if (configurations.isEmpty) None if (configurations.isEmpty) None
else { Some(configurations.mkString(", ")) }) + else { Some(configurations.mkString(", ")) }
reportStr("licenses", ) +
reportStr(
"licenses",
if (licenses.isEmpty) None if (licenses.isEmpty) None
else { Some(licenses.mkString(", ")) }) + else { Some(licenses.mkString(", ")) }
reportStr("callers", ) +
reportStr(
"callers",
if (callers.isEmpty) None if (callers.isEmpty) None
else { Some(callers.mkString(", ")) }) else { Some(callers.mkString(", ")) }
)
private[sbt] def reportStr(key: String, value: Option[String]): String = private[sbt] def reportStr(key: String, value: Option[String]): String =
value map { x => s"\t\t\t$key: $x\n" } getOrElse "" value map { x => s"\t\t\t$key: $x\n" } getOrElse ""
@ -151,7 +162,8 @@ final class ModuleReport(
branch: Option[String] = branch, branch: Option[String] = branch,
configurations: Seq[String] = configurations, configurations: Seq[String] = configurations,
licenses: Seq[(String, Option[String])] = licenses, licenses: Seq[(String, Option[String])] = licenses,
callers: Seq[Caller] = callers): ModuleReport = callers: Seq[Caller] = callers
): ModuleReport =
new ModuleReport(module, artifacts, missingArtifacts, status, publicationDate, resolver, artifactResolver, new ModuleReport(module, artifacts, missingArtifacts, status, publicationDate, resolver, artifactResolver,
evicted, evictedData, evictedReason, problem, homepage, extraAttributes, isDefault, branch, configurations, licenses, callers) evicted, evictedData, evictedReason, problem, homepage, extraAttributes, isDefault, branch, configurations, licenses, callers)
} }
@ -170,7 +182,8 @@ final class Caller(
val isForceDependency: Boolean, val isForceDependency: Boolean,
val isChangingDependency: Boolean, val isChangingDependency: Boolean,
val isTransitiveDependency: Boolean, val isTransitiveDependency: Boolean,
val isDirectlyForceDependency: Boolean) { val isDirectlyForceDependency: Boolean
) {
override def toString: String = override def toString: String =
s"$caller" s"$caller"
} }
@ -207,10 +220,12 @@ final class UpdateReport(val cachedDescriptor: File, val configurations: Seq[Con
def allConfigurations: Seq[String] = configurations.map(_.configuration) def allConfigurations: Seq[String] = configurations.map(_.configuration)
private[sbt] def withStats(us: UpdateStats): UpdateReport = private[sbt] def withStats(us: UpdateStats): UpdateReport =
new UpdateReport(this.cachedDescriptor, new UpdateReport(
this.cachedDescriptor,
this.configurations, this.configurations,
us, us,
this.stamps) this.stamps
)
} }
object UpdateReport { object UpdateReport {
@ -248,14 +263,16 @@ object UpdateReport {
moduleReportMap { (configuration, modReport) => moduleReportMap { (configuration, modReport) =>
modReport.copy( modReport.copy(
artifacts = modReport.artifacts filter { case (art, file) => f(configuration, modReport.module, art) }, artifacts = modReport.artifacts filter { case (art, file) => f(configuration, modReport.module, art) },
missingArtifacts = modReport.missingArtifacts filter { art => f(configuration, modReport.module, art) }) missingArtifacts = modReport.missingArtifacts filter { art => f(configuration, modReport.module, art) }
)
} }
def substitute(f: (String, ModuleID, Seq[(Artifact, File)]) => Seq[(Artifact, File)]): UpdateReport = def substitute(f: (String, ModuleID, Seq[(Artifact, File)]) => Seq[(Artifact, File)]): UpdateReport =
moduleReportMap { (configuration, modReport) => moduleReportMap { (configuration, modReport) =>
val newArtifacts = f(configuration, modReport.module, modReport.artifacts) val newArtifacts = f(configuration, modReport.module, modReport.artifacts)
modReport.copy( modReport.copy(
artifacts = f(configuration, modReport.module, modReport.artifacts), artifacts = f(configuration, modReport.module, modReport.artifacts),
missingArtifacts = Nil) missingArtifacts = Nil
)
} }
def toSeq: Seq[(String, ModuleID, Artifact, File)] = def toSeq: Seq[(String, ModuleID, Artifact, File)] =
@ -267,7 +284,8 @@ object UpdateReport {
def addMissing(f: ModuleID => Seq[Artifact]): UpdateReport = def addMissing(f: ModuleID => Seq[Artifact]): UpdateReport =
moduleReportMap { (configuration, modReport) => moduleReportMap { (configuration, modReport) =>
modReport.copy( modReport.copy(
missingArtifacts = (modReport.missingArtifacts ++ f(modReport.module)).distinct) missingArtifacts = (modReport.missingArtifacts ++ f(modReport.module)).distinct
)
} }
def moduleReportMap(f: (String, ModuleReport) => ModuleReport): UpdateReport = def moduleReportMap(f: (String, ModuleReport) => ModuleReport): UpdateReport =
@ -338,10 +356,12 @@ object UpdateReport {
final class UpdateStats(val resolveTime: Long, val downloadTime: Long, val downloadSize: Long, val cached: Boolean) { final class UpdateStats(val resolveTime: Long, val downloadTime: Long, val downloadSize: Long, val cached: Boolean) {
override def toString = Seq("Resolve time: " + resolveTime + " ms", "Download time: " + downloadTime + " ms", "Download size: " + downloadSize + " bytes").mkString(", ") override def toString = Seq("Resolve time: " + resolveTime + " ms", "Download time: " + downloadTime + " ms", "Download size: " + downloadSize + " bytes").mkString(", ")
private[sbt] def withCached(c: Boolean): UpdateStats = private[sbt] def withCached(c: Boolean): UpdateStats =
new UpdateStats(resolveTime = this.resolveTime, new UpdateStats(
resolveTime = this.resolveTime,
downloadTime = this.downloadTime, downloadTime = this.downloadTime,
downloadSize = this.downloadSize, downloadSize = this.downloadSize,
cached = c) cached = c
)
} }
object UpdateStats { object UpdateStats {
implicit val pickler: Pickler[UpdateStats] with Unpickler[UpdateStats] = PicklerUnpickler.generate[UpdateStats] implicit val pickler: Pickler[UpdateStats] with Unpickler[UpdateStats] = PicklerUnpickler.generate[UpdateStats]

View File

@ -3,7 +3,8 @@ package sbt.librarymanagement
final class VersionNumber private[sbt] ( final class VersionNumber private[sbt] (
val numbers: Seq[Long], val numbers: Seq[Long],
val tags: Seq[String], val tags: Seq[String],
val extras: Seq[String]) { val extras: Seq[String]
) {
def _1: Option[Long] = get(0) def _1: Option[Long] = get(0)
def _2: Option[Long] = get(1) def _2: Option[Long] = get(1)
def _3: Option[Long] = get(2) def _3: Option[Long] = get(2)

View File

@ -29,7 +29,8 @@ trait BaseIvySpecification extends UnitSpec {
configurations = Nil, configurations = Nil,
checkExplicit = true, checkExplicit = true,
filterImplicit = false, filterImplicit = false,
overrideScalaVersion = false) overrideScalaVersion = false
)
} }
val moduleSetting: ModuleSettings = InlineConfiguration( val moduleSetting: ModuleSettings = InlineConfiguration(
@ -37,7 +38,8 @@ trait BaseIvySpecification extends UnitSpec {
moduleInfo = ModuleInfo("foo"), moduleInfo = ModuleInfo("foo"),
dependencies = deps, dependencies = deps,
configurations = configurations, configurations = configurations,
ivyScala = ivyScala) ivyScala = ivyScala
)
val ivySbt = new IvySbt(mkIvyConfiguration(uo)) val ivySbt = new IvySbt(mkIvyConfiguration(uo))
new ivySbt.Module(moduleSetting) new ivySbt.Module(moduleSetting)
} }
@ -81,7 +83,8 @@ trait BaseIvySpecification extends UnitSpec {
artifacts = artifacts, artifacts = artifacts,
checksums = Seq(), checksums = Seq(),
logging = UpdateLogging.Full, logging = UpdateLogging.Full,
overwrite = true) overwrite = true
)
} }
def ivyPublish(module: IvySbt#Module, config: PublishConfiguration) = { def ivyPublish(module: IvySbt#Module, config: PublishConfiguration) = {

View File

@ -8,8 +8,10 @@ class CachedResolutionSpec extends BaseIvySpecification {
"Resolving the same module twice" should "work" in { "Resolving the same module twice" should "work" in {
cleanIvyCache() cleanIvyCache()
val m = module(ModuleID("com.example", "foo", "0.1.0", Some("compile")), val m = module(
Seq(commonsIo13), Some("2.10.2"), UpdateOptions().withCachedResolution(true)) ModuleID("com.example", "foo", "0.1.0", Some("compile")),
Seq(commonsIo13), Some("2.10.2"), UpdateOptions().withCachedResolution(true)
)
val report = ivyUpdate(m) val report = ivyUpdate(m)
cleanCachedResolutionCache(m) cleanCachedResolutionCache(m)
val report2 = ivyUpdate(m) val report2 = ivyUpdate(m)
@ -22,8 +24,10 @@ class CachedResolutionSpec extends BaseIvySpecification {
"Resolving the unsolvable module should" should "not work" in { "Resolving the unsolvable module should" should "not work" in {
// log.setLevel(Level.Debug) // log.setLevel(Level.Debug)
val m = module(ModuleID("com.example", "foo", "0.2.0", Some("compile")), val m = module(
Seq(mavenCayennePlugin302), Some("2.10.2"), UpdateOptions().withCachedResolution(true)) ModuleID("com.example", "foo", "0.2.0", Some("compile")),
Seq(mavenCayennePlugin302), Some("2.10.2"), UpdateOptions().withCachedResolution(true)
)
ivyUpdateEither(m) match { ivyUpdateEither(m) match {
case Right(_) => sys.error("this should've failed") case Right(_) => sys.error("this should've failed")
case Left(uw) => case Left(uw) =>
@ -47,9 +51,11 @@ class CachedResolutionSpec extends BaseIvySpecification {
"Resolving a module with a pseudo-conflict" should "work" in { "Resolving a module with a pseudo-conflict" should "work" in {
// log.setLevel(Level.Debug) // log.setLevel(Level.Debug)
cleanIvyCache() cleanIvyCache()
val m = module(ModuleID("com.example", "foo", "0.3.0", Some("compile")), val m = module(
ModuleID("com.example", "foo", "0.3.0", Some("compile")),
Seq(avro177, dataAvro1940, netty320), Seq(avro177, dataAvro1940, netty320),
Some("2.10.2"), UpdateOptions().withCachedResolution(true)) Some("2.10.2"), UpdateOptions().withCachedResolution(true)
)
// first resolution creates the minigraph // first resolution creates the minigraph
val report0 = ivyUpdate(m) val report0 = ivyUpdate(m)
cleanCachedResolutionCache(m) cleanCachedResolutionCache(m)

View File

@ -74,21 +74,25 @@ class EvictionWarningSpec extends BaseIvySpecification {
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2")) val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).lines shouldBe EvictionWarning(m, defaultOptions, report, log).lines shouldBe
List("Scala version was updated by one of library dependencies:", List(
"Scala version was updated by one of library dependencies:",
"\t* org.scala-lang:scala-library:2.10.2 -> 2.10.3", "\t* org.scala-lang:scala-library:2.10.2 -> 2.10.3",
"To force scalaVersion, add the following:", "To force scalaVersion, add the following:",
"\tivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }", "\tivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }",
"Run 'evicted' to see detailed eviction warnings") "Run 'evicted' to see detailed eviction warnings"
)
} }
def scalaVersionWarn4() = { def scalaVersionWarn4() = {
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2")) val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines shouldBe EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines shouldBe
List("Scala version was updated by one of library dependencies:", List(
"Scala version was updated by one of library dependencies:",
"\t* org.scala-lang:scala-library:2.10.2 -> 2.10.3 (caller: com.typesafe.akka:akka-actor_2.10:2.3.0, com.example:foo:0.1.0)", "\t* org.scala-lang:scala-library:2.10.2 -> 2.10.3 (caller: com.typesafe.akka:akka-actor_2.10:2.3.0, com.example:foo:0.1.0)",
"To force scalaVersion, add the following:", "To force scalaVersion, add the following:",
"\tivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }") "\tivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }"
)
} }
def javaLibDirectDeps = Seq(commonsIo14, commonsIo24) def javaLibDirectDeps = Seq(commonsIo14, commonsIo24)
@ -109,19 +113,23 @@ class EvictionWarningSpec extends BaseIvySpecification {
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3")) val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).lines shouldBe EvictionWarning(m, defaultOptions, report, log).lines shouldBe
List("There may be incompatibilities among your library dependencies.", List(
"There may be incompatibilities among your library dependencies.",
"Here are some of the libraries that were evicted:", "Here are some of the libraries that were evicted:",
"\t* commons-io:commons-io:1.4 -> 2.4", "\t* commons-io:commons-io:1.4 -> 2.4",
"Run 'evicted' to see detailed eviction warnings") "Run 'evicted' to see detailed eviction warnings"
)
} }
def javaLibWarn4() = { def javaLibWarn4() = {
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3")) val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines shouldBe EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines shouldBe
List("There may be incompatibilities among your library dependencies.", List(
"There may be incompatibilities among your library dependencies.",
"Here are some of the libraries that were evicted:", "Here are some of the libraries that were evicted:",
"\t* commons-io:commons-io:1.4 -> 2.4 (caller: com.example:foo:0.1.0)") "\t* commons-io:commons-io:1.4 -> 2.4 (caller: com.example:foo:0.1.0)"
)
} }
def javaLibNoWarn1() = { def javaLibNoWarn1() = {
@ -156,9 +164,11 @@ class EvictionWarningSpec extends BaseIvySpecification {
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3")) val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true).withShowCallers(true), report, log).lines shouldBe EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true).withShowCallers(true), report, log).lines shouldBe
List("There may be incompatibilities among your library dependencies.", List(
"There may be incompatibilities among your library dependencies.",
"Here are some of the libraries that were evicted:", "Here are some of the libraries that were evicted:",
"\t* commons-io:commons-io:1.4 -> 2.4 (caller: ca.gobits.bnf:bnfparser:1.0, net.databinder:unfiltered-uploads_2.10:0.8.0)") "\t* commons-io:commons-io:1.4 -> 2.4 (caller: ca.gobits.bnf:bnfparser:1.0, net.databinder:unfiltered-uploads_2.10:0.8.0)"
)
} }
def scalaLibWarn1() = { def scalaLibWarn1() = {
@ -173,10 +183,12 @@ class EvictionWarningSpec extends BaseIvySpecification {
val m = module(defaultModuleId, deps, Some("2.10.4")) val m = module(defaultModuleId, deps, Some("2.10.4"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).lines shouldBe EvictionWarning(m, defaultOptions, report, log).lines shouldBe
List("There may be incompatibilities among your library dependencies.", List(
"There may be incompatibilities among your library dependencies.",
"Here are some of the libraries that were evicted:", "Here are some of the libraries that were evicted:",
"\t* com.typesafe.akka:akka-actor_2.10:2.1.4 -> 2.3.4", "\t* com.typesafe.akka:akka-actor_2.10:2.1.4 -> 2.3.4",
"Run 'evicted' to see detailed eviction warnings") "Run 'evicted' to see detailed eviction warnings"
)
} }
def scalaLibNoWarn1() = { def scalaLibNoWarn1() = {
@ -211,8 +223,10 @@ class EvictionWarningSpec extends BaseIvySpecification {
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4")) val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true).withShowCallers(true), report, log).lines shouldBe EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true).withShowCallers(true), report, log).lines shouldBe
List("There may be incompatibilities among your library dependencies.", List(
"There may be incompatibilities among your library dependencies.",
"Here are some of the libraries that were evicted:", "Here are some of the libraries that were evicted:",
"\t* com.typesafe.akka:akka-actor_2.10:2.1.4 -> 2.3.4 (caller: com.typesafe.akka:akka-remote_2.10:2.3.4, org.w3:banana-sesame_2.10:0.4, org.w3:banana-rdf_2.10:0.4)") "\t* com.typesafe.akka:akka-actor_2.10:2.1.4 -> 2.3.4 (caller: com.typesafe.akka:akka-remote_2.10:2.3.4, org.w3:banana-sesame_2.10:0.4, org.w3:banana-rdf_2.10:0.4)"
)
} }
} }

View File

@ -7,8 +7,10 @@ import sbt.librarymanagement._
class InconsistentDuplicateSpec extends UnitSpec { class InconsistentDuplicateSpec extends UnitSpec {
"Duplicate with different version" should "be warned" in { "Duplicate with different version" should "be warned" in {
IvySbt.inconsistentDuplicateWarning(Seq(akkaActor214, akkaActor230)) shouldBe IvySbt.inconsistentDuplicateWarning(Seq(akkaActor214, akkaActor230)) shouldBe
List("Multiple dependencies with the same organization/name but different versions. To avoid conflict, pick one version:", List(
" * com.typesafe.akka:akka-actor:(2.1.4, 2.3.0)") "Multiple dependencies with the same organization/name but different versions. To avoid conflict, pick one version:",
" * com.typesafe.akka:akka-actor:(2.1.4, 2.3.0)"
)
} }
"Duplicate with same version" should "not be warned" in { "Duplicate with same version" should "not be warned" in {

View File

@ -1 +1 @@
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.1.0") addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.2.1")