Add recommended compiler flags, fix warnings

Remove `JavaNet1Repository` which was deprecated.
This commit is contained in:
Martin Duhem 2015-08-31 17:13:19 +02:00
parent dc814a5154
commit 6822671f01
25 changed files with 125 additions and 171 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

@ -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

@ -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)
}
@ -441,7 +433,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 +483,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

@ -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)

View File

@ -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.*/

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

@ -412,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

@ -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

@ -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

@ -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
@ -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
@ -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 {
/**

View File

@ -19,13 +19,13 @@ import sbt.internal.librarymanagement.{ DependencyFilter, ConfigurationFilter, M
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 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]
@ -275,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)
}
@ -316,6 +316,7 @@ object UpdateReport {
})
builder.endEntry()
builder.popHints()
()
}
def unpickle(tpe: String, reader: PReader): Any = {

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)

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) =>