Merge pull request #3 from Duhemm/cleaning

Clean the build and the warnings
This commit is contained in:
eugene yokota 2015-09-10 12:08:06 -04:00
commit 540e5fad96
36 changed files with 288 additions and 339 deletions

View File

@ -17,7 +17,22 @@ def commonSettings: Seq[Setting[_]] = Seq(
bintrayRepository := (bintrayRepository in ThisBuild).value,
resolvers += Resolver.sonatypeRepo("public"),
publishArtifact in Compile := true,
publishArtifact in Test := true
publishArtifact in Test := true,
scalacOptions ++= Seq(
"-encoding", "utf8",
"-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")
)
lazy val root = (project in file(".")).

View File

@ -73,7 +73,7 @@ class ComponentManager(globalLock: xsbti.GlobalLock, provider: xsbti.ComponentPr
class InvalidComponent(msg: String, cause: Throwable) extends RuntimeException(msg, cause) {
def this(msg: String) = this(msg, null)
}
sealed trait IfMissing extends NotNull
sealed trait IfMissing
object IfMissing {
object Fail extends IfMissing
final class Define(val cache: Boolean, define: => Unit) extends IfMissing { def apply() = define }

View File

@ -93,7 +93,7 @@ private[sbt] object ConvertResolver {
if (signerName != null) {
putSignatureMethod match {
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) ; ()
}
}
}
@ -128,17 +128,6 @@ private[sbt] object ConvertResolver {
resolver.setPatterns() // has to be done after initializeMavenStyle, which calls methods that overwrite the patterns
resolver
}
// TODO: HTTP repository is no longer recommended. #1541
// Remove `JavaNet1Repository` when we bump up the API.
case r: JavaNet1Repository =>
{
// Thanks to Matthias Pfau for posting how to use the Maven 1 repository on java.net with Ivy:
// http://www.nabble.com/Using-gradle-Ivy-with-special-maven-repositories-td23775489.html
val resolver = new IBiblioResolver with DescriptorRequired { override def convertM2IdForResourceSearch(mrid: ModuleRevisionId) = mrid }
initializeMavenStyle(resolver, JavaNet1Repository.name, "http://download.java.net/maven/1/")
resolver.setPattern("[organisation]/[ext]s/[module]-[revision](-[classifier]).[ext]")
resolver
}
case repo: SshRepository =>
{
val resolver = new SshResolver with DescriptorRequired
@ -257,6 +246,7 @@ private[sbt] object ConvertResolver {
progress.setTotalLength(totalLength);
}
FileUtil.copy(source, new java.io.File(url.toURI), progress, overwrite)
()
} catch {
case ex: IOException =>
fireTransferError(ex)

View File

@ -16,7 +16,7 @@ import sbt.internal.librarymanagement.mavenint.{ PomExtraDependencyAttributes, S
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 {
override def parseDescriptor(ivySettings: ParserSettings, descriptorURL: URL, validate: Boolean) =
transform(this, delegate.parseDescriptor(ivySettings, descriptorURL, validate))
@ -30,7 +30,7 @@ final class CustomPomParser(delegate: ModuleDescriptorParser, transform: (Module
override def getType() = delegate.getType()
override def getMetadataArtifact(mrid: ModuleRevisionId, res: Resource) = delegate.getMetadataArtifact(mrid, res)
}
@deprecated("We now use an Aether-based pom parser.", "0.13.8")
// @deprecated("We now use an Aether-based pom parser.", "0.13.8")
object CustomPomParser {
// Evil hackery to override the default maven pom mappings.

View File

@ -171,7 +171,6 @@ final class IvySbt(val configuration: IvyConfiguration) {
moduleSettings match {
case ic: InlineConfiguration => configureInline(ic.withExcludes, configuration.log)
case ic: InlineConfigurationWithExcludes => configureInline(ic, configuration.log)
case ec: EmptyConfiguration => configureEmpty(ec)
case pc: PomConfiguration => configurePom(pc)
case ifc: IvyFileConfiguration => configureIvyFile(ifc)
}
@ -238,13 +237,6 @@ final class IvySbt(val configuration: IvyConfiguration) {
IvySbt.addDependencies(dmd, ScalaArtifacts.toolDependencies(is.scalaOrganization, is.scalaFullVersion), parser)
}
private def toURL(file: File) = file.toURI.toURL
private def configureEmpty(ec: EmptyConfiguration) =
{
val defaultConf = ModuleDescriptor.DEFAULT_CONFIGURATION
val mod = newConfiguredModuleID(ec.module, ec.moduleInfo, Seq(Configurations.Default))
IvySbt.addMainArtifact(mod)
(mod, defaultConf)
}
}
}
@ -309,7 +301,7 @@ private[sbt] object IvySbt {
def addResolvers(resolvers: Seq[Resolver], settings: IvySettings, log: Logger): Unit = {
for (r <- resolvers) {
log.debug("\t" + r)
settings.addResolver(ConvertResolver(r, settings, log))
settings.addResolver(ConvertResolver(r, settings, UpdateOptions(), log))
}
}
/**
@ -329,7 +321,7 @@ private[sbt] object IvySbt {
import IvyPatternHelper._
import PatternMatcher._
if (!existing.contains(resolver.name))
settings.addResolver(ConvertResolver(resolver, settings, log))
settings.addResolver(ConvertResolver(resolver, settings, UpdateOptions(), log))
val attributes = javaMap(Map(MODULE_KEY -> name, ORGANISATION_KEY -> organization, REVISION_KEY -> revision))
settings.addModuleConfiguration(attributes, settings.getMatcher(EXACT_OR_REGEXP), resolver.name, null, null, null)
}
@ -357,8 +349,7 @@ private[sbt] object IvySbt {
new ResolvedModuleRevision(resolved.getResolver, resolved.getResolver, updatedDescriptor, resolved.getReport, resolved.isForce)
}
private[this] def configureRepositoryCache(settings: IvySettings, localOnly: Boolean) //, artifactResolver: DependencyResolver)
{
private[this] def configureRepositoryCache(settings: IvySettings, localOnly: Boolean): Unit = {
val cacheDir = settings.getDefaultRepositoryCacheBasedir()
val manager = new DefaultRepositoryCacheManager("default-cache", settings, cacheDir) {
override def findModuleInCache(dd: DependencyDescriptor, revId: ModuleRevisionId, options: CacheMetadataOptions, r: String) = {
@ -441,7 +432,6 @@ private[sbt] object IvySbt {
{
val sub = CrossVersion(scalaFullVersion, scalaBinaryVersion)
m match {
case ec: EmptyConfiguration => ec.copy(module = sub(ec.module))
case ic: InlineConfiguration => ic.copy(module = sub(ic.module), dependencies = ic.dependencies map sub, overrides = ic.overrides map sub)
case ic: InlineConfigurationWithExcludes => ic.copy(module = sub(ic.module), dependencies = ic.dependencies map sub, overrides = ic.overrides map sub)
case _ => m
@ -492,7 +482,7 @@ private[sbt] object IvySbt {
{ dependencies }
{
// this is because Ivy adds a default artifact if none are specified.
if (dependencies \\ "publications" isEmpty) <publications/> else NodeSeq.Empty
if ((dependencies \\ "publications").isEmpty) <publications/> else NodeSeq.Empty
}
</ivy-module>
}

View File

@ -23,7 +23,7 @@ import sbt.librarymanagement._
final class DeliverConfiguration(val deliverIvyPattern: String, val status: String, val configurations: Option[Seq[Configuration]], val logging: UpdateLogging.Value)
final class PublishConfiguration(val ivyFile: Option[File], val resolverName: String, val artifacts: Map[Artifact, File], val checksums: Seq[String], val logging: UpdateLogging.Value,
val overwrite: Boolean) {
val overwrite: Boolean) {
def this(ivyFile: Option[File], resolverName: String, artifacts: Map[Artifact, File], checksums: Seq[String], logging: UpdateLogging.Value) =
this(ivyFile, resolverName, artifacts, checksums, logging, false)
}
@ -141,7 +141,6 @@ object IvyActions {
moduleSettings match {
case i: InlineConfiguration => CrossVersion(i.module, i.ivyScala)
case i: InlineConfigurationWithExcludes => CrossVersion(i.module, i.ivyScala)
case e: EmptyConfiguration => CrossVersion(e.module, e.ivyScala)
case _ => None
}
def mapArtifacts(module: ModuleDescriptor, cross: Option[String => String], artifacts: Map[Artifact, File]): Seq[(IArtifact, File)] =
@ -213,7 +212,7 @@ object IvyActions {
val evictedSet = evicted.map(m => (m.organization, m.name)).toSet
val conflicted = confReport.allModules.filter(mod => evictedSet((mod.organization, mod.name)))
grouped(grouping)(conflicted ++ evicted)
} toMap;
}.toMap
def grouped[T](grouping: ModuleID => T)(mods: Seq[ModuleID]): Map[T, Set[String]] =
mods groupBy (grouping) mapValues (_.map(_.revision).toSet)
@ -379,9 +378,9 @@ object IvyActions {
}
}
final class ResolveException(
val messages: Seq[String],
val failed: Seq[ModuleID],
val failedPaths: Map[ModuleID, Seq[ModuleID]]) extends RuntimeException(messages.mkString("\n")) {
val messages: Seq[String],
val failed: Seq[ModuleID],
val failedPaths: Map[ModuleID, Seq[ModuleID]]) extends RuntimeException(messages.mkString("\n")) {
def this(messages: Seq[String], failed: Seq[ModuleID]) =
this(messages, failed, Map(failed map { m => m -> Nil }: _*))
}

View File

@ -17,7 +17,7 @@ import sbt.util.Logger
import sbt.librarymanagement._
class NotInCache(val id: ModuleID, cause: Throwable)
extends RuntimeException(NotInCache(id, cause), cause) {
extends RuntimeException(NotInCache(id, cause), cause) {
def this(id: ModuleID) = this(id, null)
}
private object NotInCache {
@ -37,11 +37,12 @@ class IvyCache(val ivyHome: Option[File]) {
withDefaultCache(lock, log) { cache =>
val resolver = new ArtifactResourceResolver { def resolve(artifact: IvyArtifact) = resolved }
cache.download(artifact, resolver, new FileDownloader, new CacheDownloadOptions)
()
}
}
/** Clears the cache of the jar for the given ID.*/
def clearCachedJar(id: ModuleID, lock: Option[xsbti.GlobalLock], log: Logger): Unit = {
try { withCachedJar(id, lock, log)(_.delete) }
try { withCachedJar(id, lock, log)(_.delete); () }
catch { case e: Exception => log.debug("Error cleaning cached jar: " + e.toString) }
}
/** Copies the cached jar for the given ID to the directory 'toDirectory'. If the jar is not in the cache, NotInCache is thrown.*/
@ -81,7 +82,7 @@ class IvyCache(val ivyHome: Option[File]) {
{
val local = Resolver.defaultLocal
val paths = new IvyPaths(new File("."), ivyHome)
val conf = new InlineIvyConfiguration(paths, Seq(local), Nil, Nil, false, lock, IvySbt.DefaultChecksums, None, log)
val conf = new InlineIvyConfiguration(paths, Seq(local), Nil, Nil, false, lock, IvySbt.DefaultChecksums, None, UpdateOptions(), log)
(new IvySbt(conf), local)
}
/** Creates a default jar artifact based on the given ID.*/
@ -89,7 +90,7 @@ class IvyCache(val ivyHome: Option[File]) {
new DefaultArtifact(IvySbt.toID(moduleID), null, moduleID.name, "jar", "jar")
}
/** Required by Ivy for copying to the cache.*/
private class FileDownloader extends ResourceDownloader with NotNull {
private class FileDownloader extends ResourceDownloader {
def download(artifact: IvyArtifact, resource: Resource, dest: File): Unit = {
if (dest.exists()) dest.delete()
val part = new File(dest.getAbsolutePath + ".part")

View File

@ -80,7 +80,7 @@ final class ExternalIvyConfiguration(val baseDirectory: File, val uri: URI, val
this(baseDirectory, uri, lock, extraResolvers, UpdateOptions(), log)
type This = ExternalIvyConfiguration
def withBase(newBase: File) = new ExternalIvyConfiguration(newBase, uri, lock, extraResolvers, log)
def withBase(newBase: File) = new ExternalIvyConfiguration(newBase, uri, lock, extraResolvers, UpdateOptions(), log)
}
object ExternalIvyConfiguration {
def apply(baseDirectory: File, file: File, lock: Option[xsbti.GlobalLock], log: Logger) = new ExternalIvyConfiguration(baseDirectory, file.toURI, lock, Nil, UpdateOptions(), log)
@ -230,28 +230,3 @@ object InlineConfigurationWithExcludes {
} else
explicitConfigurations
}
@deprecated("Define a module using inline Scala (InlineConfiguration), a pom.xml (PomConfiguration), or an ivy.xml (IvyFileConfiguration).", "0.13.0")
final case class EmptyConfiguration(module: ModuleID, moduleInfo: ModuleInfo, ivyScala: Option[IvyScala], validate: Boolean) extends ModuleSettings {
def noScala = copy(ivyScala = None)
}
object ModuleSettings {
@deprecated("Explicitly select configuration from pom.xml, ivy.xml, or inline Scala.", "0.13.0")
def apply(ivyScala: Option[IvyScala], validate: Boolean, module: => ModuleID, moduleInfo: => ModuleInfo)(baseDirectory: File, log: Logger): ModuleSettings =
{
log.debug("Autodetecting dependencies.")
val defaultPOMFile = IvySbt.defaultPOM(baseDirectory)
if (defaultPOMFile.canRead)
new PomConfiguration(defaultPOMFile, ivyScala, validate, true)
else {
val defaultIvy = IvySbt.defaultIvyFile(baseDirectory)
if (defaultIvy.canRead)
new IvyFileConfiguration(defaultIvy, ivyScala, validate, true)
else {
log.warn("No dependency configuration found, using defaults.")
new EmptyConfiguration(module, moduleInfo, ivyScala, validate)
}
}
}
}

View File

@ -163,7 +163,7 @@ object IvyRetrieve {
def updateStats(report: ResolveReport): UpdateStats =
new UpdateStats(report.getResolveTime, report.getDownloadTime, report.getDownloadSize, false)
def configurationReport(confReport: ConfigurationResolveReport): ConfigurationReport =
new ConfigurationReport(confReport.getConfiguration, moduleReports(confReport), organizationArtifactReports(confReport), evicted(confReport))
new ConfigurationReport(confReport.getConfiguration, moduleReports(confReport), organizationArtifactReports(confReport))
/**
* Tries to find Ivy graph path the from node to target.

View File

@ -68,14 +68,9 @@ private[sbt] object JsonUtil {
!mr.evicted && mr.problem.isEmpty
}
}
val evicted = details flatMap {
_.modules filter { mr =>
mr.evicted
}
} map { _.module }
new ConfigurationReport(cr.configuration, modules, details, evicted)
new ConfigurationReport(cr.configuration, modules, details)
}
new UpdateReport(cachedDescriptor, configReports, stats)
new UpdateReport(cachedDescriptor, configReports, stats, Map.empty)
}
}

View File

@ -372,8 +372,7 @@ class MakePom(val log: Logger) {
<exclusion>
<groupId>{ g }</groupId>
<artifactId>{ a }</artifactId>
</exclusion>
)
</exclusion>)
}
def makeRepositories(settings: IvySettings, includeAll: Boolean, filterRepositories: MavenRepository => Boolean) =
@ -413,7 +412,7 @@ class MakePom(val log: Logger) {
<id>{ id }</id>
<name>{ name }</name>
<url>{ root }</url>
<layout>{ if (name == JavaNet1Repository.name) "legacy" else "default" }</layout>
<layout>{ "default" }</layout>
</repository>
/**

View File

@ -4,11 +4,11 @@ import impl.{ GroupID, GroupArtifactID }
import sbt.librarymanagement._
final class SbtExclusionRule(
val organization: String,
val name: String,
val artifact: String,
val configurations: Seq[String],
val crossVersion: CrossVersion) {
val organization: String,
val name: String,
val artifact: String,
val configurations: Seq[String],
val crossVersion: CrossVersion) {
def copy(organization: String = this.organization,
name: String = this.name,

View File

@ -1,72 +1,73 @@
package sbt.internal.librarymanagement
package cross
object CrossVersionUtil
{
val trueString = "true"
val falseString = "false"
val fullString = "full"
val noneString = "none"
val disabledString = "disabled"
val binaryString = "binary"
val TransitionScalaVersion = "2.10"
val TransitionSbtVersion = "0.12"
object CrossVersionUtil {
val trueString = "true"
val falseString = "false"
val fullString = "full"
val noneString = "none"
val disabledString = "disabled"
val binaryString = "binary"
val TransitionScalaVersion = "2.10"
val TransitionSbtVersion = "0.12"
def isFull(s: String): Boolean = (s == trueString) || (s == fullString)
def isDisabled(s: String): Boolean = (s == falseString) || (s == noneString) || (s == disabledString)
def isBinary(s: String): Boolean = (s == binaryString)
def isFull(s: String): Boolean = (s == trueString) || (s == fullString)
def isDisabled(s: String): Boolean = (s == falseString) || (s == noneString) || (s == disabledString)
def isBinary(s: String): Boolean = (s == binaryString)
private[sbt] def isSbtApiCompatible(v: String): Boolean = sbtApiVersion(v).isDefined
/** Returns sbt binary interface x.y API compatible with the given version string v.
* RCs for x.y.0 are considered API compatible.
* Compatibile versions include 0.12.0-1 and 0.12.0-RC1 for Some(0, 12).
*/
private[sbt] def sbtApiVersion(v: String): Option[(Int, Int)] =
{
val ReleaseV = """(\d+)\.(\d+)\.(\d+)(-\d+)?""".r
val CandidateV = """(\d+)\.(\d+)\.(\d+)(-RC\d+)""".r
val NonReleaseV = """(\d+)\.(\d+)\.(\d+)([-\w+]*)""".r
v match {
case ReleaseV(x, y, z, ht) => Some((x.toInt, y.toInt))
case CandidateV(x, y, z, ht) => Some((x.toInt, y.toInt))
case NonReleaseV(x, y, z, ht) if z.toInt > 0 => Some((x.toInt, y.toInt))
case _ => None
}
}
private[sbt] def isScalaApiCompatible(v: String): Boolean = scalaApiVersion(v).isDefined
/** Returns Scala binary interface x.y API compatible with the given version string v.
* Compatibile versions include 2.10.0-1 and 2.10.1-M1 for Some(2, 10), but not 2.10.0-RC1.
*/
private[sbt] def scalaApiVersion(v: String): Option[(Int, Int)] =
{
val ReleaseV = """(\d+)\.(\d+)\.(\d+)(-\d+)?""".r
val BinCompatV = """(\d+)\.(\d+)\.(\d+)-bin(-.*)?""".r
val NonReleaseV = """(\d+)\.(\d+)\.(\d+)(-\w+)""".r
v match {
case ReleaseV(x, y, z, ht) => Some((x.toInt, y.toInt))
case BinCompatV(x, y, z, ht) => Some((x.toInt, y.toInt))
case NonReleaseV(x, y, z, ht) if z.toInt > 0 => Some((x.toInt, y.toInt))
case _ => None
}
}
private[sbt] val PartialVersion = """(\d+)\.(\d+)(?:\..+)?""".r
private[sbt] def partialVersion(s: String): Option[(Int,Int)] =
s match {
case PartialVersion(major, minor) => Some((major.toInt, minor.toInt))
case _ => None
}
def binaryScalaVersion(full: String): String = binaryVersionWithApi(full, TransitionScalaVersion)(scalaApiVersion)
def binarySbtVersion(full: String): String = binaryVersionWithApi(full, TransitionSbtVersion)(sbtApiVersion)
private[sbt] def binaryVersion(full: String, cutoff: String): String = binaryVersionWithApi(full, cutoff)(scalaApiVersion)
private[this] def isNewer(major: Int, minor: Int, minMajor: Int, minMinor: Int): Boolean =
major > minMajor || (major == minMajor && minor >= minMinor)
private[this] def binaryVersionWithApi(full: String, cutoff: String)(apiVersion: String => Option[(Int,Int)]): String =
{
def sub(major: Int, minor: Int) = major + "." + minor
(apiVersion(full), partialVersion(cutoff)) match {
case (Some((major, minor)), None) => sub(major, minor)
case (Some((major, minor)), Some((minMajor, minMinor))) if isNewer(major, minor, minMajor, minMinor) => sub(major, minor)
case _ => full
}
}
private[sbt] def isSbtApiCompatible(v: String): Boolean = sbtApiVersion(v).isDefined
/**
* Returns sbt binary interface x.y API compatible with the given version string v.
* RCs for x.y.0 are considered API compatible.
* Compatibile versions include 0.12.0-1 and 0.12.0-RC1 for Some(0, 12).
*/
private[sbt] def sbtApiVersion(v: String): Option[(Int, Int)] =
{
val ReleaseV = """(\d+)\.(\d+)\.(\d+)(-\d+)?""".r
val CandidateV = """(\d+)\.(\d+)\.(\d+)(-RC\d+)""".r
val NonReleaseV = """(\d+)\.(\d+)\.(\d+)([-\w+]*)""".r
v match {
case ReleaseV(x, y, z, ht) => Some((x.toInt, y.toInt))
case CandidateV(x, y, z, ht) => Some((x.toInt, y.toInt))
case NonReleaseV(x, y, z, ht) if z.toInt > 0 => Some((x.toInt, y.toInt))
case _ => None
}
}
private[sbt] def isScalaApiCompatible(v: String): Boolean = scalaApiVersion(v).isDefined
/**
* Returns Scala binary interface x.y API compatible with the given version string v.
* Compatibile versions include 2.10.0-1 and 2.10.1-M1 for Some(2, 10), but not 2.10.0-RC1.
*/
private[sbt] def scalaApiVersion(v: String): Option[(Int, Int)] =
{
val ReleaseV = """(\d+)\.(\d+)\.(\d+)(-\d+)?""".r
val BinCompatV = """(\d+)\.(\d+)\.(\d+)-bin(-.*)?""".r
val NonReleaseV = """(\d+)\.(\d+)\.(\d+)(-\w+)""".r
v match {
case ReleaseV(x, y, z, ht) => Some((x.toInt, y.toInt))
case BinCompatV(x, y, z, ht) => Some((x.toInt, y.toInt))
case NonReleaseV(x, y, z, ht) if z.toInt > 0 => Some((x.toInt, y.toInt))
case _ => None
}
}
private[sbt] val PartialVersion = """(\d+)\.(\d+)(?:\..+)?""".r
private[sbt] def partialVersion(s: String): Option[(Int, Int)] =
s match {
case PartialVersion(major, minor) => Some((major.toInt, minor.toInt))
case _ => None
}
def binaryScalaVersion(full: String): String = binaryVersionWithApi(full, TransitionScalaVersion)(scalaApiVersion)
def binarySbtVersion(full: String): String = binaryVersionWithApi(full, TransitionSbtVersion)(sbtApiVersion)
private[sbt] def binaryVersion(full: String, cutoff: String): String = binaryVersionWithApi(full, cutoff)(scalaApiVersion)
private[this] def isNewer(major: Int, minor: Int, minMajor: Int, minMinor: Int): Boolean =
major > minMajor || (major == minMajor && minor >= minMinor)
private[this] def binaryVersionWithApi(full: String, cutoff: String)(apiVersion: String => Option[(Int, Int)]): String =
{
def sub(major: Int, minor: Int) = major + "." + minor
(apiVersion(full), partialVersion(cutoff)) match {
case (Some((major, minor)), None) => sub(major, minor)
case (Some((major, minor)), Some((minMajor, minMinor))) if isNewer(major, minor, minMajor, minMinor) => sub(major, minor)
case _ => full
}
}
}

View File

@ -42,9 +42,9 @@ final class GroupID private[sbt] (private[sbt] val groupID: String) {
private[this] def deprecationMessage = """Use the cross method on the constructed ModuleID. For example: ("a" % "b" % "1").cross(...)"""
}
final class GroupArtifactID private[sbt] (
private[sbt] val groupID: String,
private[sbt] val artifactID: String,
private[sbt] val crossVersion: CrossVersion) {
private[sbt] val groupID: String,
private[sbt] val artifactID: String,
private[sbt] val crossVersion: CrossVersion) {
def %(revision: String): ModuleID =
{
nonEmpty(revision, "Revision")

View File

@ -33,8 +33,8 @@ private[sbt] object CachedResolutionResolveCache {
def graphVersion = "0.13.9C"
val buildStartup: Long = System.currentTimeMillis
lazy val todayStr: String = toYyyymmdd(buildStartup)
lazy val tomorrowStr: String = toYyyymmdd(buildStartup + (1 day).toMillis)
lazy val yesterdayStr: String = toYyyymmdd(buildStartup - (1 day).toMillis)
lazy val tomorrowStr: String = toYyyymmdd(buildStartup + 1.day.toMillis)
lazy val yesterdayStr: String = toYyyymmdd(buildStartup - 1.day.toMillis)
def toYyyymmdd(timeSinceEpoch: Long): String = yyyymmdd.format(new Date(timeSinceEpoch))
lazy val yyyymmdd: SimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd")
}
@ -386,12 +386,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
!mr.evicted && mr.problem.isEmpty
}
}
val evicted = details flatMap {
_.modules filter { mr =>
mr.evicted
}
} map { _.module }
new ConfigurationReport(rootModuleConf, modules, details, evicted)
new ConfigurationReport(rootModuleConf, modules, details)
}
/**
* Returns a tuple of (merged org + name combo, newly evicted modules)

View File

@ -70,8 +70,9 @@ object ErrorMessageAuthenticator {
def doInstallIfIvy(original: Option[Authenticator]): Unit =
original match {
case Some(installed: ErrorMessageAuthenticator) => // Ignore, we're already installed
case Some(ivy: IvyAuthenticator) => installIntoIvy(ivy)
case original => doInstall(original)
case Some(ivy: IvyAuthenticator) =>
installIntoIvy(ivy); ()
case original => doInstall(original)
}
doInstallIfIvy(originalAuthenticator)
}

View File

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

View File

@ -52,12 +52,8 @@ object PomExtraDependencyAttributes {
* TODO - maybe we can just parse this directly here. Note the `readFromAether` method uses
* whatever we set here.
*/
def transferDependencyExtraAttributes(from: Properties, to: java.util.Map[String, AnyRef]): Unit = {
Option(from.getProperty(ExtraAttributesKey, null)) match {
case Some(str) => to.put(ExtraAttributesKey, str)
case None =>
}
}
def transferDependencyExtraAttributes(from: Properties, to: java.util.Map[String, AnyRef]): Unit =
Option(from.getProperty(ExtraAttributesKey, null)) foreach (to.put(ExtraAttributesKey, _))
/**
* Reads the extra dependency information out of Ivy's notion of POM properties and returns

View File

@ -120,6 +120,7 @@ object Artifact {
})
builder.endEntry()
builder.popHints()
()
}
}
implicit val unpickler: Unpickler[Artifact] = new Unpickler[Artifact] {

View File

@ -26,7 +26,7 @@ object Configurations {
case _ => c
}
def internal(base: Configuration, ext: Configuration*) = config(base.name + "-internal") extend (ext: _*) hide
def internal(base: Configuration, ext: Configuration*) = config(base.name + "-internal").extend(ext: _*).hide
def fullInternal(base: Configuration): Configuration = internal(base, base, Optional, Provided)
def optionalInternal(base: Configuration): Configuration = internal(base, base, Optional)
@ -42,9 +42,9 @@ object Configurations {
lazy val Optional = config("optional")
lazy val Pom = config("pom")
lazy val ScalaTool = config("scala-tool") hide
lazy val CompilerPlugin = config("plugin") hide
lazy val Component = config("component") hide
lazy val ScalaTool = config("scala-tool").hide
lazy val CompilerPlugin = config("plugin").hide
lazy val Component = config("component").hide
private[sbt] val DefaultMavenConfiguration = defaultConfiguration(true)
private[sbt] val DefaultIvyConfiguration = defaultConfiguration(false)

View File

@ -63,7 +63,7 @@ object Credentials {
{
val properties = new java.util.Properties
IO.load(properties, from)
properties map { case (k, v) => (k.toString, v.toString.trim) } toMap;
properties.map { case (k, v) => (k.toString, v.toString.trim) }.toMap
}
}

View File

@ -52,6 +52,7 @@ object CrossVersion {
builder.beginEntry(a)
builder.endEntry()
builder.popHints()
()
}
}
implicit val unpickler: Unpickler[CrossVersion] = new Unpickler[CrossVersion] {
@ -93,8 +94,7 @@ object CrossVersion {
private[this] def idFun[T]: T => T = x => x
@deprecated("Will be made private.", "0.13.1")
def append(s: String): Option[String => String] = Some(x => crossName(x, s))
private[sbt] def append(s: String): Option[String => String] = Some(x => crossName(x, s))
/**
* Construct a cross-versioning function given cross-versioning configuration `cross`,
@ -123,15 +123,13 @@ object CrossVersion {
case Some(is) => substituteCrossA(artifacts, cross)
}
@deprecated("Will be made private.", "0.13.1")
def applyCross(s: String, fopt: Option[String => String]): String =
private[sbt] def applyCross(s: String, fopt: Option[String => String]): String =
fopt match {
case None => s
case Some(fopt) => fopt(s)
}
@deprecated("Will be made private.", "0.13.1")
def crossName(name: String, cross: String): String =
private[sbt] def crossName(name: String, cross: String): String =
name + "_" + cross
/** Cross-versions `exclude` according to its `crossVersion`. */
@ -145,8 +143,7 @@ object CrossVersion {
def substituteCross(a: Artifact, cross: Option[String => String]): Artifact =
a.copy(name = applyCross(a.name, cross))
@deprecated("Will be made private.", "0.13.1")
def substituteCrossA(as: Seq[Artifact], cross: Option[String => String]): Seq[Artifact] =
private[sbt] def substituteCrossA(as: Seq[Artifact], cross: Option[String => String]): Seq[Artifact] =
as.map(art => substituteCross(art, cross))
/**

View File

@ -8,13 +8,13 @@ import sbt.internal.util.ShowLines
import sbt.internal.librarymanagement.{ IvySbt, InlineConfiguration, InlineConfigurationWithExcludes }
final class EvictionWarningOptions private[sbt] (
val configurations: Seq[Configuration],
val warnScalaVersionEviction: Boolean,
val warnDirectEvictions: Boolean,
val warnTransitiveEvictions: Boolean,
val infoAllEvictions: Boolean,
val showCallers: Boolean,
val guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean]) {
val configurations: Seq[Configuration],
val warnScalaVersionEviction: Boolean,
val warnDirectEvictions: Boolean,
val warnTransitiveEvictions: Boolean,
val infoAllEvictions: Boolean,
val showCallers: Boolean,
val guessCompatible: Function1[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean]) {
private[sbt] def configStrings = configurations map { _.name }
def withConfigurations(configurations: Seq[Configuration]): EvictionWarningOptions =
@ -80,12 +80,12 @@ object EvictionWarningOptions {
}
final class EvictionPair private[sbt] (
val organization: String,
val name: String,
val winner: Option[ModuleReport],
val evicteds: Seq[ModuleReport],
val includesDirect: Boolean,
val showCallers: Boolean) {
val organization: String,
val name: String,
val winner: Option[ModuleReport],
val evicteds: Seq[ModuleReport],
val includesDirect: Boolean,
val showCallers: Boolean) {
override def toString: String =
EvictionPair.evictionPairLines.showLines(this).mkString
override def equals(o: Any): Boolean = o match {
@ -121,11 +121,11 @@ object EvictionPair {
}
final class EvictionWarning private[sbt] (
val options: EvictionWarningOptions,
val scalaEvictions: Seq[EvictionPair],
val directEvictions: Seq[EvictionPair],
val transitiveEvictions: Seq[EvictionPair],
val allEvictions: Seq[EvictionPair]) {
val options: EvictionWarningOptions,
val scalaEvictions: Seq[EvictionPair],
val directEvictions: Seq[EvictionPair],
val transitiveEvictions: Seq[EvictionPair],
val allEvictions: Seq[EvictionPair]) {
def reportedEvictions: Seq[EvictionPair] = scalaEvictions ++ directEvictions ++ transitiveEvictions
private[sbt] def infoAllTheThings: List[String] = EvictionWarning.infoAllTheThings(this)
}

View File

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

View File

@ -64,9 +64,6 @@ final class Patterns(val ivyPatterns: Seq[String], val artifactPatterns: Seq[Str
}
}
override def hashCode: Int = (ivyPatterns, artifactPatterns, isMavenCompatible, descriptorOptional, skipConsistencyCheck).hashCode
@deprecated
def this(ivyPatterns: Seq[String], artifactPatterns: Seq[String], isMavenCompatible: Boolean) = this(ivyPatterns, artifactPatterns, isMavenCompatible, false, false)
}
object Patterns {
implicit def defaultPatterns: Patterns = Resolver.defaultPatterns
@ -86,7 +83,7 @@ object RepositoryHelpers {
def nontransactional() = FileConfiguration(isLocal, Some(false))
def nonlocal() = FileConfiguration(false, isTransactional)
}
sealed trait SshAuthentication extends NotNull
sealed trait SshAuthentication
final case class PasswordAuthentication(user: String, password: Option[String]) extends SshAuthentication
final case class KeyFileAuthentication(user: String, keyfile: File, password: Option[String]) extends SshAuthentication
}
@ -167,12 +164,6 @@ import Resolver._
object DefaultMavenRepository extends MavenRepository("public", centralRepositoryRoot(useSecureResolvers))
object JavaNet2Repository extends MavenRepository(JavaNet2RepositoryName, JavaNet2RepositoryRoot)
object JCenterRepository extends MavenRepository(JCenterRepositoryName, JCenterRepositoryRoot)
@deprecated("HTTP repository is no longer recommended.", "0.13.6")
object JavaNet1Repository extends JavaNet1Repository
@deprecated("HTTP repository is no longer recommended.", "0.13.6")
sealed trait JavaNet1Repository extends Resolver {
def name = "java.net Maven1 Repository"
}
object Resolver {
private[sbt] def useSecureResolvers = sys.props.get("sbt.repository.secure") map { _.toLowerCase == "true" } getOrElse true
@ -225,7 +216,7 @@ object Resolver {
private def single[T](value: T, nonEmpty: Boolean): Seq[T] = if (nonEmpty) Seq(value) else Nil
/** A base class for defining factories for interfaces to Ivy repositories that require a hostname , port, and patterns. */
sealed abstract class Define[RepositoryType <: SshBasedRepository] extends NotNull {
sealed abstract class Define[RepositoryType <: SshBasedRepository] {
/** Subclasses should implement this method to */
protected def construct(name: String, connection: SshConnection, patterns: Patterns): RepositoryType
/**
@ -285,7 +276,7 @@ object Resolver {
def apply(name: String): FileRepository = FileRepository(name, defaultFileConfiguration, Patterns(false))
/** Constructs a file resolver with the given name and base directory. */
def apply(name: String, baseDirectory: File)(implicit basePatterns: Patterns): FileRepository =
baseRepository(new File(baseDirectory.toURI.normalize) getAbsolutePath)(FileRepository(name, defaultFileConfiguration, _))
baseRepository(new File(baseDirectory.toURI.normalize).getAbsolutePath)(FileRepository(name, defaultFileConfiguration, _))
}
object url {
/**
@ -356,7 +347,7 @@ object Resolver {
def defaultShared = defaultUserFileRepository("shared")
def defaultUserFileRepository(id: String) =
{
val pList = ("${ivy.home}/" + id + "/" + localBasePattern) :: Nil
val pList = s"$${ivy.home}/$id/$localBasePattern" :: Nil
FileRepository(id, defaultFileConfiguration, Patterns(pList, pList, false))
}
def defaultIvyPatterns =

View File

@ -13,16 +13,16 @@ import sbt.util.Logger
* See also UpdateConfiguration in IvyActions.scala.
*/
final class UpdateOptions private[sbt] (
/** If set to CircularDependencyLevel.Error, halt the dependency resolution. */
val circularDependencyLevel: CircularDependencyLevel,
/** If set to true, check all resolvers for snapshots. */
val latestSnapshots: Boolean,
/** If set to true, use consolidated resolution. */
val consolidatedResolution: Boolean,
/** If set to true, use cached resolution. */
val cachedResolution: Boolean,
/** Extention point for an alternative resolver converter. */
val resolverConverter: UpdateOptions.ResolverConverter) {
/** If set to CircularDependencyLevel.Error, halt the dependency resolution. */
val circularDependencyLevel: CircularDependencyLevel,
/** If set to true, check all resolvers for snapshots. */
val latestSnapshots: Boolean,
/** If set to true, use consolidated resolution. */
val consolidatedResolution: Boolean,
/** If set to true, use cached resolution. */
val cachedResolution: Boolean,
/** Extention point for an alternative resolver converter. */
val resolverConverter: UpdateOptions.ResolverConverter) {
def withCircularDependencyLevel(circularDependencyLevel: CircularDependencyLevel): UpdateOptions =
copy(circularDependencyLevel = circularDependencyLevel)
def withLatestSnapshots(latestSnapshots: Boolean): UpdateOptions =

View File

@ -17,15 +17,15 @@ import sbt.internal.librarymanagement.{ DependencyFilter, ConfigurationFilter, M
* @param evicted a sequence of evicted modules
*/
final class ConfigurationReport(
val configuration: String,
val modules: Seq[ModuleReport],
val details: Seq[OrganizationArtifactReport],
@deprecated("Use details instead to get better eviction info.", "0.13.6") val evicted: Seq[ModuleID]) {
def this(configuration: String, modules: Seq[ModuleReport], evicted: Seq[ModuleID]) =
this(configuration, modules, Nil, evicted)
val configuration: String,
val modules: Seq[ModuleReport],
val details: Seq[OrganizationArtifactReport]) {
def evicted: Seq[ModuleID] =
details flatMap (_.modules) filter (_.evicted) map (_.module)
override def toString = s"\t$configuration:\n" +
(if (details.isEmpty) modules.mkString + evicted.map("\t\t(EVICTED) " + _ + "\n").mkString
(if (details.isEmpty) modules.mkString + details.flatMap(_.modules).filter(_.evicted).map("\t\t(EVICTED) " + _ + "\n").mkString
else details.mkString)
/**
@ -36,7 +36,7 @@ final class ConfigurationReport(
private[this] def addConfiguration(mod: ModuleID): ModuleID = if (mod.configurations.isEmpty) mod.copy(configurations = Some(configuration)) else mod
def retrieve(f: (String, ModuleID, Artifact, File) => File): ConfigurationReport =
new ConfigurationReport(configuration, modules map { _.retrieve((mid, art, file) => f(configuration, mid, art, file)) }, details, evicted)
new ConfigurationReport(configuration, modules map { _.retrieve((mid, art, file) => f(configuration, mid, art, file)) }, details)
}
object ConfigurationReport {
implicit val pickler: Pickler[ConfigurationReport] with Unpickler[ConfigurationReport] = PicklerUnpickler.generate[ConfigurationReport]
@ -54,9 +54,9 @@ object ConfigurationReport {
* which can be used to calculate detailed evction warning etc.
*/
final class OrganizationArtifactReport private[sbt] (
val organization: String,
val name: String,
val modules: Seq[ModuleReport]) {
val organization: String,
val name: String,
val modules: Seq[ModuleReport]) {
override def toString: String = {
val details = modules map { _.detailReport }
s"\t$organization:$name\n${details.mkString}\n"
@ -77,24 +77,24 @@ object OrganizationArtifactReport {
* @param missingArtifacts the missing artifacts for this module.
*/
final class ModuleReport(
val module: ModuleID,
val artifacts: Seq[(Artifact, File)],
val missingArtifacts: Seq[Artifact],
val status: Option[String],
val publicationDate: Option[ju.Date],
val resolver: Option[String],
val artifactResolver: Option[String],
val evicted: Boolean,
val evictedData: Option[String],
val evictedReason: Option[String],
val problem: Option[String],
val homepage: Option[String],
val extraAttributes: Map[String, String],
val isDefault: Option[Boolean],
val branch: Option[String],
val configurations: Seq[String],
val licenses: Seq[(String, Option[String])],
val callers: Seq[Caller]) {
val module: ModuleID,
val artifacts: Seq[(Artifact, File)],
val missingArtifacts: Seq[Artifact],
val status: Option[String],
val publicationDate: Option[ju.Date],
val resolver: Option[String],
val artifactResolver: Option[String],
val evicted: Boolean,
val evictedData: Option[String],
val evictedReason: Option[String],
val problem: Option[String],
val homepage: Option[String],
val extraAttributes: Map[String, String],
val isDefault: Option[Boolean],
val branch: Option[String],
val configurations: Seq[String],
val licenses: Seq[(String, Option[String])],
val callers: Seq[Caller]) {
private[this] lazy val arts: Seq[String] = artifacts.map(_.toString) ++ missingArtifacts.map(art => "(MISSING) " + art)
override def toString: String = {
@ -164,13 +164,13 @@ object ModuleReport {
}
final class Caller(
val caller: ModuleID,
val callerConfigurations: Seq[String],
val callerExtraAttributes: Map[String, String],
val isForceDependency: Boolean,
val isChangingDependency: Boolean,
val isTransitiveDependency: Boolean,
val isDirectlyForceDependency: Boolean) {
val caller: ModuleID,
val callerConfigurations: Seq[String],
val callerExtraAttributes: Map[String, String],
val isForceDependency: Boolean,
val isChangingDependency: Boolean,
val isTransitiveDependency: Boolean,
val isDirectlyForceDependency: Boolean) {
override def toString: String =
s"$caller"
}
@ -248,16 +248,14 @@ object UpdateReport {
moduleReportMap { (configuration, modReport) =>
modReport.copy(
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 =
moduleReportMap { (configuration, modReport) =>
val newArtifacts = f(configuration, modReport.module, modReport.artifacts)
modReport.copy(
artifacts = f(configuration, modReport.module, modReport.artifacts),
missingArtifacts = Nil
)
missingArtifacts = Nil)
}
def toSeq: Seq[(String, ModuleID, Artifact, File)] =
@ -269,8 +267,7 @@ object UpdateReport {
def addMissing(f: ModuleID => Seq[Artifact]): UpdateReport =
moduleReportMap { (configuration, modReport) =>
modReport.copy(
missingArtifacts = (modReport.missingArtifacts ++ f(modReport.module)).distinct
)
missingArtifacts = (modReport.missingArtifacts ++ f(modReport.module)).distinct)
}
def moduleReportMap(f: (String, ModuleReport) => ModuleReport): UpdateReport =
@ -278,7 +275,7 @@ object UpdateReport {
val newConfigurations = report.configurations.map { confReport =>
import confReport._
val newModules = modules map { modReport => f(configuration, modReport) }
new ConfigurationReport(configuration, newModules, details, evicted)
new ConfigurationReport(configuration, newModules, details)
}
new UpdateReport(report.cachedDescriptor, newConfigurations, report.stats, report.stamps)
}
@ -319,6 +316,7 @@ object UpdateReport {
})
builder.endEntry()
builder.popHints()
()
}
def unpickle(tpe: String, reader: PReader): Any = {

View File

@ -1,9 +1,9 @@
package sbt.librarymanagement
final class VersionNumber private[sbt] (
val numbers: Seq[Long],
val tags: Seq[String],
val extras: Seq[String]) {
val numbers: Seq[Long],
val tags: Seq[String],
val extras: Seq[String]) {
def _1: Option[Long] = get(0)
def _2: Option[Long] = get(1)
def _3: Option[Long] = get(2)
@ -98,7 +98,7 @@ object VersionNumber {
private[this] def doIsCompat(v1: VersionNumber, v2: VersionNumber): Boolean =
(v1, v2) match {
case (v1, v2) if (v1.size >= 2) && (v2.size >= 2) => // A normal version number MUST take the form X.Y.Z
(v1._1.get, v1._2.get, v1._3.getOrElse(0), v1.tags, v2._1.get, v2._2.get, v2._3.getOrElse(0), v2.tags) match {
(v1._1.get, v1._2.get, v1._3.getOrElse(0L), v1.tags, v2._1.get, v2._2.get, v2._3.getOrElse(0L), v2.tags) match {
case (0L, _, _, _, 0L, _, _, _) =>
// Major version zero (0.y.z) is for initial development. Anything may change at any time. The public API should not be considered stable.
equalsIgnoreExtra(v1, v2)

View File

@ -32,7 +32,7 @@ class CachedResolutionSpec extends BaseIvySpecification {
ivyUpdateEither(m) match {
case Right(_) => sys.error("this should've failed 2")
case Left(uw) =>
uw.lines should contain allOf("\n\tNote: Unresolved dependencies path:",
uw.lines should contain allOf ("\n\tNote: Unresolved dependencies path:",
"\t\tfoundrylogic.vpp:vpp:2.2.1",
"\t\t +- org.apache.cayenne:cayenne-tools:3.0.2",
"\t\t +- org.apache.cayenne.plugins:maven-cayenne-plugin:3.0.2",
@ -55,9 +55,9 @@ class CachedResolutionSpec extends BaseIvySpecification {
cleanCachedResolutionCache(m)
// second resolution reads from the minigraph
val report = ivyUpdate(m)
val modules: Seq[String] = report.configurations.head.modules map {_.toString}
assert(modules exists { x: String => x contains """org.jboss.netty:netty:3.2.0.Final"""})
assert(!(modules exists { x: String => x contains """org.jboss.netty:netty:3.2.1.Final"""}))
val modules: Seq[String] = report.configurations.head.modules map { _.toString }
assert(modules exists { x: String => x contains """org.jboss.netty:netty:3.2.0.Final""" })
assert(!(modules exists { x: String => x contains """org.jboss.netty:netty:3.2.1.Final""" }))
}
def commonsIo13 = ModuleID("commons-io", "commons-io", "1.3", Some("compile"))

View File

@ -19,12 +19,14 @@ class ComponentManagerTest extends UnitSpec {
"Component manager" should "throw an exception if 'file' is called for a non-existing component" in {
withManager { manager =>
intercept[InvalidComponent] { manager.file(TestID)(Fail) }
()
}
}
it should "throw an exception if 'file' is called for an empty component" in {
withManager { manager =>
manager.define(TestID, Nil)
intercept[InvalidComponent] { manager.file(TestID)(Fail) }
()
}
}
it should "return the file for a single-file component" in {
@ -37,6 +39,7 @@ class ComponentManagerTest extends UnitSpec {
withManager { manager =>
defineFiles(manager, TestID, "a", "b")
intercept[InvalidComponent] { manager.file(TestID)(Fail) }
()
}
}
it should "return the files for a multi-file component" in {
@ -54,6 +57,7 @@ class ComponentManagerTest extends UnitSpec {
it should "throw an exception if 'files' is called for a non-existing component" in {
withManager { manager =>
intercept[InvalidComponent] { manager.files(TestID)(Fail) }
()
}
}
it should "properly cache a file and then retrieve it to an unresolved component" in {
@ -104,8 +108,10 @@ class ComponentManagerTest extends UnitSpec {
val location = componentLocation(id)
if (location.exists)
throw new RuntimeException(s"Cannot redefine component. ID: $id, files: ${files.mkString(",")}")
else
else {
IO.copy(files.map { f => f -> new java.io.File(location, f.getName) })
()
}
}
override def addToComponent(id: String, files: Array[File]): Boolean = {
val location = componentLocation(id)
@ -117,7 +123,7 @@ class ComponentManagerTest extends UnitSpec {
}
// A stubbed locking API.
object locks extends xsbti.GlobalLock {
override def apply[T](lockFile: File, run: Callable[T]): T = {
override def apply[U](lockFile: File, run: Callable[U]): U = {
// TODO - do we need to lock?
run.call()
}

View File

@ -17,7 +17,7 @@ class CustomPomParserTest extends UnitSpec {
val repoUrl = getClass.getResource("/test-maven-repo")
val local = MavenRepository("Test Repo", repoUrl.toExternalForm)
val paths = new IvyPaths(new File("."), Some(cacheDir))
val conf = new InlineIvyConfiguration(paths, Seq(local), Nil, Nil, false, None, Seq("sha1", "md5"), None, log)
val conf = new InlineIvyConfiguration(paths, Seq(local), Nil, Nil, false, None, Seq("sha1", "md5"), None, UpdateOptions(), log)
val ivySbt = new IvySbt(conf)
val resolveOpts = new ResolveOptions().setConfs(Array("default"))
val mrid = ModuleRevisionId.newInstance("com.test", "test-artifact", "1.0.0-SNAPSHOT")

View File

@ -51,7 +51,7 @@ class DMSerializationSpec extends UnitSpec {
new UpdateStats(0, 0, 0, false), Map(new File("./foo") -> 0))
lazy val configurationReportExample =
new ConfigurationReport("compile", Vector(moduleReportExample),
Vector(organizationArtifactReportExample), Nil)
Vector(organizationArtifactReportExample))
lazy val organizationArtifactReportExample =
new OrganizationArtifactReport("org", "name", Vector(moduleReportExample))
lazy val moduleReportExample =

View File

@ -5,38 +5,38 @@ import sbt.internal.librarymanagement.BaseIvySpecification
class EvictionWarningSpec extends BaseIvySpecification {
// This is a specification to check the eviction warnings
"Eviction of scala-library whose scalaVersion" should "be detected" in scalaVersionWarn1
it should "not be detected if it's diabled" in scalaVersionWarn2
it should "print out message about the eviction" in scalaVersionWarn3
it should "print out message about the eviction with callers" in scalaVersionWarn4
"Eviction of scala-library whose scalaVersion" should "be detected" in scalaVersionWarn1()
it should "not be detected if it's diabled" in scalaVersionWarn2()
it should "print out message about the eviction" in scalaVersionWarn3()
it should "print out message about the eviction with callers" in scalaVersionWarn4()
"""Including two (suspect) binary incompatible Java libraries to
direct dependencies""" should "be detected as eviction" in javaLibWarn1
it should "not be detected if it's disabled" in javaLibWarn2
it should "print out message about the eviction" in javaLibWarn3
it should "print out message about the eviction with callers" in javaLibWarn4
direct dependencies""" should "be detected as eviction" in javaLibWarn1()
it should "not be detected if it's disabled" in javaLibWarn2()
it should "print out message about the eviction" in javaLibWarn3()
it should "print out message about the eviction with callers" in javaLibWarn4()
"""Including two (suspect) binary compatible Java libraries to
direct dependencies""" should "not be detected as eviction" in javaLibNoWarn1
it should "print out message about the eviction" in javaLibNoWarn2
direct dependencies""" should "not be detected as eviction" in javaLibNoWarn1()
it should "print out message about the eviction" in javaLibNoWarn2()
"""Including two (suspect) transitively binary incompatible Java libraries to
direct dependencies""" should "be not detected as eviction" in javaLibTransitiveWarn1
it should "be detected if it's enabled" in javaLibTransitiveWarn2
it should "print out message about the eviction if it's enabled" in javaLibTransitiveWarn3
direct dependencies""" should "be not detected as eviction" in javaLibTransitiveWarn1()
it should "be detected if it's enabled" in javaLibTransitiveWarn2()
it should "print out message about the eviction if it's enabled" in javaLibTransitiveWarn3()
"""Including two (suspect) binary incompatible Scala libraries to
direct dependencies""" should "be detected as eviction" in scalaLibWarn1
it should "print out message about the eviction" in scalaLibWarn2
direct dependencies""" should "be detected as eviction" in scalaLibWarn1()
it should "print out message about the eviction" in scalaLibWarn2()
"""Including two (suspect) binary compatible Scala libraries to
direct dependencies""" should "not be detected as eviction" in scalaLibNoWarn1
it should "print out message about the eviction" in scalaLibNoWarn2
direct dependencies""" should "not be detected as eviction" in scalaLibNoWarn1()
it should "print out message about the eviction" in scalaLibNoWarn2()
"""Including two (suspect) transitively binary incompatible Scala libraries to
direct dependencies""" should "be not detected as eviction" in scalaLibTransitiveWarn1
it should "be detected if it's enabled" in scalaLibTransitiveWarn2
it should "print out message about the eviction if it's enabled" in scalaLibTransitiveWarn3
direct dependencies""" should "be not detected as eviction" in scalaLibTransitiveWarn1()
it should "be detected if it's enabled" in scalaLibTransitiveWarn2()
it should "print out message about the eviction if it's enabled" in scalaLibTransitiveWarn3()
def akkaActor214 = ModuleID("com.typesafe.akka", "akka-actor", "2.1.4", Some("compile")) cross CrossVersion.binary
def akkaActor230 = ModuleID("com.typesafe.akka", "akka-actor", "2.3.0", Some("compile")) cross CrossVersion.binary
@ -58,19 +58,19 @@ class EvictionWarningSpec extends BaseIvySpecification {
def scalaVersionDeps = Seq(scala2102, akkaActor230)
def scalaVersionWarn1 = {
def scalaVersionWarn1() = {
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).scalaEvictions should have size(1)
EvictionWarning(m, defaultOptions, report, log).scalaEvictions should have size (1)
}
def scalaVersionWarn2 = {
def scalaVersionWarn2() = {
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withWarnScalaVersionEviction(false), report, log).scalaEvictions should have size(0)
EvictionWarning(m, defaultOptions.withWarnScalaVersionEviction(false), report, log).scalaEvictions should have size (0)
}
def scalaVersionWarn3 = {
def scalaVersionWarn3() = {
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).lines shouldBe
@ -81,7 +81,7 @@ class EvictionWarningSpec extends BaseIvySpecification {
"Run 'evicted' to see detailed eviction warnings")
}
def scalaVersionWarn4 = {
def scalaVersionWarn4() = {
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines shouldBe
@ -93,19 +93,19 @@ class EvictionWarningSpec extends BaseIvySpecification {
def javaLibDirectDeps = Seq(commonsIo14, commonsIo24)
def javaLibWarn1 = {
def javaLibWarn1() = {
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size(1)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (1)
}
def javaLibWarn2 = {
def javaLibWarn2() = {
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withWarnDirectEvictions(false), report, log).reportedEvictions should have size(0)
EvictionWarning(m, defaultOptions.withWarnDirectEvictions(false), report, log).reportedEvictions should have size (0)
}
def javaLibWarn3 = {
def javaLibWarn3() = {
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).lines shouldBe
@ -115,7 +115,7 @@ class EvictionWarningSpec extends BaseIvySpecification {
"Run 'evicted' to see detailed eviction warnings")
}
def javaLibWarn4 = {
def javaLibWarn4() = {
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines shouldBe
@ -124,14 +124,14 @@ class EvictionWarningSpec extends BaseIvySpecification {
"\t* commons-io:commons-io:1.4 -> 2.4 (caller: com.example:foo:0.1.0)")
}
def javaLibNoWarn1 = {
def javaLibNoWarn1() = {
val deps = Seq(commonsIo14, commonsIo13)
val m = module(defaultModuleId, deps, Some("2.10.3"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size(0)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (0)
}
def javaLibNoWarn2 = {
def javaLibNoWarn2() = {
val deps = Seq(commonsIo14, commonsIo13)
val m = module(defaultModuleId, deps, Some("2.10.3"))
val report = ivyUpdate(m)
@ -140,19 +140,19 @@ class EvictionWarningSpec extends BaseIvySpecification {
def javaLibTransitiveDeps = Seq(unfilteredUploads080, bnfparser10)
def javaLibTransitiveWarn1 = {
def javaLibTransitiveWarn1() = {
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size(0)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (0)
}
def javaLibTransitiveWarn2 = {
def javaLibTransitiveWarn2() = {
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true), report, log).reportedEvictions should have size(1)
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true), report, log).reportedEvictions should have size (1)
}
def javaLibTransitiveWarn3 = {
def javaLibTransitiveWarn3() = {
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true).withShowCallers(true), report, log).lines shouldBe
@ -161,14 +161,14 @@ class EvictionWarningSpec extends BaseIvySpecification {
"\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() = {
val deps = Seq(scala2104, akkaActor214, akkaActor234)
val m = module(defaultModuleId, deps, Some("2.10.4"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size(1)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (1)
}
def scalaLibWarn2 = {
def scalaLibWarn2() = {
val deps = Seq(scala2104, akkaActor214, akkaActor234)
val m = module(defaultModuleId, deps, Some("2.10.4"))
val report = ivyUpdate(m)
@ -179,14 +179,14 @@ class EvictionWarningSpec extends BaseIvySpecification {
"Run 'evicted' to see detailed eviction warnings")
}
def scalaLibNoWarn1 = {
def scalaLibNoWarn1() = {
val deps = Seq(scala2104, akkaActor230, akkaActor234)
val m = module(defaultModuleId, deps, Some("2.10.4"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size(0)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (0)
}
def scalaLibNoWarn2 = {
def scalaLibNoWarn2() = {
val deps = Seq(scala2104, akkaActor230, akkaActor234)
val m = module(defaultModuleId, deps, Some("2.10.4"))
val report = ivyUpdate(m)
@ -195,19 +195,19 @@ class EvictionWarningSpec extends BaseIvySpecification {
def scalaLibTransitiveDeps = Seq(scala2104, bananaSesame04, akkaRemote234)
def scalaLibTransitiveWarn1 = {
def scalaLibTransitiveWarn1() = {
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size(0)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (0)
}
def scalaLibTransitiveWarn2 = {
def scalaLibTransitiveWarn2() = {
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true), report, log).reportedEvictions should have size(1)
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true), report, log).reportedEvictions should have size (1)
}
def scalaLibTransitiveWarn3 = {
def scalaLibTransitiveWarn3() = {
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true).withShowCallers(true), report, log).lines shouldBe

View File

@ -71,9 +71,11 @@ class MakePomSpec extends UnitSpec {
val mp = new MakePom(ConsoleLogger())
def convertTo(s: String, expected: String): Unit =
MakePom.makeDependencyVersion(s) shouldBe expected
def beParsedAsError(s: String): Unit =
def beParsedAsError(s: String): Unit = {
intercept[Throwable] {
MakePom.makeDependencyVersion(s)
}
()
}
}

View File

@ -56,7 +56,6 @@ class VersionNumberSpec extends UnitSpec {
"0.1.0-MSERVER-1" should "be parsed" in beParsedAs("0.1.0-MSERVER-1", Seq(0, 1, 0), Seq("MSERVER", "1"), Seq())
it should "cascade" in generateCorrectCascadingNumbers("0.1.0-MSERVER-1", Seq("0.1.0-MSERVER-1", "0.1.0", "0.1"))
"2.10.4-20140115-000117-b3a-sources" should "be parsed" in {
beParsedAs("2.10.4-20140115-000117-b3a-sources", Seq(2, 10, 4), Seq("20140115", "000117", "b3a", "sources"), Seq())
}
@ -82,7 +81,6 @@ class VersionNumberSpec extends UnitSpec {
"space !?string" should "be parsed as an error" in beParsedAsError("space !?string")
"blank string" should "be parsed as an error" in beParsedAsError("")
def beParsedAs(s: String, ns: Seq[Long], ts: Seq[String], es: Seq[String]) =
s match {
case VersionNumber(ns1, ts1, es1) if (ns1 == ns && ts1 == ts && es1 == es) =>

1
project/house.sbt Normal file
View File

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