mirror of https://github.com/sbt/sbt.git
Merge pull request #2 from sbt/wip/orgname
org name + Bintray + Util 0.1.0-M2 + IO 1.0.0-M3 + Travis + scalatest
This commit is contained in:
commit
72e47657e5
|
|
@ -0,0 +1,4 @@
|
|||
language: scala
|
||||
scala:
|
||||
- 2.10.5
|
||||
- 2.11.7
|
||||
57
build.sbt
57
build.sbt
|
|
@ -2,45 +2,62 @@ import Dependencies._
|
|||
|
||||
def internalPath = file("internal")
|
||||
|
||||
// ThisBuild settings take lower precedence,
|
||||
// but can be shared across the multi projects.
|
||||
def buildLevelSettings: Seq[Setting[_]] = Seq(
|
||||
organization in ThisBuild := "org.scala-sbt.librarymanagement",
|
||||
version in ThisBuild := "1.0.0-SNAPSHOT"
|
||||
// bintrayOrganization in ThisBuild := Some("sbt"),
|
||||
// // bintrayRepository in ThisBuild := s"ivy-${(publishStatus in ThisBuild).value}",
|
||||
// bintrayPackage in ThisBuild := "sbt",
|
||||
// bintrayReleaseOnPublish in ThisBuild := false
|
||||
)
|
||||
|
||||
def commonSettings: Seq[Setting[_]] = Seq(
|
||||
scalaVersion := "2.10.5",
|
||||
// publishArtifact in packageDoc := false,
|
||||
resolvers += Resolver.typesafeIvyRepo("releases"),
|
||||
resolvers += Resolver.sonatypeRepo("snapshots"),
|
||||
resolvers += Resolver.bintrayRepo("sbt", "maven-releases"),
|
||||
// concurrentRestrictions in Global += Util.testExclusiveRestriction,
|
||||
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
|
||||
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
|
||||
incOptions := incOptions.value.withNameHashing(true)
|
||||
// crossScalaVersions := Seq(scala210)
|
||||
// bintrayPackage := (bintrayPackage in ThisBuild).value,
|
||||
// bintrayRepository := (bintrayRepository in ThisBuild).value
|
||||
incOptions := incOptions.value.withNameHashing(true),
|
||||
crossScalaVersions := Seq(scala210, scala211),
|
||||
bintrayPackage := (bintrayPackage in ThisBuild).value,
|
||||
bintrayRepository := (bintrayRepository in ThisBuild).value,
|
||||
resolvers += Resolver.sonatypeRepo("public"),
|
||||
publishArtifact in Compile := true,
|
||||
publishArtifact in Test := true
|
||||
)
|
||||
|
||||
lazy val root = (project in file(".")).
|
||||
aggregate(lm).
|
||||
settings(
|
||||
buildLevelSettings,
|
||||
inThisBuild(Seq(
|
||||
organization := "org.scala-sbt",
|
||||
version := "0.1.0-SNAPSHOT",
|
||||
homepage := Some(url("https://github.com/sbt/librarymanagement")),
|
||||
description := "Library management module for sbt",
|
||||
licenses := List("BSD New" -> url("https://github.com/sbt/sbt/blob/0.13/LICENSE")),
|
||||
scmInfo := Some(ScmInfo(url("https://github.com/sbt/librarymanagement"), "git@github.com:sbt/librarymanagement.git")),
|
||||
developers := List(
|
||||
Developer("harrah", "Mark Harrah", "@harrah", url("https://github.com/harrah")),
|
||||
Developer("eed3si9n", "Eugene Yokota", "@eed3si9n", url("https://github.com/eed3si9n")),
|
||||
Developer("jsuereth", "Josh Suereth", "@jsuereth", url("https://github.com/jsuereth")),
|
||||
Developer("dwijnand", "Dale Wijnand", "@dwijnand", url("https://github.com/dwijnand"))
|
||||
),
|
||||
bintrayReleaseOnPublish := false,
|
||||
bintrayOrganization := Some("sbt"),
|
||||
bintrayRepository := "maven-releases",
|
||||
bintrayPackage := "librarymanagement"
|
||||
)),
|
||||
commonSettings,
|
||||
// rootSettings,
|
||||
name := "LM Root",
|
||||
publish := {},
|
||||
publishLocal := {}
|
||||
publishLocal := {},
|
||||
publishArtifact in Compile := false,
|
||||
publishArtifact in Test := false,
|
||||
publishArtifact := false
|
||||
)
|
||||
|
||||
lazy val lm = (project in file("librarymanagement")).
|
||||
settings(
|
||||
commonSettings,
|
||||
libraryDependencies ++= Seq(utilLogging % "compile;test->test", ioProj % "compile;test->test", utilCollection),
|
||||
libraryDependencies ++= Seq(ivy, jsch, sbtSerialization, scalaReflect.value, launcherInterface),
|
||||
libraryDependencies ++= Seq(
|
||||
utilLogging, (utilLogging % Test).classifier("tests"),
|
||||
sbtIO, (sbtIO % Test).classifier("tests"),
|
||||
utilTesting % Test,
|
||||
utilCollection, ivy, jsch, sbtSerialization, scalaReflect.value, launcherInterface),
|
||||
resourceGenerators in Compile <+= (version, resourceManaged, streams, compile in Compile) map Util.generateVersionFile,
|
||||
name := "librarymanagement"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt;
|
||||
package sbt.internal.librarymanagement;
|
||||
|
||||
import java.util.Map;
|
||||
import org.apache.ivy.plugins.resolver.DependencyResolver;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt.mavenint;
|
||||
package sbt.internal.librarymanagement.mavenint;
|
||||
|
||||
/**
|
||||
* Extra properties we dump from Aether into the properties list.
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.{ File, FileOutputStream }
|
||||
import java.util.concurrent.Callable
|
||||
import sbt.util.Logger
|
||||
import sbt.librarymanagement._
|
||||
|
||||
/**
|
||||
* A component manager provides access to the pieces of xsbt that are distributed as components.
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.net.URL
|
||||
import java.util.Collections
|
||||
|
|
@ -17,6 +17,9 @@ import org.apache.ivy.plugins.repository.file.{ FileRepository => FileRepo, File
|
|||
import java.io.{ IOException, File }
|
||||
import org.apache.ivy.util.{ FileUtil, ChecksumHelper }
|
||||
import org.apache.ivy.core.module.descriptor.{ Artifact => IArtifact }
|
||||
import sbt.io.IO
|
||||
import sbt.util.Logger
|
||||
import sbt.librarymanagement._
|
||||
|
||||
private[sbt] object ConvertResolver {
|
||||
import UpdateOptions.ResolverConverter
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId
|
||||
import org.apache.ivy.core.module.descriptor.{ DefaultArtifact, DefaultExtendsDescriptor, DefaultModuleDescriptor, ModuleDescriptor }
|
||||
|
|
@ -12,7 +12,9 @@ import org.apache.ivy.util.extendable.ExtendableItem
|
|||
import java.io.{ File, InputStream }
|
||||
import java.net.URL
|
||||
import java.util.regex.Pattern
|
||||
import sbt.mavenint.{ PomExtraDependencyAttributes, SbtPomExtraProperties }
|
||||
import sbt.internal.librarymanagement.mavenint.{ PomExtraDependencyAttributes, SbtPomExtraProperties }
|
||||
import sbt.io.Hash
|
||||
import sbt.librarymanagement._
|
||||
|
||||
@deprecated("We now use an Aether-based pom parser.", "0.13.8")
|
||||
final class CustomPomParser(delegate: ModuleDescriptorParser, transform: (ModuleDescriptorParser, ModuleDescriptor) => ModuleDescriptor) extends ModuleDescriptorParser {
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.net.URL
|
||||
|
|
@ -11,6 +11,7 @@ import org.apache.ivy.core.settings.IvySettings
|
|||
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser
|
||||
import org.apache.ivy.plugins.repository.Resource
|
||||
import org.apache.ivy.plugins.repository.url.URLResource
|
||||
import sbt.librarymanagement._
|
||||
|
||||
/** Subclasses the default Ivy file parser in order to provide access to protected methods.*/
|
||||
private[sbt] object CustomXmlParser extends XmlModuleDescriptorParser {
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2011 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import sbt.io.{ AllPassFilter, NameFilter }
|
||||
import sbt.librarymanagement._
|
||||
|
||||
trait DependencyFilterExtra {
|
||||
def moduleFilter(organization: NameFilter = AllPassFilter, name: NameFilter = AllPassFilter, revision: NameFilter = AllPassFilter): ModuleFilter =
|
||||
|
|
@ -57,4 +60,4 @@ trait ArtifactFilter extends SubDepFilter[Artifact, ArtifactFilter] {
|
|||
trait ConfigurationFilter extends SubDepFilter[String, ConfigurationFilter] {
|
||||
protected final def make(f: String => Boolean) = new ConfigurationFilter { def apply(m: String) = f(m) }
|
||||
final def apply(configuration: String, module: ModuleID, artifact: Artifact): Boolean = apply(configuration)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
|
||||
import Resolver.PluginPattern
|
||||
import ivyint.{ CachedResolutionResolveEngine, CachedResolutionResolveCache, SbtDefaultDependencyDescriptor }
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import java.net.URI
|
||||
|
|
@ -39,6 +36,11 @@ import org.apache.ivy.util.extendable.ExtendableItem
|
|||
import scala.xml.{ NodeSeq, Text }
|
||||
import scala.collection.mutable
|
||||
|
||||
import sbt.util.Logger
|
||||
import sbt.librarymanagement._
|
||||
import Resolver.PluginPattern
|
||||
import ivyint.{ CachedResolutionResolveEngine, CachedResolutionResolveCache, SbtDefaultDependencyDescriptor }
|
||||
|
||||
final class IvySbt(val configuration: IvyConfiguration) {
|
||||
import configuration.baseDirectory
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import scala.xml.{ Node => XNode, NodeSeq }
|
||||
|
|
@ -16,6 +16,10 @@ import org.apache.ivy.core.module.descriptor.{ Artifact => IArtifact, MDArtifact
|
|||
import org.apache.ivy.core.report.ResolveReport
|
||||
import org.apache.ivy.core.resolve.ResolveOptions
|
||||
import org.apache.ivy.plugins.resolver.{ BasicResolver, DependencyResolver }
|
||||
import sbt.io.{ IO, PathFinder }
|
||||
import sbt.util.Logger
|
||||
import sbt.internal.util.{ ShowLines, SourcePosition, LinePosition, RangePosition, LineRange }
|
||||
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,
|
||||
|
|
@ -304,7 +308,7 @@ object IvyActions {
|
|||
case None => None
|
||||
case Some(configs) => Some(configs.map(_.name))
|
||||
}
|
||||
val existingFiles = PathFinder(base).***.get filterNot { _.isDirectory }
|
||||
val existingFiles = PathFinder(base).allPaths.get filterNot { _.isDirectory }
|
||||
val toCopy = new collection.mutable.HashSet[(File, File)]
|
||||
val retReport = report retrieve { (conf, mid, art, cached) =>
|
||||
configurationNames match {
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
|
|
@ -12,6 +12,9 @@ import org.apache.ivy.plugins.repository.file.{ FileRepository => IvyFileReposit
|
|||
import org.apache.ivy.plugins.repository.{ ArtifactResourceResolver, Resource, ResourceDownloader }
|
||||
import org.apache.ivy.plugins.resolver.util.ResolvedResource
|
||||
import org.apache.ivy.util.FileUtil
|
||||
import sbt.io.Path
|
||||
import sbt.util.Logger
|
||||
import sbt.librarymanagement._
|
||||
|
||||
class NotInCache(val id: ModuleID, cause: Throwable)
|
||||
extends RuntimeException(NotInCache(id, cause), cause) {
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import java.net.{ URI, URL }
|
||||
import scala.xml.NodeSeq
|
||||
import sbt.util.Logger
|
||||
import sbt.librarymanagement._
|
||||
|
||||
final class IvyPaths(val baseDirectory: File, val ivyHome: Option[File]) {
|
||||
def withBase(newBaseDirectory: File) = new IvyPaths(newBaseDirectory, ivyHome)
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import org.apache.ivy.util.{ Message, MessageLogger, MessageLoggerEngine }
|
||||
import sbt.util.Logger
|
||||
import sbt.librarymanagement._
|
||||
|
||||
/** Interface to Ivy logging. */
|
||||
private final class IvyLoggerInterface(logger: Logger) extends MessageLogger {
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import java.{ util => ju }
|
||||
|
|
@ -14,6 +14,7 @@ import report.{ ArtifactDownloadReport, ConfigurationResolveReport, ResolveRepor
|
|||
import resolve.{ IvyNode, IvyNodeCallers }
|
||||
import IvyNodeCallers.{ Caller => IvyCaller }
|
||||
import ivyint.SbtDefaultDependencyDescriptor
|
||||
import sbt.librarymanagement._
|
||||
|
||||
object IvyRetrieve {
|
||||
def reports(report: ResolveReport): Seq[ConfigurationResolveReport] =
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
private[sbt] object IvyUtil {
|
||||
def separate[A, B](l: Seq[Either[A, B]]): (Seq[A], Seq[B]) =
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
|
|
@ -6,6 +6,8 @@ import org.apache.ivy.core
|
|||
import core.module.descriptor.ModuleDescriptor
|
||||
import sbt.serialization._
|
||||
import java.net.{ URLEncoder, URLDecoder }
|
||||
import sbt.util.Logger
|
||||
import sbt.librarymanagement._
|
||||
|
||||
private[sbt] object JsonUtil {
|
||||
def sbtOrgTemp = "org.scala-sbt.temp"
|
||||
|
|
@ -24,7 +26,7 @@ private[sbt] object JsonUtil {
|
|||
}
|
||||
def writeUpdateReport(ur: UpdateReport, graphPath: File): Unit =
|
||||
{
|
||||
IO.createDirectory(graphPath.getParentFile)
|
||||
sbt.io.IO.createDirectory(graphPath.getParentFile)
|
||||
toJsonFile(toLite(ur), graphPath)
|
||||
}
|
||||
def toLite(ur: UpdateReport): UpdateReportLite =
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
/**
|
||||
* Represents a logical time point for dependency resolution.
|
||||
|
|
@ -12,7 +12,7 @@ object LogicalClock {
|
|||
def apply(hashCode: Int): LogicalClock = {
|
||||
def intToByteArray(x: Int): Array[Byte] =
|
||||
Array((x >>> 24).toByte, (x >> 16 & 0xff).toByte, (x >> 8 & 0xff).toByte, (x & 0xff).toByte)
|
||||
apply(Hash.toHex(intToByteArray(hashCode)))
|
||||
apply(sbt.io.Hash.toHex(intToByteArray(hashCode)))
|
||||
}
|
||||
def apply(x: String): LogicalClock = new LogicalClock {
|
||||
override def toString: String = x
|
||||
|
|
@ -5,11 +5,12 @@
|
|||
// based on Ivy's PomModuleDescriptorWriter, which is Apache Licensed, Version 2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
|
||||
import sbt.mavenint.PomExtraDependencyAttributes
|
||||
import sbt.util.Logger
|
||||
import sbt.librarymanagement._
|
||||
import mavenint.PomExtraDependencyAttributes
|
||||
|
||||
// Node needs to be renamed to XNode because the task subproject contains a Node type that will shadow
|
||||
// scala.xml.Node when generating aggregated API documentation
|
||||
|
|
@ -21,6 +22,8 @@ import org.apache.ivy.core.settings.IvySettings
|
|||
import org.apache.ivy.core.module.descriptor.{ DependencyArtifactDescriptor, DependencyDescriptor, License, ModuleDescriptor, ExcludeRule }
|
||||
import org.apache.ivy.plugins.resolver.{ ChainResolver, DependencyResolver, IBiblioResolver }
|
||||
import ivyint.CustomRemoteMavenResolver
|
||||
import sbt.io.IO
|
||||
|
||||
object MakePom {
|
||||
/** True if the revision is an ivy-range, not a complete revision. */
|
||||
def isDependencyVersionRange(revision: String): Boolean = {
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2011 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import java.util.Date
|
||||
|
|
@ -15,6 +15,7 @@ import org.apache.ivy.plugins.namespace.Namespace
|
|||
import org.apache.ivy.plugins.resolver.{ DependencyResolver, ResolverSettings }
|
||||
import report.{ ArtifactDownloadReport, DownloadReport, DownloadStatus, MetadataArtifactDownloadReport }
|
||||
import resolve.{ DownloadOptions, ResolveData, ResolvedModuleRevision }
|
||||
import sbt.librarymanagement._
|
||||
|
||||
/**
|
||||
* A Resolver that uses a predefined mapping from module ids to in-memory descriptors.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
|
|
@ -12,6 +12,8 @@ import core.module.id.ModuleRevisionId
|
|||
import core.module.descriptor.ModuleDescriptor
|
||||
import ResolutionCache.{ Name, ReportDirectory, ResolvedName, ResolvedPattern }
|
||||
import parser.xml.XmlModuleDescriptorParser
|
||||
import sbt.io.IO
|
||||
import sbt.librarymanagement._
|
||||
|
||||
/**
|
||||
* Replaces the standard Ivy resolution cache in order to:
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import sbt.impl.{ GroupID, GroupArtifactID }
|
||||
import impl.{ GroupID, GroupArtifactID }
|
||||
import sbt.librarymanagement._
|
||||
|
||||
final class SbtExclusionRule(
|
||||
val organization: String,
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2009 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
package sbt.cross
|
||||
package sbt.internal.librarymanagement
|
||||
package cross
|
||||
|
||||
object CrossVersionUtil
|
||||
{
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2009,2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
package impl
|
||||
|
||||
import StringUtilities.nonEmpty
|
||||
import sbt.librarymanagement._
|
||||
|
||||
trait DependencyBuilders {
|
||||
final implicit def toGroupID(groupID: String): GroupID =
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
package ivyint
|
||||
|
||||
import java.util.Date
|
||||
|
|
@ -19,9 +19,12 @@ import core.{ IvyPatternHelper, LogOptions }
|
|||
import org.apache.ivy.util.{ Message, MessageLogger }
|
||||
import org.apache.ivy.plugins.latest.{ ArtifactInfo => IvyArtifactInfo }
|
||||
import org.apache.ivy.plugins.matcher.{ MapMatcher, PatternMatcher }
|
||||
import Configurations.{ System => _, _ }
|
||||
import annotation.tailrec
|
||||
import scala.concurrent.duration._
|
||||
import sbt.io.{ DirectoryFilter, Hash, IO, Path }
|
||||
import sbt.util.Logger
|
||||
import sbt.librarymanagement._
|
||||
import Configurations.{ System => _, _ }
|
||||
|
||||
private[sbt] object CachedResolutionResolveCache {
|
||||
def createID(organization: String, name: String, revision: String) =
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
package ivyint
|
||||
|
||||
import org.apache.ivy.plugins.resolver.DependencyResolver
|
||||
import sbt.librarymanagement._
|
||||
|
||||
// These are placeholder traits for sbt-aether-resolver
|
||||
trait CustomMavenResolver extends DependencyResolver {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
package ivyint
|
||||
|
||||
import java.lang.reflect.Field
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
package ivyint
|
||||
|
||||
import org.apache.ivy.util.url.CredentialsStore
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
package ivyint
|
||||
|
||||
import java.io.File
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
package ivyint
|
||||
|
||||
import java.io.File
|
||||
|
|
@ -15,6 +15,8 @@ import org.apache.ivy.plugins.repository.url.URLResource
|
|||
import org.apache.ivy.plugins.resolver._
|
||||
import org.apache.ivy.plugins.resolver.util.{ HasLatestStrategy, ResolvedResource }
|
||||
import org.apache.ivy.util.{ Message, StringUtils => IvyStringUtils }
|
||||
import sbt.util.Logger
|
||||
import sbt.librarymanagement._
|
||||
|
||||
private[sbt] case class SbtChainResolver(
|
||||
name: String,
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
package ivyint
|
||||
|
||||
import org.apache.ivy.core
|
||||
import core.module.descriptor.DefaultDependencyDescriptor
|
||||
import sbt.librarymanagement._
|
||||
|
||||
trait SbtDefaultDependencyDescriptor { self: DefaultDependencyDescriptor =>
|
||||
def dependencyModuleId: ModuleID
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
package sbt.mavenint
|
||||
package sbt.internal.librarymanagement
|
||||
package mavenint
|
||||
|
||||
import java.util.Properties
|
||||
import java.util.regex.Pattern
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import org.apache.ivy.plugins.circular.{ CircularDependencyStrategy, WarnCircularDependencyStrategy, IgnoreCircularDependencyStrategy, ErrorCircularDependencyStrategy }
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import sbt.serialization._
|
||||
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import DependencyFilter._
|
||||
import sbt.internal.librarymanagement.DependencyFilter._
|
||||
import sbt.util.{ Logger, Level }
|
||||
|
||||
/**
|
||||
* Provide warnings for cross version conflicts.
|
||||
|
|
@ -8,16 +9,8 @@ import DependencyFilter._
|
|||
* library dependency graph by mistake, but it won't be caught by eviction.
|
||||
*/
|
||||
final case class ConflictWarning(label: String, level: Level.Value, failOnConflict: Boolean) {
|
||||
@deprecated("`filter` is no longer used", "0.13.0")
|
||||
val filter: ModuleFilter = (_: ModuleID) => false
|
||||
@deprecated("`group` is no longer used", "0.13.0")
|
||||
val group: ModuleID => String = ConflictWarning.org
|
||||
}
|
||||
object ConflictWarning {
|
||||
@deprecated("`group` and `filter` are no longer used. Use a standard Ivy conflict manager.", "0.13.0")
|
||||
def apply(label: String, filter: ModuleFilter, group: ModuleID => String, level: Level.Value, failOnConflict: Boolean): ConflictWarning =
|
||||
ConflictWarning(label, level, failOnConflict)
|
||||
|
||||
def disable: ConflictWarning = ConflictWarning("", Level.Debug, false)
|
||||
|
||||
private def org = (_: ModuleID).organization
|
||||
|
|
@ -25,9 +18,6 @@ object ConflictWarning {
|
|||
|
||||
def default(label: String): ConflictWarning = ConflictWarning(label, Level.Error, true)
|
||||
|
||||
@deprecated("Warning on evicted modules is no longer done, so this is the same as `default`. Use a standard Ivy conflict manager.", "0.13.0")
|
||||
def strict(label: String): ConflictWarning = ConflictWarning(label, Level.Error, true)
|
||||
|
||||
def apply(config: ConflictWarning, report: UpdateReport, log: Logger): Unit = {
|
||||
processCrossVersioned(config, report, log)
|
||||
}
|
||||
|
|
@ -1,10 +1,13 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2009 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import org.apache.ivy.util.url.CredentialsStore
|
||||
import sbt.io.IO
|
||||
import sbt.util.Logger
|
||||
import sbt.internal.librarymanagement.IvyUtil
|
||||
|
||||
object Credentials {
|
||||
def apply(realm: String, host: String, userName: String, passwd: String): Credentials =
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import cross.CrossVersionUtil
|
||||
import sbt.serialization._
|
||||
import sbt.internal.librarymanagement.SbtExclusionRule
|
||||
import sbt.internal.librarymanagement.cross.CrossVersionUtil
|
||||
|
||||
final case class ScalaVersion(full: String, binary: String)
|
||||
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import collection.mutable
|
||||
import Configurations.Compile
|
||||
import ScalaArtifacts.{ LibraryID, CompilerID }
|
||||
import sbt.util.Logger
|
||||
import sbt.internal.util.ShowLines
|
||||
import sbt.internal.librarymanagement.{ IvySbt, InlineConfiguration, InlineConfigurationWithExcludes }
|
||||
|
||||
final class EvictionWarningOptions private[sbt] (
|
||||
val configurations: Seq[Configuration],
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import java.net.{ URI, URL }
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import java.util.Collections.emptyMap
|
||||
import scala.collection.mutable.HashSet
|
||||
|
|
@ -10,6 +10,7 @@ import org.apache.ivy.core.module.descriptor.{ DefaultExcludeRule, ExcludeRule }
|
|||
import org.apache.ivy.core.module.descriptor.{ DependencyDescriptor, DefaultModuleDescriptor, ModuleDescriptor, OverrideDependencyDescriptorMediator }
|
||||
import org.apache.ivy.core.module.id.{ ArtifactId, ModuleId, ModuleRevisionId }
|
||||
import org.apache.ivy.plugins.matcher.ExactPatternMatcher
|
||||
import sbt.util.Logger
|
||||
|
||||
object ScalaArtifacts {
|
||||
val Organization = "org.scala-lang"
|
||||
|
|
@ -33,7 +34,7 @@ import ScalaArtifacts._
|
|||
|
||||
final case class IvyScala(scalaFullVersion: String, scalaBinaryVersion: String, configurations: Iterable[Configuration], checkExplicit: Boolean, filterImplicit: Boolean, overrideScalaVersion: Boolean, scalaOrganization: String = ScalaArtifacts.Organization)
|
||||
|
||||
private object IvyScala {
|
||||
private[sbt] object IvyScala {
|
||||
/** Performs checks/adds filters on Scala dependencies (if enabled in IvyScala). */
|
||||
def checkModule(module: DefaultModuleDescriptor, conf: String, log: Logger)(check: IvyScala): Unit = {
|
||||
if (check.checkExplicit)
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import java.net.URL
|
||||
|
||||
import sbt.mavenint.SbtPomExtraProperties
|
||||
import sbt.internal.librarymanagement.mavenint.SbtPomExtraProperties
|
||||
import sbt.serialization._
|
||||
|
||||
final case class ModuleID(organization: String, name: String, revision: String, configurations: Option[String] = None, isChanging: Boolean = false, isTransitive: Boolean = true, isForce: Boolean = false, explicitArtifacts: Seq[Artifact] = Nil, exclusions: Seq[ExclusionRule] = Nil, extraAttributes: Map[String, String] = Map.empty, crossVersion: CrossVersion = CrossVersion.Disabled) {
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2008, 2009, 2010 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import java.io.{ IOException, File }
|
||||
import java.net.URL
|
||||
|
|
@ -345,9 +345,9 @@ object Resolver {
|
|||
case _: IOException => None
|
||||
case e: SAXParseException => System.err.println(s"WARNING: Problem parsing ${f().getAbsolutePath}, ${e.getMessage}"); None
|
||||
}
|
||||
loadHomeFromSettings(() => new File(Path.userHome, ".m2/settings.xml")) orElse
|
||||
loadHomeFromSettings(() => new File(sbt.io.Path.userHome, ".m2/settings.xml")) orElse
|
||||
loadHomeFromSettings(() => new File(new File(System.getenv("M2_HOME")), "conf/settings.xml")) getOrElse
|
||||
new File(Path.userHome, ".m2/repository")
|
||||
new File(sbt.io.Path.userHome, ".m2/repository")
|
||||
}
|
||||
// TODO - should this just be the *exact* same as mavenLocal? probably...
|
||||
def publishMavenLocal: MavenCache = new MavenCache("publish-m2-local", mavenLocalDir)
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import org.apache.ivy.plugins.resolver.DependencyResolver
|
||||
import org.apache.ivy.core.settings.IvySettings
|
||||
import sbt.util.Logger
|
||||
|
||||
/**
|
||||
* Represents configurable options for update task.
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2011 Mark Harrah
|
||||
*/
|
||||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
import java.{ util => ju }
|
||||
import sbt.serialization._
|
||||
import sbt.internal.librarymanagement.{ DependencyFilter, ConfigurationFilter, ModuleFilter, ArtifactFilter }
|
||||
|
||||
/**
|
||||
* Provides information about resolution of a single configuration.
|
||||
|
|
@ -225,14 +226,15 @@ object UpdateReport {
|
|||
}
|
||||
|
||||
import DependencyFilter._
|
||||
|
||||
/** Obtains all successfully retrieved files in all configurations and modules. */
|
||||
def allFiles: Seq[File] = matching(DependencyFilter.allPass)
|
||||
|
||||
/** Obtains all successfully retrieved files in configurations, modules, and artifacts matching the specified filter. */
|
||||
def matching(f: DependencyFilter): Seq[File] = select0(f).distinct
|
||||
private[sbt] def matching(f: DependencyFilter): Seq[File] = select0(f).distinct
|
||||
|
||||
/** Obtains all successfully retrieved files matching all provided filters. An unspecified argument matches all files. */
|
||||
def select(configuration: ConfigurationFilter = configurationFilter(), module: ModuleFilter = moduleFilter(), artifact: ArtifactFilter = artifactFilter()): Seq[File] =
|
||||
private[sbt] def select(configuration: ConfigurationFilter = configurationFilter(), module: ModuleFilter = moduleFilter(), artifact: ArtifactFilter = artifactFilter()): Seq[File] =
|
||||
matching(DependencyFilter.make(configuration, module, artifact))
|
||||
|
||||
private[this] def select0(f: DependencyFilter): Seq[File] =
|
||||
|
|
@ -242,7 +244,7 @@ object UpdateReport {
|
|||
}
|
||||
|
||||
/** Constructs a new report that only contains files matching the specified filter.*/
|
||||
def filter(f: DependencyFilter): UpdateReport =
|
||||
private[sbt] def filter(f: DependencyFilter): UpdateReport =
|
||||
moduleReportMap { (configuration, modReport) =>
|
||||
modReport.copy(
|
||||
artifacts = modReport.artifacts filter { case (art, file) => f(configuration, modReport.module, art) },
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
final class VersionNumber private[sbt] (
|
||||
val numbers: Seq[Long],
|
||||
|
|
@ -1,12 +1,17 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import Path._, Configurations._
|
||||
import sbt.io.Path._
|
||||
import sbt.io.IO
|
||||
import java.io.File
|
||||
import org.specs2._
|
||||
import cross.CrossVersionUtil
|
||||
import sbt.ivyint.SbtChainResolver
|
||||
import sbt.util.Logger
|
||||
import sbt.internal.util.ConsoleLogger
|
||||
import sbt.internal.util.UnitSpec
|
||||
import sbt.librarymanagement._
|
||||
import ivyint.SbtChainResolver
|
||||
import Configurations._
|
||||
|
||||
trait BaseIvySpecification extends Specification {
|
||||
trait BaseIvySpecification extends UnitSpec {
|
||||
def currentBase: File = new File(".")
|
||||
def currentTarget: File = currentBase / "target" / "ivyhome"
|
||||
def currentManaged: File = currentBase / "target" / "lib_managed"
|
||||
|
|
|
|||
|
|
@ -1,33 +1,12 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import org.specs2._
|
||||
import sbt.internal.util.ShowLines
|
||||
import sbt.librarymanagement._
|
||||
|
||||
class CachedResolutionSpec extends BaseIvySpecification {
|
||||
def is = args(sequential = true) ^ s2"""
|
||||
|
||||
This is a specification to check the cached resolution
|
||||
|
||||
Resolving the same module twice should
|
||||
work $e1
|
||||
|
||||
Resolving the unsolvable module should
|
||||
not work $e2
|
||||
|
||||
Resolving a module with a pseudo-conflict should
|
||||
work $e3
|
||||
"""
|
||||
|
||||
def commonsIo13 = ModuleID("commons-io", "commons-io", "1.3", Some("compile"))
|
||||
def mavenCayennePlugin302 = ModuleID("org.apache.cayenne.plugins", "maven-cayenne-plugin", "3.0.2", Some("compile"))
|
||||
def avro177 = ModuleID("org.apache.avro", "avro", "1.7.7", Some("compile"))
|
||||
def dataAvro1940 = ModuleID("com.linkedin.pegasus", "data-avro", "1.9.40", Some("compile"))
|
||||
def netty320 = ModuleID("org.jboss.netty", "netty", "3.2.0.Final", Some("compile"))
|
||||
|
||||
def defaultOptions = EvictionWarningOptions.default
|
||||
|
||||
import ShowLines._
|
||||
|
||||
def e1 = {
|
||||
"Resolving the same module twice" should "work" in {
|
||||
cleanIvyCache()
|
||||
val m = module(ModuleID("com.example", "foo", "0.1.0", Some("compile")),
|
||||
Seq(commonsIo13), Some("2.10.2"), UpdateOptions().withCachedResolution(true))
|
||||
|
|
@ -38,10 +17,10 @@ class CachedResolutionSpec extends BaseIvySpecification {
|
|||
println(report)
|
||||
// second resolution reads from the minigraph
|
||||
println(report.configurations.head.modules.head.artifacts)
|
||||
report.configurations.size must_== 3
|
||||
report.configurations.size shouldBe 3
|
||||
}
|
||||
|
||||
def e2 = {
|
||||
"Resolving the unsolvable module should" should "not work" in {
|
||||
// log.setLevel(Level.Debug)
|
||||
val m = module(ModuleID("com.example", "foo", "0.2.0", Some("compile")),
|
||||
Seq(mavenCayennePlugin302), Some("2.10.2"), UpdateOptions().withCachedResolution(true))
|
||||
|
|
@ -53,11 +32,11 @@ class CachedResolutionSpec extends BaseIvySpecification {
|
|||
ivyUpdateEither(m) match {
|
||||
case Right(_) => sys.error("this should've failed 2")
|
||||
case Left(uw) =>
|
||||
uw.lines must 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",
|
||||
"\t\t +- com.example:foo:0.2.0"))
|
||||
"\t\t +- com.example:foo:0.2.0")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +44,7 @@ class CachedResolutionSpec extends BaseIvySpecification {
|
|||
// data-avro:1.9.40 depends on avro:1.4.0, which depends on netty:3.2.1.Final.
|
||||
// avro:1.4.0 will be evicted by avro:1.7.7.
|
||||
// #2046 says that netty:3.2.0.Final is incorrectly evicted by netty:3.2.1.Final
|
||||
def e3 = {
|
||||
"Resolving a module with a pseudo-conflict" should "work" in {
|
||||
// log.setLevel(Level.Debug)
|
||||
cleanIvyCache()
|
||||
val m = module(ModuleID("com.example", "foo", "0.3.0", Some("compile")),
|
||||
|
|
@ -76,8 +55,16 @@ class CachedResolutionSpec extends BaseIvySpecification {
|
|||
cleanCachedResolutionCache(m)
|
||||
// second resolution reads from the minigraph
|
||||
val report = ivyUpdate(m)
|
||||
val modules = report.configurations.head.modules
|
||||
(modules must containMatch("""org\.jboss\.netty:netty:3\.2\.0.Final""")) and
|
||||
(modules must not containMatch ("""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"))
|
||||
def mavenCayennePlugin302 = ModuleID("org.apache.cayenne.plugins", "maven-cayenne-plugin", "3.0.2", Some("compile"))
|
||||
def avro177 = ModuleID("org.apache.avro", "avro", "1.7.7", Some("compile"))
|
||||
def dataAvro1940 = ModuleID("com.linkedin.pegasus", "data-avro", "1.9.40", Some("compile"))
|
||||
def netty320 = ModuleID("org.jboss.netty", "netty", "3.2.0.Final", Some("compile"))
|
||||
|
||||
def defaultOptions = EvictionWarningOptions.default
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,73 +1,75 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import java.util.concurrent.Callable
|
||||
import org.specs2._
|
||||
import mutable.Specification
|
||||
import IO.{ createDirectory, delete, touch, withTemporaryDirectory }
|
||||
import sbt.io.IO.{ createDirectory, delete, touch, withTemporaryDirectory }
|
||||
import sbt.io.IO
|
||||
import org.apache.ivy.util.ChecksumHelper
|
||||
import IfMissing.Fail
|
||||
import xsbti.ComponentProvider
|
||||
import sbt.util.Logger
|
||||
import sbt.internal.util.{ UnitSpec, TestLogger }
|
||||
|
||||
// TODO - We need to re-enable this test. Right now, we dont' have a "stub" launcher for this.
|
||||
// This is testing something which uses a launcher interface, but was grabbing the underlying class directly
|
||||
// when it really should, instead, be stubbing out the underyling class.
|
||||
|
||||
object ComponentManagerTest extends Specification {
|
||||
class ComponentManagerTest extends UnitSpec {
|
||||
val TestID = "manager-test"
|
||||
"Component manager" should {
|
||||
"throw an exception if 'file' is called for a non-existing component" in {
|
||||
withManager { _.file(TestID)(Fail) must throwA[InvalidComponent] }
|
||||
"Component manager" should "throw an exception if 'file' is called for a non-existing component" in {
|
||||
withManager { manager =>
|
||||
intercept[InvalidComponent] { manager.file(TestID)(Fail) }
|
||||
}
|
||||
"throw an exception if 'file' is called for an empty component" in {
|
||||
withManager { manager =>
|
||||
manager.define(TestID, Nil)
|
||||
(manager.file(TestID)(Fail)) must throwA[InvalidComponent]
|
||||
}
|
||||
}
|
||||
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) }
|
||||
}
|
||||
"return the file for a single-file component" in {
|
||||
withManager { manager =>
|
||||
val hash = defineFile(manager, TestID, "a")
|
||||
checksum(manager.file(TestID)(Fail)) must beEqualTo(hash)
|
||||
}
|
||||
}
|
||||
it should "return the file for a single-file component" in {
|
||||
withManager { manager =>
|
||||
val hash = defineFile(manager, TestID, "a")
|
||||
checksum(manager.file(TestID)(Fail)) shouldBe hash
|
||||
}
|
||||
|
||||
"throw an exception if 'file' is called for multi-file component" in {
|
||||
withManager { manager =>
|
||||
defineFiles(manager, TestID, "a", "b")
|
||||
(manager.file(TestID)(Fail)) must throwA[InvalidComponent]
|
||||
}
|
||||
}
|
||||
it should "throw an exception if 'file' is called for multi-file component" in {
|
||||
withManager { manager =>
|
||||
defineFiles(manager, TestID, "a", "b")
|
||||
intercept[InvalidComponent] { manager.file(TestID)(Fail) }
|
||||
}
|
||||
"return the files for a multi-file component" in {
|
||||
withManager { manager =>
|
||||
val hashes = defineFiles(manager, TestID, "a", "b")
|
||||
checksum(manager.files(TestID)(Fail)) must containTheSameElementsAs(hashes)
|
||||
}
|
||||
}
|
||||
it should "return the files for a multi-file component" in {
|
||||
withManager { manager =>
|
||||
val hashes = defineFiles(manager, TestID, "a", "b")
|
||||
checksum(manager.files(TestID)(Fail)) should contain theSameElementsAs (hashes)
|
||||
}
|
||||
"return the files for a single-file component" in {
|
||||
withManager { manager =>
|
||||
val hashes = defineFiles(manager, TestID, "a")
|
||||
checksum(manager.files(TestID)(Fail)) must containTheSameElementsAs(hashes)
|
||||
}
|
||||
}
|
||||
it should "return the files for a single-file component" in {
|
||||
withManager { manager =>
|
||||
val hashes = defineFiles(manager, TestID, "a")
|
||||
checksum(manager.files(TestID)(Fail)) should contain theSameElementsAs (hashes)
|
||||
}
|
||||
"throw an exception if 'files' is called for a non-existing component" in {
|
||||
withManager { _.files(TestID)(Fail) must throwA[InvalidComponent] }
|
||||
}
|
||||
it should "throw an exception if 'files' is called for a non-existing component" in {
|
||||
withManager { manager =>
|
||||
intercept[InvalidComponent] { manager.files(TestID)(Fail) }
|
||||
}
|
||||
|
||||
"properly cache a file and then retrieve it to an unresolved component" in {
|
||||
withTemporaryDirectory { ivyHome =>
|
||||
withManagerHome(ivyHome) { definingManager =>
|
||||
val hash = defineFile(definingManager, TestID, "a")
|
||||
try {
|
||||
definingManager.cache(TestID)
|
||||
withManagerHome(ivyHome) { usingManager =>
|
||||
checksum(usingManager.file(TestID)(Fail)) must beEqualTo(hash)
|
||||
}
|
||||
} finally { definingManager.clearCache(TestID) }
|
||||
}
|
||||
}
|
||||
it should "properly cache a file and then retrieve it to an unresolved component" in {
|
||||
withTemporaryDirectory { ivyHome =>
|
||||
withManagerHome(ivyHome) { definingManager =>
|
||||
val hash = defineFile(definingManager, TestID, "a")
|
||||
try {
|
||||
definingManager.cache(TestID)
|
||||
withManagerHome(ivyHome) { usingManager =>
|
||||
checksum(usingManager.file(TestID)(Fail)) shouldBe hash
|
||||
}
|
||||
} finally { definingManager.clearCache(TestID) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private def checksum(files: Iterable[File]): Seq[String] = files.map(checksum).toSeq
|
||||
private def checksum(file: File): String = if (file.exists) ChecksumHelper.computeAsString(file, "sha1") else ""
|
||||
private def defineFile(manager: ComponentManager, id: String, name: String): String = createFile(manager, id, name)(checksum)
|
||||
|
|
|
|||
|
|
@ -1,122 +1,118 @@
|
|||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import org.specs2._
|
||||
import mutable.Specification
|
||||
import sbt.internal.util.UnitSpec
|
||||
|
||||
object CrossVersionTest extends Specification {
|
||||
"Cross version" should {
|
||||
"return sbt API for xyz as None" in {
|
||||
CrossVersion.sbtApiVersion("xyz") must_== None
|
||||
}
|
||||
"return sbt API for 0.12 as None" in {
|
||||
CrossVersion.sbtApiVersion("0.12") must_== None
|
||||
}
|
||||
"return sbt API for 0.12.0-SNAPSHOT as None" in {
|
||||
CrossVersion.sbtApiVersion("0.12.0-SNAPSHOT") must_== None
|
||||
}
|
||||
"return sbt API for 0.12.0-RC1 as Some((0, 12))" in {
|
||||
CrossVersion.sbtApiVersion("0.12.0-RC1") must_== Some((0, 12))
|
||||
}
|
||||
"return sbt API for 0.12.0 as Some((0, 12))" in {
|
||||
CrossVersion.sbtApiVersion("0.12.0") must_== Some((0, 12))
|
||||
}
|
||||
"return sbt API for 0.12.1-SNAPSHOT as Some((0, 12))" in {
|
||||
CrossVersion.sbtApiVersion("0.12.1-SNAPSHOT") must_== Some((0, 12))
|
||||
}
|
||||
"return sbt API for 0.12.1-RC1 as Some((0, 12))" in {
|
||||
CrossVersion.sbtApiVersion("0.12.1-RC1") must_== Some((0, 12))
|
||||
}
|
||||
"return sbt API for 0.12.1 as Some((0, 12))" in {
|
||||
CrossVersion.sbtApiVersion("0.12.1") must_== Some((0, 12))
|
||||
}
|
||||
"return sbt API compatibility for 0.12.0-M1 as false" in {
|
||||
CrossVersion.isSbtApiCompatible("0.12.0-M1") must_== false
|
||||
}
|
||||
"return sbt API compatibility for 0.12.0-RC1 as true" in {
|
||||
CrossVersion.isSbtApiCompatible("0.12.0-RC1") must_== true
|
||||
}
|
||||
"return sbt API compatibility for 0.12.1-RC1 as true" in {
|
||||
CrossVersion.isSbtApiCompatible("0.12.1-RC1") must_== true
|
||||
}
|
||||
"return binary sbt version for 0.11.3 as 0.11.3" in {
|
||||
CrossVersion.binarySbtVersion("0.11.3") must_== "0.11.3"
|
||||
}
|
||||
"return binary sbt version for 0.12.0-M1 as 0.12.0-M1" in {
|
||||
CrossVersion.binarySbtVersion("0.12.0-M1") must_== "0.12.0-M1"
|
||||
}
|
||||
"return binary sbt version for 0.12.0-RC1 as 0.12" in {
|
||||
CrossVersion.binarySbtVersion("0.12.0-RC1") must_== "0.12"
|
||||
}
|
||||
"return binary sbt version for 0.12.0 as 0.12" in {
|
||||
CrossVersion.binarySbtVersion("0.12.0") must_== "0.12"
|
||||
}
|
||||
"return binary sbt version for 0.12.1-SNAPSHOT as 0.12" in {
|
||||
CrossVersion.binarySbtVersion("0.12.1-SNAPSHOT") must_== "0.12"
|
||||
}
|
||||
"return binary sbt version for 0.12.1-RC1 as 0.12" in {
|
||||
CrossVersion.binarySbtVersion("0.12.1-RC1") must_== "0.12"
|
||||
}
|
||||
"return binary sbt version for 0.12.1 as 0.12" in {
|
||||
CrossVersion.binarySbtVersion("0.12.1") must_== "0.12"
|
||||
}
|
||||
|
||||
"return Scala API for xyz as None" in {
|
||||
CrossVersion.scalaApiVersion("xyz") must_== None
|
||||
}
|
||||
"return Scala API for 2.10 as None" in {
|
||||
CrossVersion.scalaApiVersion("2.10") must_== None
|
||||
}
|
||||
"return Scala API for 2.10.0-SNAPSHOT as None" in {
|
||||
CrossVersion.scalaApiVersion("2.10.0-SNAPSHOT") must_== None
|
||||
}
|
||||
"return Scala API for 2.10.0-RC1 as None" in {
|
||||
CrossVersion.scalaApiVersion("2.10.0-RC1") must_== None
|
||||
}
|
||||
"return Scala API for 2.10.0 as Some((2, 10))" in {
|
||||
CrossVersion.scalaApiVersion("2.10.0") must_== Some((2, 10))
|
||||
}
|
||||
"return Scala API for 2.10.0-1 as Some((2, 10))" in {
|
||||
CrossVersion.scalaApiVersion("2.10.0-1") must_== Some((2, 10))
|
||||
}
|
||||
"return Scala API for 2.10.1-SNAPSHOT as Some((2, 10))" in {
|
||||
CrossVersion.scalaApiVersion("2.10.1-SNAPSHOT") must_== Some((2, 10))
|
||||
}
|
||||
"return Scala API for 2.10.1-RC1 as Some((2, 10))" in {
|
||||
CrossVersion.scalaApiVersion("2.10.1-RC1") must_== Some((2, 10))
|
||||
}
|
||||
"return Scala API for 2.10.1 as Some((2, 10))" in {
|
||||
CrossVersion.scalaApiVersion("2.10.1") must_== Some((2, 10))
|
||||
}
|
||||
"return Scala API compatibility for 2.10.0-M1 as false" in {
|
||||
CrossVersion.isScalaApiCompatible("2.10.0-M1") must_== false
|
||||
}
|
||||
"return Scala API compatibility for 2.10.0-RC1 as false" in {
|
||||
CrossVersion.isScalaApiCompatible("2.10.0-RC1") must_== false
|
||||
}
|
||||
"return Scala API compatibility for 2.10.1-RC1 as false" in {
|
||||
CrossVersion.isScalaApiCompatible("2.10.1-RC1") must_== true
|
||||
}
|
||||
"return binary Scala version for 2.9.2 as 2.9.2" in {
|
||||
CrossVersion.binaryScalaVersion("2.9.2") must_== "2.9.2"
|
||||
}
|
||||
"return binary Scala version for 2.10.0-M1 as 2.10.0-M1" in {
|
||||
CrossVersion.binaryScalaVersion("2.10.0-M1") must_== "2.10.0-M1"
|
||||
}
|
||||
"return binary Scala version for 2.10.0-RC1 as 2.10.0-RC1" in {
|
||||
CrossVersion.binaryScalaVersion("2.10.0-RC1") must_== "2.10.0-RC1"
|
||||
}
|
||||
"return binary Scala version for 2.10.0 as 2.10" in {
|
||||
CrossVersion.binaryScalaVersion("2.10.0") must_== "2.10"
|
||||
}
|
||||
"return binary Scala version for 2.10.1-M1 as 2.10" in {
|
||||
CrossVersion.binaryScalaVersion("2.10.1-M1") must_== "2.10"
|
||||
}
|
||||
"return binary Scala version for 2.10.1-RC1 as 2.10" in {
|
||||
CrossVersion.binaryScalaVersion("2.10.1-RC1") must_== "2.10"
|
||||
}
|
||||
"return binary Scala version for 2.10.1 as 2.10" in {
|
||||
CrossVersion.binaryScalaVersion("2.10.1") must_== "2.10"
|
||||
}
|
||||
class CrossVersionTest extends UnitSpec {
|
||||
"Cross version" should "return sbt API for xyz as None" in {
|
||||
CrossVersion.sbtApiVersion("xyz") shouldBe None
|
||||
}
|
||||
it should "return sbt API for 0.12 as None" in {
|
||||
CrossVersion.sbtApiVersion("0.12") shouldBe None
|
||||
}
|
||||
it should "return sbt API for 0.12.0-SNAPSHOT as None" in {
|
||||
CrossVersion.sbtApiVersion("0.12.0-SNAPSHOT") shouldBe None
|
||||
}
|
||||
it should "return sbt API for 0.12.0-RC1 as Some((0, 12))" in {
|
||||
CrossVersion.sbtApiVersion("0.12.0-RC1") shouldBe Some((0, 12))
|
||||
}
|
||||
it should "return sbt API for 0.12.0 as Some((0, 12))" in {
|
||||
CrossVersion.sbtApiVersion("0.12.0") shouldBe Some((0, 12))
|
||||
}
|
||||
it should "return sbt API for 0.12.1-SNAPSHOT as Some((0, 12))" in {
|
||||
CrossVersion.sbtApiVersion("0.12.1-SNAPSHOT") shouldBe Some((0, 12))
|
||||
}
|
||||
it should "return sbt API for 0.12.1-RC1 as Some((0, 12))" in {
|
||||
CrossVersion.sbtApiVersion("0.12.1-RC1") shouldBe Some((0, 12))
|
||||
}
|
||||
it should "return sbt API for 0.12.1 as Some((0, 12))" in {
|
||||
CrossVersion.sbtApiVersion("0.12.1") shouldBe Some((0, 12))
|
||||
}
|
||||
it should "return sbt API compatibility for 0.12.0-M1 as false" in {
|
||||
CrossVersion.isSbtApiCompatible("0.12.0-M1") shouldBe false
|
||||
}
|
||||
it should "return sbt API compatibility for 0.12.0-RC1 as true" in {
|
||||
CrossVersion.isSbtApiCompatible("0.12.0-RC1") shouldBe true
|
||||
}
|
||||
it should "return sbt API compatibility for 0.12.1-RC1 as true" in {
|
||||
CrossVersion.isSbtApiCompatible("0.12.1-RC1") shouldBe true
|
||||
}
|
||||
it should "return binary sbt version for 0.11.3 as 0.11.3" in {
|
||||
CrossVersion.binarySbtVersion("0.11.3") shouldBe "0.11.3"
|
||||
}
|
||||
it should "return binary sbt version for 0.12.0-M1 as 0.12.0-M1" in {
|
||||
CrossVersion.binarySbtVersion("0.12.0-M1") shouldBe "0.12.0-M1"
|
||||
}
|
||||
it should "return binary sbt version for 0.12.0-RC1 as 0.12" in {
|
||||
CrossVersion.binarySbtVersion("0.12.0-RC1") shouldBe "0.12"
|
||||
}
|
||||
it should "return binary sbt version for 0.12.0 as 0.12" in {
|
||||
CrossVersion.binarySbtVersion("0.12.0") shouldBe "0.12"
|
||||
}
|
||||
it should "return binary sbt version for 0.12.1-SNAPSHOT as 0.12" in {
|
||||
CrossVersion.binarySbtVersion("0.12.1-SNAPSHOT") shouldBe "0.12"
|
||||
}
|
||||
it should "return binary sbt version for 0.12.1-RC1 as 0.12" in {
|
||||
CrossVersion.binarySbtVersion("0.12.1-RC1") shouldBe "0.12"
|
||||
}
|
||||
it should "return binary sbt version for 0.12.1 as 0.12" in {
|
||||
CrossVersion.binarySbtVersion("0.12.1") shouldBe "0.12"
|
||||
}
|
||||
it should "return Scala API for xyz as None" in {
|
||||
CrossVersion.scalaApiVersion("xyz") shouldBe None
|
||||
}
|
||||
it should "return Scala API for 2.10 as None" in {
|
||||
CrossVersion.scalaApiVersion("2.10") shouldBe None
|
||||
}
|
||||
it should "return Scala API for 2.10.0-SNAPSHOT as None" in {
|
||||
CrossVersion.scalaApiVersion("2.10.0-SNAPSHOT") shouldBe None
|
||||
}
|
||||
it should "return Scala API for 2.10.0-RC1 as None" in {
|
||||
CrossVersion.scalaApiVersion("2.10.0-RC1") shouldBe None
|
||||
}
|
||||
it should "return Scala API for 2.10.0 as Some((2, 10))" in {
|
||||
CrossVersion.scalaApiVersion("2.10.0") shouldBe Some((2, 10))
|
||||
}
|
||||
it should "return Scala API for 2.10.0-1 as Some((2, 10))" in {
|
||||
CrossVersion.scalaApiVersion("2.10.0-1") shouldBe Some((2, 10))
|
||||
}
|
||||
it should "return Scala API for 2.10.1-SNAPSHOT as Some((2, 10))" in {
|
||||
CrossVersion.scalaApiVersion("2.10.1-SNAPSHOT") shouldBe Some((2, 10))
|
||||
}
|
||||
it should "return Scala API for 2.10.1-RC1 as Some((2, 10))" in {
|
||||
CrossVersion.scalaApiVersion("2.10.1-RC1") shouldBe Some((2, 10))
|
||||
}
|
||||
it should "return Scala API for 2.10.1 as Some((2, 10))" in {
|
||||
CrossVersion.scalaApiVersion("2.10.1") shouldBe Some((2, 10))
|
||||
}
|
||||
it should "return Scala API compatibility for 2.10.0-M1 as false" in {
|
||||
CrossVersion.isScalaApiCompatible("2.10.0-M1") shouldBe false
|
||||
}
|
||||
it should "return Scala API compatibility for 2.10.0-RC1 as false" in {
|
||||
CrossVersion.isScalaApiCompatible("2.10.0-RC1") shouldBe false
|
||||
}
|
||||
it should "return Scala API compatibility for 2.10.1-RC1 as false" in {
|
||||
CrossVersion.isScalaApiCompatible("2.10.1-RC1") shouldBe true
|
||||
}
|
||||
it should "return binary Scala version for 2.9.2 as 2.9.2" in {
|
||||
CrossVersion.binaryScalaVersion("2.9.2") shouldBe "2.9.2"
|
||||
}
|
||||
it should "return binary Scala version for 2.10.0-M1 as 2.10.0-M1" in {
|
||||
CrossVersion.binaryScalaVersion("2.10.0-M1") shouldBe "2.10.0-M1"
|
||||
}
|
||||
it should "return binary Scala version for 2.10.0-RC1 as 2.10.0-RC1" in {
|
||||
CrossVersion.binaryScalaVersion("2.10.0-RC1") shouldBe "2.10.0-RC1"
|
||||
}
|
||||
it should "return binary Scala version for 2.10.0 as 2.10" in {
|
||||
CrossVersion.binaryScalaVersion("2.10.0") shouldBe "2.10"
|
||||
}
|
||||
it should "return binary Scala version for 2.10.1-M1 as 2.10" in {
|
||||
CrossVersion.binaryScalaVersion("2.10.1-M1") shouldBe "2.10"
|
||||
}
|
||||
it should "return binary Scala version for 2.10.1-RC1 as 2.10" in {
|
||||
CrossVersion.binaryScalaVersion("2.10.1-RC1") shouldBe "2.10"
|
||||
}
|
||||
it should "return binary Scala version for 2.10.1 as 2.10" in {
|
||||
CrossVersion.binaryScalaVersion("2.10.1") shouldBe "2.10"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +1,36 @@
|
|||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import org.apache.ivy.core.module.descriptor.{ Artifact => IvyArtifact }
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId
|
||||
import org.apache.ivy.core.resolve.ResolveOptions
|
||||
import org.specs2.mutable.Specification
|
||||
import sbt._
|
||||
import IO.withTemporaryDirectory
|
||||
import sbt.librarymanagement._
|
||||
import sbt.io.IO.withTemporaryDirectory
|
||||
import sbt.util.Logger
|
||||
import sbt.internal.util.ConsoleLogger
|
||||
import sbt.internal.util.UnitSpec
|
||||
|
||||
object CustomPomParserTest extends Specification {
|
||||
class CustomPomParserTest extends UnitSpec {
|
||||
"CustomPomParser" should "resolve an artifact with packaging 'scala-jar' as a regular jar file." in {
|
||||
val log = ConsoleLogger()
|
||||
withTemporaryDirectory { cacheDir =>
|
||||
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 ivySbt = new IvySbt(conf)
|
||||
val resolveOpts = new ResolveOptions().setConfs(Array("default"))
|
||||
val mrid = ModuleRevisionId.newInstance("com.test", "test-artifact", "1.0.0-SNAPSHOT")
|
||||
|
||||
"CustomPomParser" should {
|
||||
"resolve an artifact with packaging 'scala-jar' as a regular jar file." in {
|
||||
val log = ConsoleLogger()
|
||||
withTemporaryDirectory { cacheDir =>
|
||||
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 ivySbt = new IvySbt(conf)
|
||||
val resolveOpts = new ResolveOptions().setConfs(Array("default"))
|
||||
val mrid = ModuleRevisionId.newInstance("com.test", "test-artifact", "1.0.0-SNAPSHOT")
|
||||
|
||||
val resolveReport = ivySbt.withIvy(log) { ivy =>
|
||||
ivy.resolve(mrid, resolveOpts, true)
|
||||
}
|
||||
|
||||
resolveReport.hasError must beFalse
|
||||
resolveReport.getArtifacts.size() must beEqualTo(1)
|
||||
val artifact: IvyArtifact = resolveReport.getArtifacts.asInstanceOf[java.util.List[IvyArtifact]].get(0)
|
||||
artifact.getModuleRevisionId must beEqualTo(mrid)
|
||||
artifact.getExt must beEqualTo("jar")
|
||||
val resolveReport = ivySbt.withIvy(log) { ivy =>
|
||||
ivy.resolve(mrid, resolveOpts, true)
|
||||
}
|
||||
|
||||
resolveReport.hasError shouldBe false
|
||||
resolveReport.getArtifacts.size() shouldBe 1
|
||||
val artifact: IvyArtifact = resolveReport.getArtifacts.asInstanceOf[java.util.List[IvyArtifact]].get(0)
|
||||
artifact.getModuleRevisionId shouldBe mrid
|
||||
artifact.getExt shouldBe "jar"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,46 +1,50 @@
|
|||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import org.specs2._
|
||||
import matcher.MatchResult
|
||||
import java.net.URL
|
||||
import java.io.File
|
||||
import sbt.serialization._
|
||||
import sbt.internal.util.UnitSpec
|
||||
|
||||
class DMSerializationSpec extends Specification {
|
||||
def is = sequential ^ s2"""
|
||||
|
||||
This is a specification to check the serialization of dependency graph.
|
||||
|
||||
CrossVersion.full should
|
||||
${roundtripStr(CrossVersion.full: sbt.CrossVersion)}
|
||||
CrossVersion.binary should
|
||||
${roundtripStr(CrossVersion.binary: sbt.CrossVersion)}
|
||||
CrossVersion.Disabled should
|
||||
${roundtrip(CrossVersion.Disabled: sbt.CrossVersion)}
|
||||
|
||||
Artifact("foo") should
|
||||
${roundtrip(Artifact("foo"))}
|
||||
Artifact("foo", "sources") should
|
||||
${roundtrip(Artifact("foo", "sources"))}
|
||||
Artifact.pom("foo") should
|
||||
${roundtrip(Artifact.pom("foo"))}
|
||||
Artifact("foo", url("http://example.com/")) should
|
||||
${roundtrip(Artifact("foo", new URL("http://example.com/")))}
|
||||
Artifact("foo").extra(("key", "value")) should
|
||||
${roundtrip(Artifact("foo").extra(("key", "value")))}
|
||||
|
||||
ModuleID("org", "name", "1.0") should
|
||||
${roundtrip(ModuleID("org", "name", "1.0"))}
|
||||
|
||||
ModuleReport(ModuleID("org", "name", "1.0"), Nil, Nil) should
|
||||
${roundtripStr(ModuleReport(ModuleID("org", "name", "1.0"), Nil, Nil))}
|
||||
Organization artifact report should
|
||||
${roundtripStr(organizationArtifactReportExample)}
|
||||
Configuration report should
|
||||
${roundtripStr(configurationReportExample)}
|
||||
Update report should
|
||||
${roundtripStr(updateReportExample)}
|
||||
"""
|
||||
class DMSerializationSpec extends UnitSpec {
|
||||
"CrossVersion.full" should "roundtrip" in {
|
||||
roundtripStr(CrossVersion.full: CrossVersion)
|
||||
}
|
||||
"CrossVersion.binary" should "roundtrip" in {
|
||||
roundtripStr(CrossVersion.binary: CrossVersion)
|
||||
}
|
||||
"CrossVersion.Disabled" should "roundtrip" in {
|
||||
roundtrip(CrossVersion.Disabled: CrossVersion)
|
||||
}
|
||||
"""Artifact("foo")""" should "roundtrip" in {
|
||||
roundtrip(Artifact("foo"))
|
||||
}
|
||||
"""Artifact("foo", "sources")""" should "roundtrip" in {
|
||||
roundtrip(Artifact("foo", "sources"))
|
||||
}
|
||||
"""Artifact.pom("foo")""" should "roundtrip" in {
|
||||
roundtrip(Artifact.pom("foo"))
|
||||
}
|
||||
"""Artifact("foo", url("http://example.com/"))""" should "roundtrip" in {
|
||||
roundtrip(Artifact("foo", new URL("http://example.com/")))
|
||||
}
|
||||
"""Artifact("foo").extra(("key", "value"))""" should "roundtrip" in {
|
||||
roundtrip(Artifact("foo").extra(("key", "value")))
|
||||
}
|
||||
"""ModuleID("org", "name", "1.0")""" should "roundtrip" in {
|
||||
roundtrip(ModuleID("org", "name", "1.0"))
|
||||
}
|
||||
"""ModuleReport(ModuleID("org", "name", "1.0"), Nil, Nil)""" should "roundtrip" in {
|
||||
roundtripStr(ModuleReport(ModuleID("org", "name", "1.0"), Nil, Nil))
|
||||
}
|
||||
"Organization artifact report" should "roundtrip" in {
|
||||
roundtripStr(organizationArtifactReportExample)
|
||||
}
|
||||
"Configuration report" should "roundtrip" in {
|
||||
roundtripStr(configurationReportExample)
|
||||
}
|
||||
"Update report" should "roundtrip" in {
|
||||
roundtripStr(updateReportExample)
|
||||
}
|
||||
|
||||
lazy val updateReportExample =
|
||||
new UpdateReport(new File("./foo"), Vector(configurationReportExample),
|
||||
|
|
@ -53,11 +57,11 @@ class DMSerializationSpec extends Specification {
|
|||
lazy val moduleReportExample =
|
||||
ModuleReport(ModuleID("org", "name", "1.0"), Nil, Nil)
|
||||
|
||||
def roundtrip[A: Pickler: Unpickler](a: A) =
|
||||
roundtripBuilder(a) { _ must_== _ }
|
||||
def roundtripStr[A: Pickler: Unpickler](a: A) =
|
||||
roundtripBuilder(a) { _.toString must_== _.toString }
|
||||
def roundtripBuilder[A: Pickler: Unpickler](a: A)(f: (A, A) => MatchResult[Any]): MatchResult[Any] =
|
||||
def roundtrip[A: Pickler: Unpickler](a: A): Unit =
|
||||
roundtripBuilder(a) { _ shouldBe _ }
|
||||
def roundtripStr[A: Pickler: Unpickler](a: A): Unit =
|
||||
roundtripBuilder(a) { _.toString shouldBe _.toString }
|
||||
def roundtripBuilder[A: Pickler: Unpickler](a: A)(f: (A, A) => Unit): Unit =
|
||||
{
|
||||
val json = toJsonString(a)
|
||||
println(json)
|
||||
|
|
|
|||
|
|
@ -1,52 +1,42 @@
|
|||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import org.specs2._
|
||||
import sbt.internal.librarymanagement.BaseIvySpecification
|
||||
|
||||
class EvictionWarningSpec extends BaseIvySpecification {
|
||||
def is = s2"""
|
||||
// This is a specification to check the eviction warnings
|
||||
|
||||
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 $scalaVersionWarn1
|
||||
not be detected if it's diabled $scalaVersionWarn2
|
||||
print out message about the eviction $scalaVersionWarn3
|
||||
print out message about the eviction with callers $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
|
||||
|
||||
Including two (suspect) binary incompatible Java libraries to
|
||||
direct dependencies should
|
||||
be detected as eviction $javaLibWarn1
|
||||
not be detected if it's disabled $javaLibWarn2
|
||||
print out message about the eviction $javaLibWarn3
|
||||
print out message about the eviction with callers $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
|
||||
|
||||
Including two (suspect) binary compatible Java libraries to
|
||||
direct dependencies should
|
||||
not be detected as eviction $javaLibNoWarn1
|
||||
print out message about the eviction $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
|
||||
|
||||
Including two (suspect) transitively binary incompatible Java libraries to
|
||||
direct dependencies should
|
||||
be not detected as eviction $javaLibTransitiveWarn1
|
||||
be detected if it's enabled $javaLibTransitiveWarn2
|
||||
print out message about the eviction if it's enabled $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
|
||||
|
||||
Including two (suspect) binary incompatible Scala libraries to
|
||||
direct dependencies should
|
||||
be detected as eviction $scalaLibWarn1
|
||||
print out message about the eviction $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
|
||||
|
||||
Including two (suspect) binary compatible Scala libraries to
|
||||
direct dependencies should
|
||||
not be detected as eviction $scalaLibNoWarn1
|
||||
print out message about the eviction $scalaLibNoWarn2
|
||||
|
||||
Including two (suspect) transitively binary incompatible Scala libraries to
|
||||
direct dependencies should
|
||||
be not detected as eviction $scalaLibTransitiveWarn1
|
||||
be detected if it's enabled $scalaLibTransitiveWarn2
|
||||
print out message about the eviction if it's enabled $scalaLibTransitiveWarn3
|
||||
"""
|
||||
"""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
|
||||
|
||||
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
|
||||
|
|
@ -64,26 +54,26 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
|
||||
def defaultOptions = EvictionWarningOptions.default
|
||||
|
||||
import ShowLines._
|
||||
import sbt.internal.util.ShowLines._
|
||||
|
||||
def scalaVersionDeps = Seq(scala2102, akkaActor230)
|
||||
|
||||
def scalaVersionWarn1 = {
|
||||
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions, report, log).scalaEvictions must have size (1)
|
||||
EvictionWarning(m, defaultOptions, report, log).scalaEvictions should have size(1)
|
||||
}
|
||||
|
||||
def scalaVersionWarn2 = {
|
||||
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions.withWarnScalaVersionEviction(false), report, log).scalaEvictions must have size (0)
|
||||
EvictionWarning(m, defaultOptions.withWarnScalaVersionEviction(false), report, log).scalaEvictions should have size(0)
|
||||
}
|
||||
|
||||
def scalaVersionWarn3 = {
|
||||
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions, report, log).lines must_==
|
||||
EvictionWarning(m, defaultOptions, report, log).lines shouldBe
|
||||
List("Scala version was updated by one of library dependencies:",
|
||||
"\t* org.scala-lang:scala-library:2.10.2 -> 2.10.3",
|
||||
"To force scalaVersion, add the following:",
|
||||
|
|
@ -94,7 +84,7 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
def scalaVersionWarn4 = {
|
||||
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines must_==
|
||||
EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines shouldBe
|
||||
List("Scala version was updated by one of library dependencies:",
|
||||
"\t* org.scala-lang:scala-library:2.10.2 -> 2.10.3 (caller: com.typesafe.akka:akka-actor_2.10:2.3.0, com.example:foo:0.1.0)",
|
||||
"To force scalaVersion, add the following:",
|
||||
|
|
@ -106,19 +96,19 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
def javaLibWarn1 = {
|
||||
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions must have size (1)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size(1)
|
||||
}
|
||||
|
||||
def javaLibWarn2 = {
|
||||
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions.withWarnDirectEvictions(false), report, log).reportedEvictions must have size (0)
|
||||
EvictionWarning(m, defaultOptions.withWarnDirectEvictions(false), report, log).reportedEvictions should have size(0)
|
||||
}
|
||||
|
||||
def javaLibWarn3 = {
|
||||
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions, report, log).lines must_==
|
||||
EvictionWarning(m, defaultOptions, report, log).lines shouldBe
|
||||
List("There may be incompatibilities among your library dependencies.",
|
||||
"Here are some of the libraries that were evicted:",
|
||||
"\t* commons-io:commons-io:1.4 -> 2.4",
|
||||
|
|
@ -128,7 +118,7 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
def javaLibWarn4 = {
|
||||
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines must_==
|
||||
EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines shouldBe
|
||||
List("There may be incompatibilities among your library dependencies.",
|
||||
"Here are some of the libraries that were evicted:",
|
||||
"\t* commons-io:commons-io:1.4 -> 2.4 (caller: com.example:foo:0.1.0)")
|
||||
|
|
@ -138,14 +128,14 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
val deps = Seq(commonsIo14, commonsIo13)
|
||||
val m = module(defaultModuleId, deps, Some("2.10.3"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions must have size (0)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size(0)
|
||||
}
|
||||
|
||||
def javaLibNoWarn2 = {
|
||||
val deps = Seq(commonsIo14, commonsIo13)
|
||||
val m = module(defaultModuleId, deps, Some("2.10.3"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions, report, log).lines must_== Nil
|
||||
EvictionWarning(m, defaultOptions, report, log).lines shouldBe Nil
|
||||
}
|
||||
|
||||
def javaLibTransitiveDeps = Seq(unfilteredUploads080, bnfparser10)
|
||||
|
|
@ -153,19 +143,19 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
def javaLibTransitiveWarn1 = {
|
||||
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions must have size (0)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size(0)
|
||||
}
|
||||
|
||||
def javaLibTransitiveWarn2 = {
|
||||
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true), report, log).reportedEvictions must have size (1)
|
||||
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true), report, log).reportedEvictions should have size(1)
|
||||
}
|
||||
|
||||
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 must_==
|
||||
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true).withShowCallers(true), report, log).lines shouldBe
|
||||
List("There may be incompatibilities among your library dependencies.",
|
||||
"Here are some of the libraries that were evicted:",
|
||||
"\t* commons-io:commons-io:1.4 -> 2.4 (caller: ca.gobits.bnf:bnfparser:1.0, net.databinder:unfiltered-uploads_2.10:0.8.0)")
|
||||
|
|
@ -175,14 +165,14 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
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 must have size (1)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size(1)
|
||||
}
|
||||
|
||||
def scalaLibWarn2 = {
|
||||
val deps = Seq(scala2104, akkaActor214, akkaActor234)
|
||||
val m = module(defaultModuleId, deps, Some("2.10.4"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions, report, log).lines must_==
|
||||
EvictionWarning(m, defaultOptions, report, log).lines shouldBe
|
||||
List("There may be incompatibilities among your library dependencies.",
|
||||
"Here are some of the libraries that were evicted:",
|
||||
"\t* com.typesafe.akka:akka-actor_2.10:2.1.4 -> 2.3.4",
|
||||
|
|
@ -193,14 +183,14 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
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 must have size (0)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size(0)
|
||||
}
|
||||
|
||||
def scalaLibNoWarn2 = {
|
||||
val deps = Seq(scala2104, akkaActor230, akkaActor234)
|
||||
val m = module(defaultModuleId, deps, Some("2.10.4"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions, report, log).lines must_== Nil
|
||||
EvictionWarning(m, defaultOptions, report, log).lines shouldBe Nil
|
||||
}
|
||||
|
||||
def scalaLibTransitiveDeps = Seq(scala2104, bananaSesame04, akkaRemote234)
|
||||
|
|
@ -208,19 +198,19 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
def scalaLibTransitiveWarn1 = {
|
||||
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions must have size (0)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size(0)
|
||||
}
|
||||
|
||||
def scalaLibTransitiveWarn2 = {
|
||||
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true), report, log).reportedEvictions must have size (1)
|
||||
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true), report, log).reportedEvictions should have size(1)
|
||||
}
|
||||
|
||||
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 must_==
|
||||
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true).withShowCallers(true), report, log).lines shouldBe
|
||||
List("There may be incompatibilities among your library dependencies.",
|
||||
"Here are some of the libraries that were evicted:",
|
||||
"\t* com.typesafe.akka:akka-actor_2.10:2.1.4 -> 2.3.4 (caller: com.typesafe.akka:akka-remote_2.10:2.3.4, org.w3:banana-sesame_2.10:0.4, org.w3:banana-rdf_2.10:0.4)")
|
||||
|
|
|
|||
|
|
@ -1,28 +1,21 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import org.specs2._
|
||||
import sbt.internal.util.UnitSpec
|
||||
import sbt.librarymanagement._
|
||||
|
||||
class InconsistentDuplicateSpec extends Specification {
|
||||
def is = s2"""
|
||||
// This is a specification to check the inconsistent duplicate warnings
|
||||
class InconsistentDuplicateSpec extends UnitSpec {
|
||||
"Duplicate with different version" should "be warned" in {
|
||||
IvySbt.inconsistentDuplicateWarning(Seq(akkaActor214, akkaActor230)) shouldBe
|
||||
List("Multiple dependencies with the same organization/name but different versions. To avoid conflict, pick one version:",
|
||||
" * com.typesafe.akka:akka-actor:(2.1.4, 2.3.0)")
|
||||
}
|
||||
|
||||
This is a specification to check the inconsistent duplicate warnings
|
||||
|
||||
Duplicate with different version should
|
||||
be warned $warn1
|
||||
|
||||
Duplicate with same version should
|
||||
not be warned $nodupe1
|
||||
"""
|
||||
"Duplicate with same version" should "not be warned" in {
|
||||
IvySbt.inconsistentDuplicateWarning(Seq(akkaActor230Test, akkaActor230)) shouldBe Nil
|
||||
}
|
||||
|
||||
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
|
||||
def akkaActor230Test = ModuleID("com.typesafe.akka", "akka-actor", "2.3.0", Some("test")) cross CrossVersion.binary
|
||||
|
||||
def warn1 =
|
||||
IvySbt.inconsistentDuplicateWarning(Seq(akkaActor214, akkaActor230)) must_==
|
||||
List("Multiple dependencies with the same organization/name but different versions. To avoid conflict, pick one version:",
|
||||
" * com.typesafe.akka:akka-actor:(2.1.4, 2.3.0)")
|
||||
|
||||
def nodupe1 =
|
||||
IvySbt.inconsistentDuplicateWarning(Seq(akkaActor230Test, akkaActor230)) must_== Nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,73 +1,79 @@
|
|||
package sbt
|
||||
package sbt.internal.librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import org.specs2._
|
||||
import sbt.util.Logger
|
||||
import sbt.internal.util.ConsoleLogger
|
||||
import sbt.internal.util.UnitSpec
|
||||
|
||||
// http://ant.apache.org/ivy/history/2.3.0/ivyfile/dependency.html
|
||||
// http://maven.apache.org/enforcer/enforcer-rules/versionRanges.html
|
||||
class MakePomSpec extends Specification {
|
||||
def is = s2"""
|
||||
class MakePomSpec extends UnitSpec {
|
||||
// This is a specification to check the Ivy revision number conversion to pom.
|
||||
|
||||
This is a specification to check the Ivy revision number conversion to pom.
|
||||
"1.0" should "convert to 1.0" in convertTo("1.0", "1.0")
|
||||
|
||||
1.0 should
|
||||
${convertTo("1.0", "1.0")}
|
||||
"[1.0,2.0]" should "convert to [1.0,2.0]" in {
|
||||
convertTo("[1.0,2.0]", "[1.0,2.0]")
|
||||
}
|
||||
|
||||
[1.0,2.0] should
|
||||
${convertTo("[1.0,2.0]", "[1.0,2.0]")}
|
||||
"[1.0,2.0[" should "convert to [1.0,2.0)" in {
|
||||
convertTo("[1.0,2.0[", "[1.0,2.0)")
|
||||
}
|
||||
|
||||
[1.0,2.0[ should
|
||||
${convertTo("[1.0,2.0[", "[1.0,2.0)")}
|
||||
"]1.0,2.0]" should "convert to (1.0,2.0]" in {
|
||||
convertTo("]1.0,2.0]", "(1.0,2.0]")
|
||||
}
|
||||
|
||||
]1.0,2.0] should
|
||||
${convertTo("]1.0,2.0]", "(1.0,2.0]")}
|
||||
"]1.0,2.0[" should "convert to (1.0,2.0)" in {
|
||||
convertTo("]1.0,2.0[", "(1.0,2.0)")
|
||||
}
|
||||
|
||||
]1.0,2.0[ should
|
||||
${convertTo("]1.0,2.0[", "(1.0,2.0)")}
|
||||
"[1.0,)" should "convert to [1.0,)" in {
|
||||
convertTo("[1.0,)", "[1.0,)")
|
||||
}
|
||||
|
||||
[1.0,) should
|
||||
${convertTo("[1.0,)", "[1.0,)")}
|
||||
"]1.0,)" should "convert to (1.0,)" in {
|
||||
convertTo("]1.0,)", "(1.0,)")
|
||||
}
|
||||
|
||||
]1.0,) should
|
||||
${convertTo("]1.0,)", "(1.0,)")}
|
||||
"(,2.0]" should "convert to (,2.0]" in {
|
||||
convertTo("(,2.0]", "(,2.0]")
|
||||
}
|
||||
|
||||
(,2.0] should
|
||||
${convertTo("(,2.0]", "(,2.0]")}
|
||||
"(,2.0[" should "convert to (,2.0)" in {
|
||||
convertTo("(,2.0[", "(,2.0)")
|
||||
}
|
||||
|
||||
(,2.0[ should
|
||||
${convertTo("(,2.0[", "(,2.0)")}
|
||||
"1.+" should "convert to [1,2)" in {
|
||||
convertTo("1.+", "[1,2)")
|
||||
}
|
||||
|
||||
1.+ should
|
||||
${convertTo("1.+", "[1,2)")}
|
||||
"1.2.3.4.+" should "convert to [1.2.3.4,1.2.3.5)" in {
|
||||
convertTo("1.2.3.4.+", "[1.2.3.4,1.2.3.5)")
|
||||
}
|
||||
|
||||
1.2.3.4.+ should
|
||||
${convertTo("1.2.3.4.+", "[1.2.3.4,1.2.3.5)")}
|
||||
"12.31.42.+" should "convert to [12.31.42,12.31.43)" in {
|
||||
convertTo("12.31.42.+", "[12.31.42,12.31.43)")
|
||||
}
|
||||
|
||||
12.31.42.+ should
|
||||
${convertTo("12.31.42.+", "[12.31.42,12.31.43)")}
|
||||
"1.1+" should "convert to [1.1,1.2),[1.10,1.20),[1.100,1.200),[1.1000,1.2000),[1.10000,1.20000)" in {
|
||||
convertTo("1.1+", "[1.1,1.2),[1.10,1.20),[1.100,1.200),[1.1000,1.2000),[1.10000,1.20000)")
|
||||
}
|
||||
|
||||
1.1+ should
|
||||
${convertTo("1.1+", "[1.1,1.2),[1.10,1.20),[1.100,1.200),[1.1000,1.2000),[1.10000,1.20000)")}
|
||||
"1+" should "convert to [1,2),[10,20),[100,200),[1000,2000),[10000,20000)" in {
|
||||
convertTo("1+", "[1,2),[10,20),[100,200),[1000,2000),[10000,20000)")
|
||||
}
|
||||
|
||||
1+ should
|
||||
${convertTo("1+", "[1,2),[10,20),[100,200),[1000,2000),[10000,20000)")}
|
||||
"+" should "convert to [0,)" in convertTo("+", "[0,)")
|
||||
|
||||
+ should
|
||||
${convertTo("+", "[0,)")}
|
||||
|
||||
foo+ should
|
||||
${beParsedAsError("foo+")}
|
||||
"""
|
||||
"foo+" should "convert to foo+" in beParsedAsError("foo+")
|
||||
|
||||
val mp = new MakePom(ConsoleLogger())
|
||||
def convertTo(s: String, expected: String) =
|
||||
MakePom.makeDependencyVersion(s) must_== expected
|
||||
def beParsedAsError(s: String) =
|
||||
try {
|
||||
def convertTo(s: String, expected: String): Unit =
|
||||
MakePom.makeDependencyVersion(s) shouldBe expected
|
||||
def beParsedAsError(s: String): Unit =
|
||||
intercept[Throwable] {
|
||||
MakePom.makeDependencyVersion(s)
|
||||
failure
|
||||
} catch {
|
||||
case e: Throwable => success
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,21 @@
|
|||
package sbt.librarymanagement
|
||||
|
||||
import java.net.URL
|
||||
|
||||
import org.specs2.mutable.Specification
|
||||
import sbt._
|
||||
import sbt.internal.util.UnitSpec
|
||||
|
||||
object ResolverTest extends Specification {
|
||||
object ResolverTest extends UnitSpec {
|
||||
|
||||
"Resolver" should {
|
||||
"url" should {
|
||||
"propagate pattern descriptorOptional and skipConsistencyCheck." in {
|
||||
val pats = Seq("[orgPath]")
|
||||
val patsExpected = Seq("http://foo.com/test/[orgPath]")
|
||||
val patterns = Resolver.url("test", new URL("http://foo.com/test"))(Patterns(pats, pats, isMavenCompatible = false, descriptorOptional = true, skipConsistencyCheck = true)).patterns
|
||||
"Resolver url" should "propagate pattern descriptorOptional and skipConsistencyCheck." in {
|
||||
val pats = Seq("[orgPath]")
|
||||
val patsExpected = Seq("http://foo.com/test/[orgPath]")
|
||||
val patterns = Resolver.url("test", new URL("http://foo.com/test"))(Patterns(pats, pats, isMavenCompatible = false, descriptorOptional = true, skipConsistencyCheck = true)).patterns
|
||||
|
||||
patterns.ivyPatterns must equalTo(patsExpected)
|
||||
patterns.artifactPatterns must equalTo(patsExpected)
|
||||
patterns.isMavenCompatible must beFalse
|
||||
patterns.skipConsistencyCheck must beTrue
|
||||
patterns.descriptorOptional must beTrue
|
||||
}
|
||||
}
|
||||
patterns.ivyPatterns shouldBe patsExpected
|
||||
patterns.artifactPatterns shouldBe patsExpected
|
||||
patterns.isMavenCompatible shouldBe false
|
||||
assert(patterns.skipConsistencyCheck)
|
||||
assert(patterns.descriptorOptional)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,112 +1,93 @@
|
|||
package sbt
|
||||
package sbt.librarymanagement
|
||||
|
||||
import org.specs2._
|
||||
import sbt.internal.util.UnitSpec
|
||||
|
||||
class VersionNumberSpec extends Specification {
|
||||
def is = s2"""
|
||||
// This is a specification to check the version number parsing.
|
||||
class VersionNumberSpec extends UnitSpec {
|
||||
"1" should "be parsed" in beParsedAs("1", Seq(1), Seq(), Seq())
|
||||
it should "breakdown" in breakDownTo("1", Some(1))
|
||||
it should "cascade" in generateCorrectCascadingNumbers("1", Seq("1"))
|
||||
|
||||
This is a specification to check the version number parsing.
|
||||
"1.0" should "be parsed" in beParsedAs("1.0", Seq(1, 0), Seq(), Seq())
|
||||
it should "breakdown" in breakDownTo("1.0", Some(1), Some(0))
|
||||
it should "cascade" in generateCorrectCascadingNumbers("1.0", Seq("1.0"))
|
||||
|
||||
1 should
|
||||
${beParsedAs("1", Seq(1), Seq(), Seq())}
|
||||
${breakDownTo("1", Some(1))}
|
||||
${generateCorrectCascadingNumbers("1", Seq("1"))}
|
||||
"1.0.0" should "be parsed" in beParsedAs("1.0.0", Seq(1, 0, 0), Seq(), Seq())
|
||||
it should "breakdown" in breakDownTo("1.0.0", Some(1), Some(0), Some(0))
|
||||
it should "cascade" in generateCorrectCascadingNumbers("1.0.0", Seq("1.0.0", "1.0"))
|
||||
it should "be SemVer compat with 1.0.1" in beSemVerCompatWith("1.0.0", "1.0.1")
|
||||
it should "be SemVer compat with 1.1.1" in beSemVerCompatWith("1.0.0", "1.1.1")
|
||||
it should "not be SemVer compat with 2.0.0" in notBeSemVerCompatWith("1.0.0", "2.0.0")
|
||||
it should "not be SemVer compat with 1.0.0-M1" in notBeSemVerCompatWith("1.0.0", "1.0.0-M1")
|
||||
it should "be SecSeg compat with 1.0.1" in beSecSegCompatWith("1.0.0", "1.0.1")
|
||||
it should "not be SecSeg compat with 1.1.1" in notBeSecSegCompatWith("1.0.0", "1.1.1")
|
||||
it should "not be SecSeg compat with 2.0.0" in notBeSecSegCompatWith("1.0.0", "2.0.0")
|
||||
it should "not be SecSeg compat with 1.0.0-M1" in notBeSecSegCompatWith("1.0.0", "1.0.0-M1")
|
||||
|
||||
1.0 should
|
||||
${beParsedAs("1.0", Seq(1, 0), Seq(), Seq())}
|
||||
${breakDownTo("1.0", Some(1), Some(0))}
|
||||
${generateCorrectCascadingNumbers("1.0", Seq("1.0"))}
|
||||
"1.0.0.0" should "be parsed" in beParsedAs("1.0.0.0", Seq(1, 0, 0, 0), Seq(), Seq())
|
||||
it should "breakdown" in breakDownTo("1.0.0.0", Some(1), Some(0), Some(0), Some(0))
|
||||
it should "cascade" in generateCorrectCascadingNumbers("1.0.0.0", Seq("1.0.0.0", "1.0.0", "1.0"))
|
||||
|
||||
1.0.0 should
|
||||
${beParsedAs("1.0.0", Seq(1, 0, 0), Seq(), Seq())}
|
||||
${breakDownTo("1.0.0", Some(1), Some(0), Some(0))}
|
||||
${generateCorrectCascadingNumbers("1.0.0", Seq("1.0.0", "1.0"))}
|
||||
"0.12.0" should "be parsed" in beParsedAs("0.12.0", Seq(0, 12, 0), Seq(), Seq())
|
||||
it should "breakdown" in breakDownTo("0.12.0", Some(0), Some(12), Some(0))
|
||||
it should "cascade" in generateCorrectCascadingNumbers("0.12.0", Seq("0.12.0", "0.12"))
|
||||
it should "not be SemVer compat with 0.12.0-RC1" in notBeSemVerCompatWith("0.12.0", "0.12.0-RC1")
|
||||
it should "not be SemVer compat with 0.12.1" in notBeSemVerCompatWith("0.12.0", "0.12.1")
|
||||
it should "not be SemVer compat with 0.12.1-M1" in notBeSemVerCompatWith("0.12.0", "0.12.1-M1")
|
||||
it should "not be SecSeg compat with 0.12.0-RC1" in notBeSecSegCompatWith("0.12.0", "0.12.0-RC1")
|
||||
it should "be SecSeg compat with 0.12.1" in beSecSegCompatWith("0.12.0", "0.12.1")
|
||||
it should "be SecSeg compat with 0.12.1-M1" in beSecSegCompatWith("0.12.0", "0.12.1-M1")
|
||||
|
||||
${beSemVerCompatWith("1.0.0", "1.0.1")}
|
||||
${beSemVerCompatWith("1.0.0", "1.1.1")}
|
||||
${notBeSemVerCompatWith("1.0.0", "2.0.0")}
|
||||
${notBeSemVerCompatWith("1.0.0", "1.0.0-M1")}
|
||||
"0.1.0-SNAPSHOT" should "be parsed" in beParsedAs("0.1.0-SNAPSHOT", Seq(0, 1, 0), Seq("SNAPSHOT"), Seq())
|
||||
it should "cascade" in generateCorrectCascadingNumbers("0.1.0-SNAPSHOT", Seq("0.1.0-SNAPSHOT", "0.1.0", "0.1"))
|
||||
it should "be SemVer compat with 0.1.0-SNAPSHOT" in beSemVerCompatWith("0.1.0-SNAPSHOT", "0.1.0-SNAPSHOT")
|
||||
it should "not be SemVer compat with 0.1.0" in notBeSemVerCompatWith("0.1.0-SNAPSHOT", "0.1.0")
|
||||
it should "be SemVer compat with 0.1.0-SNAPSHOT+001" in beSemVerCompatWith("0.1.0-SNAPSHOT", "0.1.0-SNAPSHOT+001")
|
||||
it should "be SecSeg compat with 0.1.0-SNAPSHOT" in beSecSegCompatWith("0.1.0-SNAPSHOT", "0.1.0-SNAPSHOT")
|
||||
it should "be not SecSeg compat with 0.1.0" in notBeSecSegCompatWith("0.1.0-SNAPSHOT", "0.1.0")
|
||||
it should "be SecSeg compat with 0.1.0-SNAPSHOT+001" in beSecSegCompatWith("0.1.0-SNAPSHOT", "0.1.0-SNAPSHOT+001")
|
||||
|
||||
${beSecSegCompatWith("1.0.0", "1.0.1")}
|
||||
${notBeSecSegCompatWith("1.0.0", "1.1.1")}
|
||||
${notBeSecSegCompatWith("1.0.0", "2.0.0")}
|
||||
${notBeSecSegCompatWith("1.0.0", "1.0.0-M1")}
|
||||
"0.1.0-M1" should "be parsed" in beParsedAs("0.1.0-M1", Seq(0, 1, 0), Seq("M1"), Seq())
|
||||
it should "cascade" in generateCorrectCascadingNumbers("0.1.0-M1", Seq("0.1.0-M1", "0.1.0", "0.1"))
|
||||
|
||||
1.0.0.0 should
|
||||
${beParsedAs("1.0.0.0", Seq(1, 0, 0, 0), Seq(), Seq())}
|
||||
${breakDownTo("1.0.0.0", Some(1), Some(0), Some(0), Some(0))}
|
||||
${generateCorrectCascadingNumbers("1.0.0.0", Seq("1.0.0.0", "1.0.0", "1.0"))}
|
||||
"0.1.0-RC1" should "be parsed" in beParsedAs("0.1.0-RC1", Seq(0, 1, 0), Seq("RC1"), Seq())
|
||||
it should "cascade" in generateCorrectCascadingNumbers("0.1.0-RC1", Seq("0.1.0-RC1", "0.1.0", "0.1"))
|
||||
|
||||
0.12.0 should
|
||||
${beParsedAs("0.12.0", Seq(0, 12, 0), Seq(), Seq())}
|
||||
${breakDownTo("0.12.0", Some(0), Some(12), Some(0))}
|
||||
${generateCorrectCascadingNumbers("0.12.0", Seq("0.12.0", "0.12"))}
|
||||
|
||||
${notBeSemVerCompatWith("0.12.0", "0.12.0-RC1")}
|
||||
${notBeSemVerCompatWith("0.12.0", "0.12.1")}
|
||||
${notBeSemVerCompatWith("0.12.0", "0.12.1-M1")}
|
||||
|
||||
${notBeSecSegCompatWith("0.12.0", "0.12.0-RC1")}
|
||||
${beSecSegCompatWith("0.12.0", "0.12.1")}
|
||||
${beSecSegCompatWith("0.12.0", "0.12.1-M1")}
|
||||
|
||||
0.1.0-SNAPSHOT should
|
||||
${beParsedAs("0.1.0-SNAPSHOT", Seq(0, 1, 0), Seq("SNAPSHOT"), Seq())}
|
||||
${generateCorrectCascadingNumbers("0.1.0-SNAPSHOT", Seq("0.1.0-SNAPSHOT", "0.1.0", "0.1"))}
|
||||
|
||||
${beSemVerCompatWith("0.1.0-SNAPSHOT", "0.1.0-SNAPSHOT")}
|
||||
${notBeSemVerCompatWith("0.1.0-SNAPSHOT", "0.1.0")}
|
||||
${beSemVerCompatWith("0.1.0-SNAPSHOT", "0.1.0-SNAPSHOT+001")}
|
||||
|
||||
${beSecSegCompatWith("0.1.0-SNAPSHOT", "0.1.0-SNAPSHOT")}
|
||||
${notBeSecSegCompatWith("0.1.0-SNAPSHOT", "0.1.0")}
|
||||
${beSecSegCompatWith("0.1.0-SNAPSHOT", "0.1.0-SNAPSHOT+001")}
|
||||
|
||||
0.1.0-M1 should
|
||||
${beParsedAs("0.1.0-M1", Seq(0, 1, 0), Seq("M1"), Seq())}
|
||||
${generateCorrectCascadingNumbers("0.1.0-M1", Seq("0.1.0-M1", "0.1.0", "0.1"))}
|
||||
|
||||
0.1.0-RC1 should
|
||||
${beParsedAs("0.1.0-RC1", Seq(0, 1, 0), Seq("RC1"), Seq())}
|
||||
${generateCorrectCascadingNumbers("0.1.0-RC1", Seq("0.1.0-RC1", "0.1.0", "0.1"))}
|
||||
|
||||
0.1.0-MSERVER-1 should
|
||||
${beParsedAs("0.1.0-MSERVER-1", Seq(0, 1, 0), Seq("MSERVER", "1"), Seq())}
|
||||
${generateCorrectCascadingNumbers("0.1.0-MSERVER-1", Seq("0.1.0-MSERVER-1", "0.1.0", "0.1"))}
|
||||
"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
|
||||
${beParsedAs("2.10.4-20140115-000117-b3a-sources", Seq(2, 10, 4), Seq("20140115", "000117", "b3a", "sources"), Seq())}
|
||||
${generateCorrectCascadingNumbers("2.10.4-20140115-000117-b3a-sources", Seq("2.10.4-20140115-000117-b3a-sources", "2.10.4", "2.10"))}
|
||||
"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())
|
||||
}
|
||||
it should "cascade" in generateCorrectCascadingNumbers("2.10.4-20140115-000117-b3a-sources", Seq("2.10.4-20140115-000117-b3a-sources", "2.10.4", "2.10"))
|
||||
it should "be SemVer compat with 2.0.0" in beSemVerCompatWith("2.10.4-20140115-000117-b3a-sources", "2.0.0")
|
||||
it should "be not SecSeg compat with 2.0.0" in notBeSecSegCompatWith("2.10.4-20140115-000117-b3a-sources", "2.0.0")
|
||||
|
||||
${beSemVerCompatWith("2.10.4-20140115-000117-b3a-sources", "2.0.0")}
|
||||
"20140115000117-b3a-sources" should "be parsed" in {
|
||||
beParsedAs("20140115000117-b3a-sources", Seq(20140115000117L), Seq("b3a", "sources"), Seq())
|
||||
}
|
||||
it should "cascade" in generateCorrectCascadingNumbers("20140115000117-b3a-sources", Seq("20140115000117-b3a-sources"))
|
||||
|
||||
${notBeSecSegCompatWith("2.10.4-20140115-000117-b3a-sources", "2.0.0")}
|
||||
"1.0.0-alpha+001+002" should "be parsed" in {
|
||||
beParsedAs("1.0.0-alpha+001+002", Seq(1, 0, 0), Seq("alpha"), Seq("+001", "+002"))
|
||||
}
|
||||
it should "cascade" in generateCorrectCascadingNumbers("1.0.0-alpha+001+002", Seq("1.0.0-alpha+001+002", "1.0.0", "1.0"))
|
||||
|
||||
20140115000117-b3a-sources should
|
||||
${beParsedAs("20140115000117-b3a-sources", Seq(20140115000117L), Seq("b3a", "sources"), Seq())}
|
||||
${generateCorrectCascadingNumbers("20140115000117-b3a-sources", Seq("20140115000117-b3a-sources"))}
|
||||
"non.space.!?string" should "be parsed" in {
|
||||
beParsedAs("non.space.!?string", Seq(), Seq(), Seq("non.space.!?string"))
|
||||
}
|
||||
it should "cascade" in generateCorrectCascadingNumbers("non.space.!?string", Seq("non.space.!?string"))
|
||||
|
||||
1.0.0-alpha+001+002 should
|
||||
${beParsedAs("1.0.0-alpha+001+002", Seq(1, 0, 0), Seq("alpha"), Seq("+001", "+002"))}
|
||||
${generateCorrectCascadingNumbers("1.0.0-alpha+001+002", Seq("1.0.0-alpha+001+002", "1.0.0", "1.0"))}
|
||||
"space !?string" should "be parsed as an error" in beParsedAsError("space !?string")
|
||||
"blank string" should "be parsed as an error" in beParsedAsError("")
|
||||
|
||||
non.space.!?string should
|
||||
${beParsedAs("non.space.!?string", Seq(), Seq(), Seq("non.space.!?string"))}
|
||||
${generateCorrectCascadingNumbers("non.space.!?string", Seq("non.space.!?string"))}
|
||||
|
||||
space !?string should
|
||||
${beParsedAsError("space !?string")}
|
||||
|
||||
blank string should
|
||||
${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) =>
|
||||
(VersionNumber(ns, ts, es).toString must_== s) and
|
||||
(VersionNumber(ns, ts, es) == VersionNumber(ns, ts, es))
|
||||
(VersionNumber(ns, ts, es).toString shouldBe s)
|
||||
(VersionNumber(ns, ts, es) shouldBe VersionNumber(ns, ts, es))
|
||||
case VersionNumber(ns1, ts1, es1) =>
|
||||
sys.error(s"$ns1, $ts1, $es1")
|
||||
}
|
||||
|
|
@ -115,26 +96,26 @@ class VersionNumberSpec extends Specification {
|
|||
s match {
|
||||
case VersionNumber(ns, ts, es) =>
|
||||
val v = VersionNumber(ns, ts, es)
|
||||
(v._1 must_== major) and
|
||||
(v._2 must_== minor) and
|
||||
(v._3 must_== patch) and
|
||||
(v._4 must_== buildNumber)
|
||||
(v._1 shouldBe major)
|
||||
(v._2 shouldBe minor)
|
||||
(v._3 shouldBe patch)
|
||||
(v._4 shouldBe buildNumber)
|
||||
}
|
||||
def beParsedAsError(s: String) =
|
||||
def beParsedAsError(s: String): Unit =
|
||||
s match {
|
||||
case VersionNumber(ns1, ts1, es1) => failure
|
||||
case _ => success
|
||||
case VersionNumber(ns1, ts1, es1) => sys.error(s)
|
||||
case _ => ()
|
||||
}
|
||||
def beSemVerCompatWith(v1: String, v2: String) =
|
||||
VersionNumber.SemVer.isCompatible(VersionNumber(v1), VersionNumber(v2)) must_== true
|
||||
VersionNumber.SemVer.isCompatible(VersionNumber(v1), VersionNumber(v2)) shouldBe true
|
||||
def notBeSemVerCompatWith(v1: String, v2: String) =
|
||||
VersionNumber.SemVer.isCompatible(VersionNumber(v1), VersionNumber(v2)) must_== false
|
||||
VersionNumber.SemVer.isCompatible(VersionNumber(v1), VersionNumber(v2)) shouldBe false
|
||||
def beSecSegCompatWith(v1: String, v2: String) =
|
||||
VersionNumber.SecondSegment.isCompatible(VersionNumber(v1), VersionNumber(v2)) must_== true
|
||||
VersionNumber.SecondSegment.isCompatible(VersionNumber(v1), VersionNumber(v2)) shouldBe true
|
||||
def notBeSecSegCompatWith(v1: String, v2: String) =
|
||||
VersionNumber.SecondSegment.isCompatible(VersionNumber(v1), VersionNumber(v2)) must_== false
|
||||
VersionNumber.SecondSegment.isCompatible(VersionNumber(v1), VersionNumber(v2)) shouldBe false
|
||||
def generateCorrectCascadingNumbers(s: String, ns: Seq[String]) = {
|
||||
val versionNumbers = ns.toVector map VersionNumber.apply
|
||||
VersionNumber(s).cascadingVersions must_== versionNumbers
|
||||
VersionNumber(s).cascadingVersions shouldBe versionNumbers
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,20 +2,19 @@ import sbt._
|
|||
import Keys._
|
||||
|
||||
object Dependencies {
|
||||
val utilVersion = "1.0.0-SNAPSHOT"
|
||||
val bootstrapSbtVersion = "0.13.8"
|
||||
lazy val ioProj = "org.scala-sbt" % "io" % bootstrapSbtVersion
|
||||
lazy val utilCollection = "org.scala-sbt.util" %% "util-collection" % utilVersion
|
||||
lazy val utilLogging = "org.scala-sbt.util" %% "util-logging" % utilVersion
|
||||
lazy val scala210 = "2.10.5"
|
||||
lazy val scala211 = "2.11.7"
|
||||
|
||||
val utilVersion = "0.1.0-M3"
|
||||
val ioVersion = "1.0.0-M3"
|
||||
lazy val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
||||
lazy val utilCollection = "org.scala-sbt" %% "util-collection" % utilVersion
|
||||
lazy val utilLogging = "org.scala-sbt" %% "util-logging" % utilVersion
|
||||
lazy val utilTesting = "org.scala-sbt" %% "util-testing" % utilVersion
|
||||
|
||||
lazy val launcherInterface = "org.scala-sbt" % "launcher-interface" % "1.0.0-M1"
|
||||
lazy val ivy = "org.scala-sbt.ivy" % "ivy" % "2.3.0-sbt-927bc9ded7f8fba63297cddd0d5a3d01d6ad5d8d"
|
||||
lazy val jsch = "com.jcraft" % "jsch" % "0.1.46" intransitive ()
|
||||
lazy val sbtSerialization = "org.scala-sbt" %% "serialization" % "0.1.2"
|
||||
// lazy val sbinary = "org.scala-tools.sbinary" %% "sbinary" % "0.4.2"
|
||||
// lazy val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.11.4"
|
||||
// lazy val specs2 = "org.specs2" %% "specs2" % "2.3.11"
|
||||
// lazy val junit = "junit" % "junit" % "4.11"
|
||||
// lazy val scalaCompiler = Def.setting { "org.scala-lang" % "scala-compiler" % scalaVersion.value }
|
||||
lazy val scalaReflect = Def.setting { "org.scala-lang" % "scala-reflect" % scalaVersion.value }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
import sbt._
|
||||
import Keys._
|
||||
import sbt.IO
|
||||
|
||||
import java.io.File
|
||||
|
||||
|
||||
object Util {
|
||||
|
||||
def versionLine(version: String): String = "version=" + version
|
||||
def containsVersion(propFile: File, version: String): Boolean = IO.read(propFile).contains(versionLine(version))
|
||||
def lastCompilationTime(analysis: sbt.inc.Analysis): Long =
|
||||
{
|
||||
val lastCompilation = analysis.compilations.allCompilations.lastOption
|
||||
lastCompilation.map(_.startTime) getOrElse 0L
|
||||
}
|
||||
|
||||
def generateVersionFile(version: String, dir: File, s: TaskStreams, analysis: sbt.inc.Analysis): Seq[File] =
|
||||
{
|
||||
import java.util.{ Date, TimeZone }
|
||||
val formatter = new java.text.SimpleDateFormat("yyyyMMdd'T'HHmmss")
|
||||
formatter.setTimeZone(TimeZone.getTimeZone("GMT"))
|
||||
val timestamp = formatter.format(new Date)
|
||||
val content = versionLine(version) + "\ntimestamp=" + timestamp
|
||||
val f = dir / "xsbt.version.properties"
|
||||
if (!f.exists || f.lastModified < lastCompilationTime(analysis) || !containsVersion(f, version)) {
|
||||
s.log.info("Writing version information to " + f + " :\n" + content)
|
||||
IO.write(f, content)
|
||||
}
|
||||
f :: Nil
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")
|
||||
Loading…
Reference in New Issue