diff --git a/build.sbt b/build.sbt index 87fcf9194..8702ac687 100644 --- a/build.sbt +++ b/build.sbt @@ -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(".")). diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala index 7029f19e0..e2848cb91 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala +++ b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala @@ -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) diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/Ivy.scala b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/Ivy.scala index a2709140a..7bb40bfe2 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/Ivy.scala +++ b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/Ivy.scala @@ -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) else NodeSeq.Empty + if ((dependencies \\ "publications").isEmpty) else NodeSeq.Empty } } diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala index b6a432d63..cb873b1e2 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala +++ b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala @@ -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) diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyCache.scala b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyCache.scala index f40543d95..b5fb6640a 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyCache.scala +++ b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyCache.scala @@ -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.*/ diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyConfigurations.scala b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyConfigurations.scala index 9b35425ef..4d67fc086 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyConfigurations.scala +++ b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyConfigurations.scala @@ -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) - } - } - } -} diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala index 8e10b0633..7b8b705e5 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala +++ b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala @@ -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. diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/JsonUtil.scala b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/JsonUtil.scala index 8842301ea..e0d3052e9 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/JsonUtil.scala +++ b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/JsonUtil.scala @@ -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) } } diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/MakePom.scala b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/MakePom.scala index 384833764..b7029902b 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/MakePom.scala +++ b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/MakePom.scala @@ -412,7 +412,7 @@ class MakePom(val log: Logger) { { id } { name } { root } - { if (name == JavaNet1Repository.name) "legacy" else "default" } + { "default" } /** diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala index adabbeb47..19830657b 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala +++ b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala @@ -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) diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/ErrorMessageAuthenticator.scala b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/ErrorMessageAuthenticator.scala index 9a889d808..173ae1d35 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/ErrorMessageAuthenticator.scala +++ b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/ivyint/ErrorMessageAuthenticator.scala @@ -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) } diff --git a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/mavenint/PomExtraDependencyAttributes.scala b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/mavenint/PomExtraDependencyAttributes.scala index a1091aed4..8ae8b8ef1 100644 --- a/librarymanagement/src/main/scala/sbt/internal/librarymanagement/mavenint/PomExtraDependencyAttributes.scala +++ b/librarymanagement/src/main/scala/sbt/internal/librarymanagement/mavenint/PomExtraDependencyAttributes.scala @@ -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 diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/Artifact.scala b/librarymanagement/src/main/scala/sbt/librarymanagement/Artifact.scala index 93dc66fcb..2d174f035 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/Artifact.scala +++ b/librarymanagement/src/main/scala/sbt/librarymanagement/Artifact.scala @@ -120,6 +120,7 @@ object Artifact { }) builder.endEntry() builder.popHints() + () } } implicit val unpickler: Unpickler[Artifact] = new Unpickler[Artifact] { diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/Configuration.scala b/librarymanagement/src/main/scala/sbt/librarymanagement/Configuration.scala index 95c8119da..50c432682 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/Configuration.scala +++ b/librarymanagement/src/main/scala/sbt/librarymanagement/Configuration.scala @@ -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) diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/Credentials.scala b/librarymanagement/src/main/scala/sbt/librarymanagement/Credentials.scala index d86a8b774..3f075f2b7 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/Credentials.scala +++ b/librarymanagement/src/main/scala/sbt/librarymanagement/Credentials.scala @@ -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 } } diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/CrossVersion.scala b/librarymanagement/src/main/scala/sbt/librarymanagement/CrossVersion.scala index 63cee85a3..69244a817 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/CrossVersion.scala +++ b/librarymanagement/src/main/scala/sbt/librarymanagement/CrossVersion.scala @@ -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)) /** diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/Resolver.scala b/librarymanagement/src/main/scala/sbt/librarymanagement/Resolver.scala index a44615784..1f68b0903 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/Resolver.scala +++ b/librarymanagement/src/main/scala/sbt/librarymanagement/Resolver.scala @@ -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 { /** diff --git a/librarymanagement/src/main/scala/sbt/librarymanagement/UpdateReport.scala b/librarymanagement/src/main/scala/sbt/librarymanagement/UpdateReport.scala index 316467f87..3e300c090 100644 --- a/librarymanagement/src/main/scala/sbt/librarymanagement/UpdateReport.scala +++ b/librarymanagement/src/main/scala/sbt/librarymanagement/UpdateReport.scala @@ -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 = { diff --git a/librarymanagement/src/test/scala/CachedResolutionSpec.scala b/librarymanagement/src/test/scala/CachedResolutionSpec.scala index 5950fba99..fb9e86e3d 100644 --- a/librarymanagement/src/test/scala/CachedResolutionSpec.scala +++ b/librarymanagement/src/test/scala/CachedResolutionSpec.scala @@ -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")) diff --git a/librarymanagement/src/test/scala/ComponentManagerTest.scala b/librarymanagement/src/test/scala/ComponentManagerTest.scala index 800f5de0c..5824494fe 100644 --- a/librarymanagement/src/test/scala/ComponentManagerTest.scala +++ b/librarymanagement/src/test/scala/ComponentManagerTest.scala @@ -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) diff --git a/librarymanagement/src/test/scala/CustomPomParserTest.scala b/librarymanagement/src/test/scala/CustomPomParserTest.scala index 62e9edec2..833336dfe 100644 --- a/librarymanagement/src/test/scala/CustomPomParserTest.scala +++ b/librarymanagement/src/test/scala/CustomPomParserTest.scala @@ -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") diff --git a/librarymanagement/src/test/scala/DMSerializationSpec.scala b/librarymanagement/src/test/scala/DMSerializationSpec.scala index e35ea9748..ab4d9f78c 100644 --- a/librarymanagement/src/test/scala/DMSerializationSpec.scala +++ b/librarymanagement/src/test/scala/DMSerializationSpec.scala @@ -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 = diff --git a/librarymanagement/src/test/scala/EvictionWarningSpec.scala b/librarymanagement/src/test/scala/EvictionWarningSpec.scala index 46dea91f2..d1a93c6ae 100644 --- a/librarymanagement/src/test/scala/EvictionWarningSpec.scala +++ b/librarymanagement/src/test/scala/EvictionWarningSpec.scala @@ -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 diff --git a/librarymanagement/src/test/scala/MakePomSpec.scala b/librarymanagement/src/test/scala/MakePomSpec.scala index 726e397b1..d1dec575f 100644 --- a/librarymanagement/src/test/scala/MakePomSpec.scala +++ b/librarymanagement/src/test/scala/MakePomSpec.scala @@ -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) } + () + } } diff --git a/librarymanagement/src/test/scala/VersionNumberSpec.scala b/librarymanagement/src/test/scala/VersionNumberSpec.scala index 9f882f30e..5e59cada3 100644 --- a/librarymanagement/src/test/scala/VersionNumberSpec.scala +++ b/librarymanagement/src/test/scala/VersionNumberSpec.scala @@ -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) =>