mirror of https://github.com/sbt/sbt.git
commit
984de6fe72
|
|
@ -1,3 +1,4 @@
|
||||||
|
version = 2.0.0-RC6
|
||||||
maxColumn = 100
|
maxColumn = 100
|
||||||
project.git = true
|
project.git = true
|
||||||
project.excludeFilters = [ /sbt-test/, /input_sources/, /contraband-scala/ ]
|
project.excludeFilters = [ /sbt-test/, /input_sources/, /contraband-scala/ ]
|
||||||
|
|
@ -8,3 +9,13 @@ docstrings = JavaDoc
|
||||||
|
|
||||||
# This also seems more idiomatic to include whitespace in import x.{ yyy }
|
# This also seems more idiomatic to include whitespace in import x.{ yyy }
|
||||||
spaces.inImportCurlyBraces = true
|
spaces.inImportCurlyBraces = true
|
||||||
|
|
||||||
|
# This is more idiomatic Scala.
|
||||||
|
# http://docs.scala-lang.org/style/indentation.html#methods-with-numerous-arguments
|
||||||
|
align.openParenCallSite = false
|
||||||
|
align.openParenDefnSite = false
|
||||||
|
|
||||||
|
# For better code clarity
|
||||||
|
danglingParentheses = true
|
||||||
|
|
||||||
|
trailingCommas = preserve
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ install:
|
||||||
script: sbt -Dfile.encoding=UTF8
|
script: sbt -Dfile.encoding=UTF8
|
||||||
++$TRAVIS_SCALA_VERSION!
|
++$TRAVIS_SCALA_VERSION!
|
||||||
mimaReportBinaryIssues
|
mimaReportBinaryIssues
|
||||||
scalafmt::test test:scalafmt::test sbt:scalafmt::test
|
scalafmtCheckAll
|
||||||
whitesourceCheckPolicies
|
whitesourceCheckPolicies
|
||||||
test
|
test
|
||||||
scriptedIvy
|
scriptedIvy
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ def commonSettings: Seq[Setting[_]] = Def.settings(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
inCompileAndTest(scalacOptions in console --= Vector("-Ywarn-unused-import", "-Ywarn-unused", "-Xlint")),
|
inCompileAndTest(scalacOptions in console --= Vector("-Ywarn-unused-import", "-Ywarn-unused", "-Xlint")),
|
||||||
|
scalafmtOnCompile := true,
|
||||||
|
Test / scalafmtOnCompile := true,
|
||||||
publishArtifact in Compile := true,
|
publishArtifact in Compile := true,
|
||||||
publishArtifact in Test := false,
|
publishArtifact in Test := false,
|
||||||
parallelExecution in Test := false
|
parallelExecution in Test := false
|
||||||
|
|
@ -57,7 +59,6 @@ lazy val lmRoot = (project in file("."))
|
||||||
Some(ScmInfo(url(s"https://github.com/$slug"), s"git@github.com:$slug.git"))
|
Some(ScmInfo(url(s"https://github.com/$slug"), s"git@github.com:$slug.git"))
|
||||||
},
|
},
|
||||||
bintrayPackage := "librarymanagement",
|
bintrayPackage := "librarymanagement",
|
||||||
scalafmtOnCompile in Sbt := false,
|
|
||||||
git.baseVersion := "1.3.0",
|
git.baseVersion := "1.3.0",
|
||||||
version := {
|
version := {
|
||||||
val v = version.value
|
val v = version.value
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,11 @@ import sbt.librarymanagement._
|
||||||
abstract class AbstractEngineSpec extends UnitSpec {
|
abstract class AbstractEngineSpec extends UnitSpec {
|
||||||
def cleanCache(): Unit
|
def cleanCache(): Unit
|
||||||
|
|
||||||
def module(moduleId: ModuleID,
|
def module(
|
||||||
|
moduleId: ModuleID,
|
||||||
deps: Vector[ModuleID],
|
deps: Vector[ModuleID],
|
||||||
scalaFullVersion: Option[String]): ModuleDescriptor
|
scalaFullVersion: Option[String]
|
||||||
|
): ModuleDescriptor
|
||||||
|
|
||||||
def updateEither(module: ModuleDescriptor): Either[UnresolvedWarning, UpdateReport]
|
def updateEither(module: ModuleDescriptor): Either[UnresolvedWarning, UpdateReport]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,8 @@ private[librarymanagement] abstract class SemSelAndChunkFunctions {
|
||||||
// from and to can not have an operator.
|
// from and to can not have an operator.
|
||||||
if (hasOperator(fromStr) || hasOperator(toStr)) {
|
if (hasOperator(fromStr) || hasOperator(toStr)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
s"Invalid ' - ' range, both side of comparators can not have an operator: $fromStr - $toStr")
|
s"Invalid ' - ' range, both side of comparators can not have an operator: $fromStr - $toStr"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
val from = SemComparator(fromStr)
|
val from = SemComparator(fromStr)
|
||||||
val to = SemComparator(toStr)
|
val to = SemComparator(toStr)
|
||||||
|
|
@ -33,7 +34,8 @@ private[librarymanagement] abstract class SemSelAndChunkFunctions {
|
||||||
(comparatorsBefore ++ comparatorsAfter)
|
(comparatorsBefore ++ comparatorsAfter)
|
||||||
case _ =>
|
case _ =>
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
s"Invalid ' - ' range position, both side of versions must be specified: $andClauseToken")
|
s"Invalid ' - ' range position, both side of versions must be specified: $andClauseToken"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SemSelAndChunk(comparators.flatMap(_.expandWildcard))
|
SemSelAndChunk(comparators.flatMap(_.expandWildcard))
|
||||||
|
|
@ -165,7 +167,8 @@ private[librarymanagement] abstract class SemComparatorFunctions {
|
||||||
if (hasXrangeSelector) {
|
if (hasXrangeSelector) {
|
||||||
if (tags.nonEmpty)
|
if (tags.nonEmpty)
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
s"Pre-release version requires major, minor, patch versions to be specified: $comparator")
|
s"Pre-release version requires major, minor, patch versions to be specified: $comparator"
|
||||||
|
)
|
||||||
val numbers = Seq(major, minor, patch).takeWhile {
|
val numbers = Seq(major, minor, patch).takeWhile {
|
||||||
case Some(str) => str.matches("\\d+")
|
case Some(str) => str.matches("\\d+")
|
||||||
case None => false
|
case None => false
|
||||||
|
|
@ -180,7 +183,8 @@ private[librarymanagement] abstract class SemComparatorFunctions {
|
||||||
} else {
|
} else {
|
||||||
if (tags.nonEmpty && (major.isEmpty || minor.isEmpty || patch.isEmpty))
|
if (tags.nonEmpty && (major.isEmpty || minor.isEmpty || patch.isEmpty))
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
s"Pre-release version requires major, minor, patch versions to be specified: $comparator")
|
s"Pre-release version requires major, minor, patch versions to be specified: $comparator"
|
||||||
|
)
|
||||||
val operator = opStr match {
|
val operator = opStr match {
|
||||||
case Some("<") => Lt
|
case Some("<") => Lt
|
||||||
case Some("<=") => Lte
|
case Some("<=") => Lte
|
||||||
|
|
|
||||||
|
|
@ -90,12 +90,14 @@ private[librarymanagement] abstract class ConfigurationExtra {
|
||||||
def describedAs(newDescription: String) =
|
def describedAs(newDescription: String) =
|
||||||
Configuration.of(id, name, newDescription, isPublic, extendsConfigs, transitive)
|
Configuration.of(id, name, newDescription, isPublic, extendsConfigs, transitive)
|
||||||
def extend(configs: Configuration*) =
|
def extend(configs: Configuration*) =
|
||||||
Configuration.of(id,
|
Configuration.of(
|
||||||
|
id,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
isPublic,
|
isPublic,
|
||||||
configs.toVector ++ extendsConfigs,
|
configs.toVector ++ extendsConfigs,
|
||||||
transitive)
|
transitive
|
||||||
|
)
|
||||||
def notTransitive = intransitive
|
def notTransitive = intransitive
|
||||||
def intransitive = Configuration.of(id, name, description, isPublic, extendsConfigs, false)
|
def intransitive = Configuration.of(id, name, description, isPublic, extendsConfigs, false)
|
||||||
def hide = Configuration.of(id, name, description, false, extendsConfigs, transitive)
|
def hide = Configuration.of(id, name, description, false, extendsConfigs, transitive)
|
||||||
|
|
@ -109,7 +111,8 @@ private[sbt] object ConfigurationMacro {
|
||||||
val enclosingValName = definingValName(
|
val enclosingValName = definingValName(
|
||||||
c,
|
c,
|
||||||
methodName =>
|
methodName =>
|
||||||
s"""$methodName must be directly assigned to a val, such as `val Tooling = $methodName("tooling")`.""")
|
s"""$methodName must be directly assigned to a val, such as `val Tooling = $methodName("tooling")`."""
|
||||||
|
)
|
||||||
if (enclosingValName.head.isLower) {
|
if (enclosingValName.head.isLower) {
|
||||||
c.error(c.enclosingPosition, "configuration id must be capitalized")
|
c.error(c.enclosingPosition, "configuration id must be capitalized")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,10 @@ trait ConfigurationFormats {
|
||||||
self: sbt.librarymanagement.ConfigurationFormats with sjsonnew.BasicJsonProtocol =>
|
self: sbt.librarymanagement.ConfigurationFormats with sjsonnew.BasicJsonProtocol =>
|
||||||
implicit lazy val ConfigurationFormat: JsonFormat[sbt.librarymanagement.Configuration] =
|
implicit lazy val ConfigurationFormat: JsonFormat[sbt.librarymanagement.Configuration] =
|
||||||
new JsonFormat[sbt.librarymanagement.Configuration] {
|
new JsonFormat[sbt.librarymanagement.Configuration] {
|
||||||
override def read[J](jsOpt: Option[J],
|
override def read[J](
|
||||||
unbuilder: Unbuilder[J]): sbt.librarymanagement.Configuration = {
|
jsOpt: Option[J],
|
||||||
|
unbuilder: Unbuilder[J]
|
||||||
|
): sbt.librarymanagement.Configuration = {
|
||||||
jsOpt match {
|
jsOpt match {
|
||||||
case Some(js) =>
|
case Some(js) =>
|
||||||
unbuilder.beginObject(js)
|
unbuilder.beginObject(js)
|
||||||
|
|
@ -23,12 +25,14 @@ trait ConfigurationFormats {
|
||||||
unbuilder.readField[Vector[sbt.librarymanagement.Configuration]]("extendsConfigs")
|
unbuilder.readField[Vector[sbt.librarymanagement.Configuration]]("extendsConfigs")
|
||||||
val transitive = unbuilder.readField[Boolean]("transitive")
|
val transitive = unbuilder.readField[Boolean]("transitive")
|
||||||
unbuilder.endObject()
|
unbuilder.endObject()
|
||||||
new sbt.librarymanagement.Configuration(id,
|
new sbt.librarymanagement.Configuration(
|
||||||
|
id,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
isPublic,
|
isPublic,
|
||||||
extendsConfigs,
|
extendsConfigs,
|
||||||
transitive)
|
transitive
|
||||||
|
)
|
||||||
case None =>
|
case None =>
|
||||||
deserializationError("Expected JsObject but found None")
|
deserializationError("Expected JsObject but found None")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,8 +175,10 @@ object Full {
|
||||||
trait DisabledFormats { self: sjsonnew.BasicJsonProtocol =>
|
trait DisabledFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||||
implicit lazy val DisabledFormat: JsonFormat[sbt.librarymanagement.Disabled] =
|
implicit lazy val DisabledFormat: JsonFormat[sbt.librarymanagement.Disabled] =
|
||||||
new JsonFormat[sbt.librarymanagement.Disabled] {
|
new JsonFormat[sbt.librarymanagement.Disabled] {
|
||||||
override def read[J](jsOpt: Option[J],
|
override def read[J](
|
||||||
unbuilder: Unbuilder[J]): sbt.librarymanagement.Disabled = {
|
jsOpt: Option[J],
|
||||||
|
unbuilder: Unbuilder[J]
|
||||||
|
): sbt.librarymanagement.Disabled = {
|
||||||
jsOpt match {
|
jsOpt match {
|
||||||
case Some(js) =>
|
case Some(js) =>
|
||||||
unbuilder.beginObject(js)
|
unbuilder.beginObject(js)
|
||||||
|
|
@ -196,8 +198,10 @@ trait DisabledFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||||
|
|
||||||
implicit lazy val DisabledObjectFormat: JsonFormat[sbt.librarymanagement.Disabled.type] =
|
implicit lazy val DisabledObjectFormat: JsonFormat[sbt.librarymanagement.Disabled.type] =
|
||||||
new JsonFormat[sbt.librarymanagement.Disabled.type] {
|
new JsonFormat[sbt.librarymanagement.Disabled.type] {
|
||||||
override def read[J](jsOpt: Option[J],
|
override def read[J](
|
||||||
unbuilder: Unbuilder[J]): sbt.librarymanagement.Disabled.type = {
|
jsOpt: Option[J],
|
||||||
|
unbuilder: Unbuilder[J]
|
||||||
|
): sbt.librarymanagement.Disabled.type = {
|
||||||
jsOpt match {
|
jsOpt match {
|
||||||
case Some(js) =>
|
case Some(js) =>
|
||||||
unbuilder.beginObject(js)
|
unbuilder.beginObject(js)
|
||||||
|
|
@ -219,8 +223,10 @@ trait DisabledFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||||
trait BinaryFormats { self: sjsonnew.BasicJsonProtocol =>
|
trait BinaryFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||||
implicit lazy val BinaryFormat: JsonFormat[sbt.librarymanagement.Binary] =
|
implicit lazy val BinaryFormat: JsonFormat[sbt.librarymanagement.Binary] =
|
||||||
new JsonFormat[sbt.librarymanagement.Binary] {
|
new JsonFormat[sbt.librarymanagement.Binary] {
|
||||||
override def read[J](jsOpt: Option[J],
|
override def read[J](
|
||||||
unbuilder: Unbuilder[J]): sbt.librarymanagement.Binary = {
|
jsOpt: Option[J],
|
||||||
|
unbuilder: Unbuilder[J]
|
||||||
|
): sbt.librarymanagement.Binary = {
|
||||||
jsOpt match {
|
jsOpt match {
|
||||||
case Some(js) =>
|
case Some(js) =>
|
||||||
unbuilder.beginObject(js)
|
unbuilder.beginObject(js)
|
||||||
|
|
@ -244,8 +250,10 @@ trait BinaryFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||||
trait ConstantFormats { self: sjsonnew.BasicJsonProtocol =>
|
trait ConstantFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||||
implicit lazy val ConstantFormat: JsonFormat[sbt.librarymanagement.Constant] =
|
implicit lazy val ConstantFormat: JsonFormat[sbt.librarymanagement.Constant] =
|
||||||
new JsonFormat[sbt.librarymanagement.Constant] {
|
new JsonFormat[sbt.librarymanagement.Constant] {
|
||||||
override def read[J](jsOpt: Option[J],
|
override def read[J](
|
||||||
unbuilder: Unbuilder[J]): sbt.librarymanagement.Constant = {
|
jsOpt: Option[J],
|
||||||
|
unbuilder: Unbuilder[J]
|
||||||
|
): sbt.librarymanagement.Constant = {
|
||||||
jsOpt match {
|
jsOpt match {
|
||||||
case Some(js) =>
|
case Some(js) =>
|
||||||
unbuilder.beginObject(js)
|
unbuilder.beginObject(js)
|
||||||
|
|
@ -267,8 +275,10 @@ trait ConstantFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||||
trait PatchFormats { self: sjsonnew.BasicJsonProtocol =>
|
trait PatchFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||||
implicit lazy val PatchFormat: JsonFormat[sbt.librarymanagement.Patch] =
|
implicit lazy val PatchFormat: JsonFormat[sbt.librarymanagement.Patch] =
|
||||||
new JsonFormat[sbt.librarymanagement.Patch] {
|
new JsonFormat[sbt.librarymanagement.Patch] {
|
||||||
override def read[J](jsOpt: Option[J],
|
override def read[J](
|
||||||
unbuilder: Unbuilder[J]): sbt.librarymanagement.Patch = {
|
jsOpt: Option[J],
|
||||||
|
unbuilder: Unbuilder[J]
|
||||||
|
): sbt.librarymanagement.Patch = {
|
||||||
jsOpt match {
|
jsOpt match {
|
||||||
case Some(js) =>
|
case Some(js) =>
|
||||||
unbuilder.beginObject(js)
|
unbuilder.beginObject(js)
|
||||||
|
|
@ -290,8 +300,10 @@ trait PatchFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||||
trait FullFormats { self: sjsonnew.BasicJsonProtocol =>
|
trait FullFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||||
implicit lazy val FullFormat: JsonFormat[sbt.librarymanagement.Full] =
|
implicit lazy val FullFormat: JsonFormat[sbt.librarymanagement.Full] =
|
||||||
new JsonFormat[sbt.librarymanagement.Full] {
|
new JsonFormat[sbt.librarymanagement.Full] {
|
||||||
override def read[J](jsOpt: Option[J],
|
override def read[J](
|
||||||
unbuilder: Unbuilder[J]): sbt.librarymanagement.Full = {
|
jsOpt: Option[J],
|
||||||
|
unbuilder: Unbuilder[J]
|
||||||
|
): sbt.librarymanagement.Full = {
|
||||||
jsOpt match {
|
jsOpt match {
|
||||||
case Some(js) =>
|
case Some(js) =>
|
||||||
unbuilder.beginObject(js)
|
unbuilder.beginObject(js)
|
||||||
|
|
@ -320,11 +332,13 @@ trait CrossVersionFormats {
|
||||||
with sbt.librarymanagement.PatchFormats
|
with sbt.librarymanagement.PatchFormats
|
||||||
with sbt.librarymanagement.FullFormats =>
|
with sbt.librarymanagement.FullFormats =>
|
||||||
implicit lazy val CrossVersionFormat: JsonFormat[sbt.librarymanagement.CrossVersion] =
|
implicit lazy val CrossVersionFormat: JsonFormat[sbt.librarymanagement.CrossVersion] =
|
||||||
flatUnionFormat6[sbt.librarymanagement.CrossVersion,
|
flatUnionFormat6[
|
||||||
|
sbt.librarymanagement.CrossVersion,
|
||||||
sbt.librarymanagement.Disabled,
|
sbt.librarymanagement.Disabled,
|
||||||
sbt.librarymanagement.Disabled.type,
|
sbt.librarymanagement.Disabled.type,
|
||||||
sbt.librarymanagement.Binary,
|
sbt.librarymanagement.Binary,
|
||||||
sbt.librarymanagement.Constant,
|
sbt.librarymanagement.Constant,
|
||||||
sbt.librarymanagement.Patch,
|
sbt.librarymanagement.Patch,
|
||||||
sbt.librarymanagement.Full]("type")
|
sbt.librarymanagement.Full
|
||||||
|
]("type")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,11 @@ class DependencyResolution private[sbt] (lmEngine: DependencyResolutionInterface
|
||||||
* @param configurations The configurations that this module has.
|
* @param configurations The configurations that this module has.
|
||||||
* @return A `ModuleDescriptor` describing a subproject and its dependencies.
|
* @return A `ModuleDescriptor` describing a subproject and its dependencies.
|
||||||
*/
|
*/
|
||||||
def moduleDescriptor(moduleId: ModuleID,
|
def moduleDescriptor(
|
||||||
|
moduleId: ModuleID,
|
||||||
directDependencies: Vector[ModuleID],
|
directDependencies: Vector[ModuleID],
|
||||||
scalaModuleInfo: Option[ScalaModuleInfo]): ModuleDescriptor = {
|
scalaModuleInfo: Option[ScalaModuleInfo]
|
||||||
|
): ModuleDescriptor = {
|
||||||
val moduleSetting = ModuleDescriptorConfiguration(moduleId, ModuleInfo(moduleId.name))
|
val moduleSetting = ModuleDescriptorConfiguration(moduleId, ModuleInfo(moduleId.name))
|
||||||
.withScalaModuleInfo(scalaModuleInfo)
|
.withScalaModuleInfo(scalaModuleInfo)
|
||||||
.withDependencies(directDependencies)
|
.withDependencies(directDependencies)
|
||||||
|
|
@ -49,10 +51,12 @@ class DependencyResolution private[sbt] (lmEngine: DependencyResolutionInterface
|
||||||
* @return The result, either an unresolved warning or an update report. Note that this
|
* @return The result, either an unresolved warning or an update report. Note that this
|
||||||
* update report will or will not be successful depending on the `missingOk` option.
|
* update report will or will not be successful depending on the `missingOk` option.
|
||||||
*/
|
*/
|
||||||
def update(module: ModuleDescriptor,
|
def update(
|
||||||
|
module: ModuleDescriptor,
|
||||||
configuration: UpdateConfiguration,
|
configuration: UpdateConfiguration,
|
||||||
uwconfig: UnresolvedWarningConfiguration,
|
uwconfig: UnresolvedWarningConfiguration,
|
||||||
log: Logger): Either[UnresolvedWarning, UpdateReport] =
|
log: Logger
|
||||||
|
): Either[UnresolvedWarning, UpdateReport] =
|
||||||
lmEngine.update(module, configuration, uwconfig, log)
|
lmEngine.update(module, configuration, uwconfig, log)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -71,8 +75,10 @@ class DependencyResolution private[sbt] (lmEngine: DependencyResolutionInterface
|
||||||
* @param scalaModuleInfo The information about the Scala verson used, if any.
|
* @param scalaModuleInfo The information about the Scala verson used, if any.
|
||||||
* @return A `ModuleDescriptor` that depends on `dependencyId`.
|
* @return A `ModuleDescriptor` that depends on `dependencyId`.
|
||||||
*/
|
*/
|
||||||
def wrapDependencyInModule(dependencyId: ModuleID,
|
def wrapDependencyInModule(
|
||||||
scalaModuleInfo: Option[ScalaModuleInfo]): ModuleDescriptor = {
|
dependencyId: ModuleID,
|
||||||
|
scalaModuleInfo: Option[ScalaModuleInfo]
|
||||||
|
): ModuleDescriptor = {
|
||||||
val sha1 = Hash.toHex(Hash(dependencyId.name))
|
val sha1 = Hash.toHex(Hash(dependencyId.name))
|
||||||
val dummyID = ModuleID(sbtOrgTemp, modulePrefixTemp + sha1, dependencyId.revision)
|
val dummyID = ModuleID(sbtOrgTemp, modulePrefixTemp + sha1, dependencyId.revision)
|
||||||
.withConfigurations(dependencyId.configurations)
|
.withConfigurations(dependencyId.configurations)
|
||||||
|
|
@ -88,10 +94,12 @@ class DependencyResolution private[sbt] (lmEngine: DependencyResolutionInterface
|
||||||
* @param log The logger.
|
* @param log The logger.
|
||||||
* @return The result, either an unresolved warning or a sequence of files.
|
* @return The result, either an unresolved warning or a sequence of files.
|
||||||
*/
|
*/
|
||||||
def retrieve(dependencyId: ModuleID,
|
def retrieve(
|
||||||
|
dependencyId: ModuleID,
|
||||||
scalaModuleInfo: Option[ScalaModuleInfo],
|
scalaModuleInfo: Option[ScalaModuleInfo],
|
||||||
retrieveDirectory: File,
|
retrieveDirectory: File,
|
||||||
log: Logger): Either[UnresolvedWarning, Vector[File]] =
|
log: Logger
|
||||||
|
): Either[UnresolvedWarning, Vector[File]] =
|
||||||
retrieve(wrapDependencyInModule(dependencyId, scalaModuleInfo), retrieveDirectory, log)
|
retrieve(wrapDependencyInModule(dependencyId, scalaModuleInfo), retrieveDirectory, log)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -102,9 +110,11 @@ class DependencyResolution private[sbt] (lmEngine: DependencyResolutionInterface
|
||||||
* @param log The logger.
|
* @param log The logger.
|
||||||
* @return The result, either an unresolved warning or a sequence of files.
|
* @return The result, either an unresolved warning or a sequence of files.
|
||||||
*/
|
*/
|
||||||
def retrieve(module: ModuleDescriptor,
|
def retrieve(
|
||||||
|
module: ModuleDescriptor,
|
||||||
retrieveDirectory: File,
|
retrieveDirectory: File,
|
||||||
log: Logger): Either[UnresolvedWarning, Vector[File]] = {
|
log: Logger
|
||||||
|
): Either[UnresolvedWarning, Vector[File]] = {
|
||||||
// Using the default artifact type filter here, so sources and docs are excluded.
|
// Using the default artifact type filter here, so sources and docs are excluded.
|
||||||
val retrieveConfiguration = RetrieveConfiguration()
|
val retrieveConfiguration = RetrieveConfiguration()
|
||||||
.withRetrieveDirectory(retrieveDirectory)
|
.withRetrieveDirectory(retrieveDirectory)
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,12 @@ trait DependencyResolutionInterface {
|
||||||
* @return The result, either an unresolved warning or an update report. Note that this
|
* @return The result, either an unresolved warning or an update report. Note that this
|
||||||
* update report will or will not be successful depending on the `missingOk` option.
|
* update report will or will not be successful depending on the `missingOk` option.
|
||||||
*/
|
*/
|
||||||
def update(module: ModuleDescriptor,
|
def update(
|
||||||
|
module: ModuleDescriptor,
|
||||||
configuration: UpdateConfiguration,
|
configuration: UpdateConfiguration,
|
||||||
uwconfig: UnresolvedWarningConfiguration,
|
uwconfig: UnresolvedWarningConfiguration,
|
||||||
log: Logger): Either[UnresolvedWarning, UpdateReport]
|
log: Logger
|
||||||
|
): Either[UnresolvedWarning, UpdateReport]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,11 @@ class Publisher private[sbt] (publisherEngine: PublisherInterface) {
|
||||||
* @param log The logger.
|
* @param log The logger.
|
||||||
* @return The `File` containing the POM descriptor.
|
* @return The `File` containing the POM descriptor.
|
||||||
*/
|
*/
|
||||||
def makePomFile(module: ModuleDescriptor,
|
def makePomFile(
|
||||||
|
module: ModuleDescriptor,
|
||||||
configuration: MakePomConfiguration,
|
configuration: MakePomConfiguration,
|
||||||
log: Logger): File =
|
log: Logger
|
||||||
|
): File =
|
||||||
publisherEngine.makePomFile(module, configuration, log)
|
publisherEngine.makePomFile(module, configuration, log)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,8 +169,10 @@ private[librarymanagement] abstract class ResolverFunctions {
|
||||||
* Add the local Ivy repository to the user repositories.
|
* Add the local Ivy repository to the user repositories.
|
||||||
* If `mavenCentral` is true, add the Maven Central repository.
|
* If `mavenCentral` is true, add the Maven Central repository.
|
||||||
*/
|
*/
|
||||||
def combineDefaultResolvers(userResolvers: Vector[Resolver],
|
def combineDefaultResolvers(
|
||||||
mavenCentral: Boolean): Vector[Resolver] =
|
userResolvers: Vector[Resolver],
|
||||||
|
mavenCentral: Boolean
|
||||||
|
): Vector[Resolver] =
|
||||||
combineDefaultResolvers(userResolvers, jcenter = false, mavenCentral)
|
combineDefaultResolvers(userResolvers, jcenter = false, mavenCentral)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,14 @@ final class RichUpdateReport(report: UpdateReport) {
|
||||||
val stamps = files
|
val stamps = files
|
||||||
.map(
|
.map(
|
||||||
f =>
|
f =>
|
||||||
(f,
|
(
|
||||||
|
f,
|
||||||
// TODO: The list of files may also contain some odd files that do not actually exist like:
|
// TODO: The list of files may also contain some odd files that do not actually exist like:
|
||||||
// "./target/ivyhome/resolution-cache/com.example/foo/0.4.0/resolved.xml.xml".
|
// "./target/ivyhome/resolution-cache/com.example/foo/0.4.0/resolved.xml.xml".
|
||||||
// IO.getModifiedTimeOrZero() will just return zero, but the list of files should not contain such
|
// IO.getModifiedTimeOrZero() will just return zero, but the list of files should not contain such
|
||||||
// files to begin with, in principle.
|
// files to begin with, in principle.
|
||||||
IO.getModifiedTimeOrZero(f))
|
IO.getModifiedTimeOrZero(f)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
.toMap
|
.toMap
|
||||||
UpdateReport(report.cachedDescriptor, report.configurations, report.stats, stamps)
|
UpdateReport(report.cachedDescriptor, report.configurations, report.stats, stamps)
|
||||||
|
|
|
||||||
|
|
@ -74,24 +74,32 @@ private[librarymanagement] abstract class ModuleReportExtra {
|
||||||
reportStr(
|
reportStr(
|
||||||
"extraAttributes",
|
"extraAttributes",
|
||||||
if (extraAttributes.isEmpty) None
|
if (extraAttributes.isEmpty) None
|
||||||
else { Some(extraAttributes.toString) }
|
else {
|
||||||
|
Some(extraAttributes.toString)
|
||||||
|
}
|
||||||
) +
|
) +
|
||||||
reportStr("isDefault", isDefault map { _.toString }) +
|
reportStr("isDefault", isDefault map { _.toString }) +
|
||||||
reportStr("branch", branch) +
|
reportStr("branch", branch) +
|
||||||
reportStr(
|
reportStr(
|
||||||
"configurations",
|
"configurations",
|
||||||
if (configurations.isEmpty) None
|
if (configurations.isEmpty) None
|
||||||
else { Some(configurations.mkString(", ")) }
|
else {
|
||||||
|
Some(configurations.mkString(", "))
|
||||||
|
}
|
||||||
) +
|
) +
|
||||||
reportStr(
|
reportStr(
|
||||||
"licenses",
|
"licenses",
|
||||||
if (licenses.isEmpty) None
|
if (licenses.isEmpty) None
|
||||||
else { Some(licenses.mkString(", ")) }
|
else {
|
||||||
|
Some(licenses.mkString(", "))
|
||||||
|
}
|
||||||
) +
|
) +
|
||||||
reportStr(
|
reportStr(
|
||||||
"callers",
|
"callers",
|
||||||
if (callers.isEmpty) None
|
if (callers.isEmpty) None
|
||||||
else { Some(callers.mkString(", ")) }
|
else {
|
||||||
|
Some(callers.mkString(", "))
|
||||||
|
}
|
||||||
)
|
)
|
||||||
private[sbt] def reportStr(key: String, value: Option[String]): String =
|
private[sbt] def reportStr(key: String, value: Option[String]): String =
|
||||||
value map { x =>
|
value map { x =>
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,14 @@ object ResolverTest extends UnitSpec {
|
||||||
val patsExpected = Vector("http://foo.com/test/[orgPath]")
|
val patsExpected = Vector("http://foo.com/test/[orgPath]")
|
||||||
val patterns = Resolver
|
val patterns = Resolver
|
||||||
.url("test", new URL("http://foo.com/test"))(
|
.url("test", new URL("http://foo.com/test"))(
|
||||||
Patterns(pats,
|
Patterns(
|
||||||
|
pats,
|
||||||
pats,
|
pats,
|
||||||
isMavenCompatible = false,
|
isMavenCompatible = false,
|
||||||
descriptorOptional = true,
|
descriptorOptional = true,
|
||||||
skipConsistencyCheck = true))
|
skipConsistencyCheck = true
|
||||||
|
)
|
||||||
|
)
|
||||||
.patterns
|
.patterns
|
||||||
|
|
||||||
patterns.ivyPatterns shouldBe patsExpected
|
patterns.ivyPatterns shouldBe patsExpected
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,9 @@ class ComponentManager(
|
||||||
def files(id: String)(ifMissing: IfMissing): Iterable[File] = {
|
def files(id: String)(ifMissing: IfMissing): Iterable[File] = {
|
||||||
def fromGlobal =
|
def fromGlobal =
|
||||||
lockGlobalCache {
|
lockGlobalCache {
|
||||||
try { update(id); getOrElse(createAndCache) } catch {
|
try {
|
||||||
|
update(id); getOrElse(createAndCache)
|
||||||
|
} catch {
|
||||||
case _: NotInCache => createAndCache
|
case _: NotInCache => createAndCache
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -100,7 +102,11 @@ object ComponentManager {
|
||||||
lazy val (version, timestamp) = {
|
lazy val (version, timestamp) = {
|
||||||
val properties = new java.util.Properties
|
val properties = new java.util.Properties
|
||||||
val propertiesStream = versionResource.openStream
|
val propertiesStream = versionResource.openStream
|
||||||
try { properties.load(propertiesStream) } finally { propertiesStream.close() }
|
try {
|
||||||
|
properties.load(propertiesStream)
|
||||||
|
} finally {
|
||||||
|
propertiesStream.close()
|
||||||
|
}
|
||||||
(properties.getProperty("version"), properties.getProperty("timestamp"))
|
(properties.getProperty("version"), properties.getProperty("timestamp"))
|
||||||
}
|
}
|
||||||
lazy val stampedVersion = version + "_" + timestamp
|
lazy val stampedVersion = version + "_" + timestamp
|
||||||
|
|
|
||||||
|
|
@ -246,9 +246,11 @@ private[sbt] object ConvertResolver {
|
||||||
def managedChecksumsEnabled: Boolean
|
def managedChecksumsEnabled: Boolean
|
||||||
|
|
||||||
import sbt.io.syntax._
|
import sbt.io.syntax._
|
||||||
private def downloadChecksum(resource: Resource,
|
private def downloadChecksum(
|
||||||
|
resource: Resource,
|
||||||
targetChecksumFile: File,
|
targetChecksumFile: File,
|
||||||
algorithm: String): Boolean = {
|
algorithm: String
|
||||||
|
): Boolean = {
|
||||||
if (!ChecksumHelper.isKnownAlgorithm(algorithm))
|
if (!ChecksumHelper.isKnownAlgorithm(algorithm))
|
||||||
throw new IllegalArgumentException(s"Unknown checksum algorithm: $algorithm")
|
throw new IllegalArgumentException(s"Unknown checksum algorithm: $algorithm")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,8 +178,9 @@ private[sbt] class FakeResolver(private var name: String, cacheDir: File, module
|
||||||
val artifact =
|
val artifact =
|
||||||
for {
|
for {
|
||||||
artifacts <- modules get ((moduleOrganisation, moduleName, moduleRevision))
|
artifacts <- modules get ((moduleOrganisation, moduleName, moduleRevision))
|
||||||
artifact <- artifacts find (a =>
|
artifact <- artifacts find (
|
||||||
a.name == art.getName && a.tpe == art.getType && a.ext == art.getExt)
|
a => a.name == art.getName && a.tpe == art.getType && a.ext == art.getExt
|
||||||
|
)
|
||||||
} yield new ArtifactOrigin(art, /* isLocal = */ true, artifact.file.toURI.toURL.toString)
|
} yield new ArtifactOrigin(art, /* isLocal = */ true, artifact.file.toURI.toURL.toString)
|
||||||
|
|
||||||
artifact.orNull
|
artifact.orNull
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,11 @@ final class IvySbt(
|
||||||
IvySbt.synchronized {
|
IvySbt.synchronized {
|
||||||
val originalLogger = Message.getDefaultLogger
|
val originalLogger = Message.getDefaultLogger
|
||||||
Message.setDefaultLogger(logger)
|
Message.setDefaultLogger(logger)
|
||||||
try { f } finally { Message.setDefaultLogger(originalLogger) }
|
try {
|
||||||
|
f
|
||||||
|
} finally {
|
||||||
|
Message.setDefaultLogger(originalLogger)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Ivy is not thread-safe nor can the cache be used concurrently.
|
// Ivy is not thread-safe nor can the cache be used concurrently.
|
||||||
// If provided a GlobalLock, we can use that to ensure safe access to the cache.
|
// If provided a GlobalLock, we can use that to ensure safe access to the cache.
|
||||||
|
|
@ -207,7 +211,9 @@ final class IvySbt(
|
||||||
ivyint.ErrorMessageAuthenticator.install()
|
ivyint.ErrorMessageAuthenticator.install()
|
||||||
ivy.pushContext()
|
ivy.pushContext()
|
||||||
ivy.getLoggerEngine.pushLogger(log)
|
ivy.getLoggerEngine.pushLogger(log)
|
||||||
try { f(ivy) } finally {
|
try {
|
||||||
|
f(ivy)
|
||||||
|
} finally {
|
||||||
ivy.getLoggerEngine.popLogger()
|
ivy.getLoggerEngine.popLogger()
|
||||||
ivy.popContext()
|
ivy.popContext()
|
||||||
}
|
}
|
||||||
|
|
@ -275,7 +281,8 @@ final class IvySbt(
|
||||||
IvySbt.setConflictManager(moduleID, conflictManager, ivy.getSettings)
|
IvySbt.setConflictManager(moduleID, conflictManager, ivy.getSettings)
|
||||||
val defaultConf = defaultConfiguration getOrElse Configuration.of(
|
val defaultConf = defaultConfiguration getOrElse Configuration.of(
|
||||||
"Default",
|
"Default",
|
||||||
ModuleDescriptor.DEFAULT_CONFIGURATION)
|
ModuleDescriptor.DEFAULT_CONFIGURATION
|
||||||
|
)
|
||||||
log.debug(
|
log.debug(
|
||||||
s"Using inline dependencies specified in Scala${(if (ivyXML.isEmpty) "" else " and XML")}."
|
s"Using inline dependencies specified in Scala${(if (ivyXML.isEmpty) "" else " and XML")}."
|
||||||
)
|
)
|
||||||
|
|
@ -729,9 +736,11 @@ private[sbt] object IvySbt {
|
||||||
allConfigurations: Vector[ConfigRef]
|
allConfigurations: Vector[ConfigRef]
|
||||||
): MDArtifact = {
|
): MDArtifact = {
|
||||||
val artifact = new MDArtifact(moduleID, a.name, a.`type`, a.extension, null, extra(a, false))
|
val artifact = new MDArtifact(moduleID, a.name, a.`type`, a.extension, null, extra(a, false))
|
||||||
copyConfigurations(a,
|
copyConfigurations(
|
||||||
|
a,
|
||||||
(ref: ConfigRef) => { artifact.addConfiguration(ref.name) },
|
(ref: ConfigRef) => { artifact.addConfiguration(ref.name) },
|
||||||
allConfigurations)
|
allConfigurations
|
||||||
|
)
|
||||||
artifact
|
artifact
|
||||||
}
|
}
|
||||||
def getExtraAttributes(revID: ExtendableItem): Map[String, String] = {
|
def getExtraAttributes(revID: ExtendableItem): Map[String, String] = {
|
||||||
|
|
@ -995,7 +1004,8 @@ private[sbt] object IvySbt {
|
||||||
): Unit = excludes.foreach(exclude => addExclude(moduleID, scalaModuleInfo)(exclude))
|
): Unit = excludes.foreach(exclude => addExclude(moduleID, scalaModuleInfo)(exclude))
|
||||||
|
|
||||||
def addExclude(moduleID: DefaultModuleDescriptor, scalaModuleInfo: Option[ScalaModuleInfo])(
|
def addExclude(moduleID: DefaultModuleDescriptor, scalaModuleInfo: Option[ScalaModuleInfo])(
|
||||||
exclude0: ExclusionRule): Unit = {
|
exclude0: ExclusionRule
|
||||||
|
): Unit = {
|
||||||
// this adds _2.11 postfix
|
// this adds _2.11 postfix
|
||||||
val exclude = CrossVersion.substituteCross(exclude0, scalaModuleInfo)
|
val exclude = CrossVersion.substituteCross(exclude0, scalaModuleInfo)
|
||||||
val confs =
|
val confs =
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,11 @@ object IvyActions {
|
||||||
): T = {
|
): T = {
|
||||||
val previous = resolver.getChecksumAlgorithms
|
val previous = resolver.getChecksumAlgorithms
|
||||||
resolver.setChecksums(checksums mkString ",")
|
resolver.setChecksums(checksums mkString ",")
|
||||||
try { act } finally { resolver.setChecksums(previous mkString ",") }
|
try {
|
||||||
|
act
|
||||||
|
} finally {
|
||||||
|
resolver.setChecksums(previous mkString ",")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private def crossVersionMap(moduleSettings: ModuleSettings): Option[String => String] =
|
private def crossVersionMap(moduleSettings: ModuleSettings): Option[String => String] =
|
||||||
moduleSettings match {
|
moduleSettings match {
|
||||||
|
|
@ -367,12 +371,14 @@ object IvyActions {
|
||||||
resolveOptions.setTransitive(false)
|
resolveOptions.setTransitive(false)
|
||||||
resolveOptions.setCheckIfChanged(false)
|
resolveOptions.setCheckIfChanged(false)
|
||||||
}
|
}
|
||||||
resolver.customResolve(descriptor,
|
resolver.customResolve(
|
||||||
|
descriptor,
|
||||||
missingOk,
|
missingOk,
|
||||||
updateConfiguration.logicalClock,
|
updateConfiguration.logicalClock,
|
||||||
resolveOptions,
|
resolveOptions,
|
||||||
cache,
|
cache,
|
||||||
log)
|
log
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private def retrieve(
|
private def retrieve(
|
||||||
|
|
@ -496,7 +502,11 @@ object IvyActions {
|
||||||
resolver.commitPublishTransaction()
|
resolver.commitPublishTransaction()
|
||||||
} catch {
|
} catch {
|
||||||
case e: Throwable =>
|
case e: Throwable =>
|
||||||
try { resolver.abortPublishTransaction() } finally { throw e }
|
try {
|
||||||
|
resolver.abortPublishTransaction()
|
||||||
|
} finally {
|
||||||
|
throw e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,9 @@ class IvyCache(val ivyHome: Option[File]) {
|
||||||
|
|
||||||
/** Clears the cache of the jar for the given ID.*/
|
/** Clears the cache of the jar for the given ID.*/
|
||||||
def clearCachedJar(id: ModuleID, lock: Option[xsbti.GlobalLock], log: Logger): Unit = {
|
def clearCachedJar(id: ModuleID, lock: Option[xsbti.GlobalLock], log: Logger): Unit = {
|
||||||
try { withCachedJar(id, lock, log)(_.delete); () } catch {
|
try {
|
||||||
|
withCachedJar(id, lock, log)(_.delete); ()
|
||||||
|
} catch {
|
||||||
case e: Exception => log.debug("Error cleaning cached jar: " + e.toString)
|
case e: Exception => log.debug("Error cleaning cached jar: " + e.toString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,8 @@ class MakePom(val log: Logger) {
|
||||||
if (k == PomExtraDependencyAttributes.ExtraAttributesKey) xmlSpacePreserve
|
if (k == PomExtraDependencyAttributes.ExtraAttributesKey) xmlSpacePreserve
|
||||||
else scala.xml.Null
|
else scala.xml.Null
|
||||||
<properties> {
|
<properties> {
|
||||||
for ((key, value) <- extra) yield (<x>{ value }</x>).copy(label = key, attributes = _extraAttributes(key))
|
for ((key, value) <- extra)
|
||||||
|
yield (<x>{value}</x>).copy(label = key, attributes = _extraAttributes(key))
|
||||||
} </properties>
|
} </properties>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -244,18 +245,34 @@ class MakePom(val log: Logger) {
|
||||||
def xmlSpacePreserve = new PrefixedAttribute("xml", "space", "preserve", scala.xml.Null)
|
def xmlSpacePreserve = new PrefixedAttribute("xml", "space", "preserve", scala.xml.Null)
|
||||||
|
|
||||||
def description(d: String) =
|
def description(d: String) =
|
||||||
if ((d eq null) || d.isEmpty) NodeSeq.Empty else <description>{ d }</description>
|
if ((d eq null) || d.isEmpty) NodeSeq.Empty
|
||||||
|
else
|
||||||
|
<description>{
|
||||||
|
d
|
||||||
|
}</description>
|
||||||
def licenses(ls: Array[License]) =
|
def licenses(ls: Array[License]) =
|
||||||
if (ls == null || ls.isEmpty) NodeSeq.Empty else <licenses>{ ls.map(license) }</licenses>
|
if (ls == null || ls.isEmpty) NodeSeq.Empty
|
||||||
|
else
|
||||||
|
<licenses>{
|
||||||
|
ls.map(license)
|
||||||
|
}</licenses>
|
||||||
def license(l: License) =
|
def license(l: License) =
|
||||||
<license>
|
<license>
|
||||||
<name>{l.getName}</name>
|
<name>{l.getName}</name>
|
||||||
<url>{l.getUrl}</url>
|
<url>{l.getUrl}</url>
|
||||||
<distribution>repo</distribution>
|
<distribution>repo</distribution>
|
||||||
</license>
|
</license>
|
||||||
def homePage(homePage: String) = if (homePage eq null) NodeSeq.Empty else <url>{ homePage }</url>
|
def homePage(homePage: String) =
|
||||||
|
if (homePage eq null) NodeSeq.Empty
|
||||||
|
else
|
||||||
|
<url>{
|
||||||
|
homePage
|
||||||
|
}</url>
|
||||||
def revision(version: String) =
|
def revision(version: String) =
|
||||||
if (version ne null) <version>{ version }</version> else NodeSeq.Empty
|
if (version ne null) <version>{
|
||||||
|
version
|
||||||
|
}</version>
|
||||||
|
else NodeSeq.Empty
|
||||||
def packaging(module: ModuleDescriptor) =
|
def packaging(module: ModuleDescriptor) =
|
||||||
module.getAllArtifacts match {
|
module.getAllArtifacts match {
|
||||||
case Array() => "pom"
|
case Array() => "pom"
|
||||||
|
|
@ -286,7 +303,9 @@ class MakePom(val log: Logger) {
|
||||||
NodeSeq.Empty
|
NodeSeq.Empty
|
||||||
else
|
else
|
||||||
<dependencies>
|
<dependencies>
|
||||||
{ dependencies.map(makeDependency(_, includeTypes, excludes)) }
|
{
|
||||||
|
dependencies.map(makeDependency(_, includeTypes, excludes))
|
||||||
|
}
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@deprecated("Use `makeDependency` variant which takes excludes", "0.13.9")
|
@deprecated("Use `makeDependency` variant which takes excludes", "0.13.9")
|
||||||
|
|
@ -426,7 +445,9 @@ class MakePom(val log: Logger) {
|
||||||
val excl = dependency.getExcludeRules(dependency.getModuleConfigurations) ++ excludes
|
val excl = dependency.getExcludeRules(dependency.getModuleConfigurations) ++ excludes
|
||||||
val (warns, excls) = IvyUtil.separate(excl.map(makeExclusion))
|
val (warns, excls) = IvyUtil.separate(excl.map(makeExclusion))
|
||||||
if (warns.nonEmpty) log.warn(warns.mkString(IO.Newline))
|
if (warns.nonEmpty) log.warn(warns.mkString(IO.Newline))
|
||||||
if (excls.nonEmpty) <exclusions>{ excls }</exclusions>
|
if (excls.nonEmpty) <exclusions>{
|
||||||
|
excls
|
||||||
|
}</exclusions>
|
||||||
else NodeSeq.Empty
|
else NodeSeq.Empty
|
||||||
}
|
}
|
||||||
def makeExclusion(exclRule: ExcludeRule): Either[String, NodeSeq] = {
|
def makeExclusion(exclRule: ExcludeRule): Either[String, NodeSeq] = {
|
||||||
|
|
@ -466,7 +487,10 @@ class MakePom(val log: Logger) {
|
||||||
}
|
}
|
||||||
val repositoryElements = mavenRepositories.filter(filterRepositories).map(mavenRepository)
|
val repositoryElements = mavenRepositories.filter(filterRepositories).map(mavenRepository)
|
||||||
if (repositoryElements.isEmpty) repositoryElements
|
if (repositoryElements.isEmpty) repositoryElements
|
||||||
else <repositories>{ repositoryElements }</repositories>
|
else
|
||||||
|
<repositories>{
|
||||||
|
repositoryElements
|
||||||
|
}</repositories>
|
||||||
}
|
}
|
||||||
def allResolvers(settings: IvySettings): Seq[DependencyResolver] =
|
def allResolvers(settings: IvySettings): Seq[DependencyResolver] =
|
||||||
flatten(castResolvers(settings.getResolvers)).distinct
|
flatten(castResolvers(settings.getResolvers)).distinct
|
||||||
|
|
|
||||||
|
|
@ -188,11 +188,13 @@ private[sbt] class CachedResolutionResolveCache {
|
||||||
val (pathOrg, pathName, pathRevision, pathScalaVersion, pathSbtVersion) = md match {
|
val (pathOrg, pathName, pathRevision, pathScalaVersion, pathSbtVersion) = md match {
|
||||||
case x: ArtificialModuleDescriptor =>
|
case x: ArtificialModuleDescriptor =>
|
||||||
val tmrid = x.targetModuleRevisionId
|
val tmrid = x.targetModuleRevisionId
|
||||||
(tmrid.getOrganisation,
|
(
|
||||||
|
tmrid.getOrganisation,
|
||||||
tmrid.getName,
|
tmrid.getName,
|
||||||
tmrid.getRevision + "_" + mrid.getName,
|
tmrid.getRevision + "_" + mrid.getName,
|
||||||
scalaVersion(tmrid),
|
scalaVersion(tmrid),
|
||||||
sbtVersion(tmrid))
|
sbtVersion(tmrid)
|
||||||
|
)
|
||||||
case _ =>
|
case _ =>
|
||||||
(mrid.getOrganisation, mrid.getName, mrid.getRevision, scalaVersion(mrid), sbtVersion(mrid))
|
(mrid.getOrganisation, mrid.getName, mrid.getRevision, scalaVersion(mrid), sbtVersion(mrid))
|
||||||
}
|
}
|
||||||
|
|
@ -328,7 +330,9 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
||||||
val ivy = makeInstance
|
val ivy = makeInstance
|
||||||
ivy.pushContext()
|
ivy.pushContext()
|
||||||
ivy.getLoggerEngine.pushLogger(log)
|
ivy.getLoggerEngine.pushLogger(log)
|
||||||
try { f(ivy) } finally {
|
try {
|
||||||
|
f(ivy)
|
||||||
|
} finally {
|
||||||
ivy.getLoggerEngine.popLogger()
|
ivy.getLoggerEngine.popLogger()
|
||||||
ivy.popContext()
|
ivy.popContext()
|
||||||
}
|
}
|
||||||
|
|
@ -336,7 +340,11 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
||||||
def withDefaultLogger[A](log: MessageLogger)(f: => A): A = {
|
def withDefaultLogger[A](log: MessageLogger)(f: => A): A = {
|
||||||
val originalLogger = Message.getDefaultLogger
|
val originalLogger = Message.getDefaultLogger
|
||||||
Message.setDefaultLogger(log)
|
Message.setDefaultLogger(log)
|
||||||
try { f } finally { Message.setDefaultLogger(originalLogger) }
|
try {
|
||||||
|
f
|
||||||
|
} finally {
|
||||||
|
Message.setDefaultLogger(originalLogger)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -488,8 +496,10 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
||||||
case (failed, paths) =>
|
case (failed, paths) =>
|
||||||
if (paths.isEmpty) (failed, paths)
|
if (paths.isEmpty) (failed, paths)
|
||||||
else
|
else
|
||||||
(failed,
|
(
|
||||||
List(IvyRetrieve.toModuleID(md0.getResolvedModuleRevisionId)) ::: paths.toList.tail)
|
failed,
|
||||||
|
List(IvyRetrieve.toModuleID(md0.getResolvedModuleRevisionId)) ::: paths.toList.tail
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
new ResolveException(messages, failed, ListMap(failedPaths: _*))
|
new ResolveException(messages, failed, ListMap(failedPaths: _*))
|
||||||
|
|
@ -577,8 +587,9 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
||||||
((organization, name), xs)
|
((organization, name), xs)
|
||||||
}: _*)
|
}: _*)
|
||||||
// this returns a List of Lists of (org, name). should be deterministic
|
// this returns a List of Lists of (org, name). should be deterministic
|
||||||
def detectLoops(allModules: Map[(String, String), Vector[OrganizationArtifactReport]])
|
def detectLoops(
|
||||||
: List[List[(String, String)]] = {
|
allModules: Map[(String, String), Vector[OrganizationArtifactReport]]
|
||||||
|
): List[List[(String, String)]] = {
|
||||||
val loopSets: mutable.Set[Set[(String, String)]] = mutable.Set.empty
|
val loopSets: mutable.Set[Set[(String, String)]] = mutable.Set.empty
|
||||||
val loopLists: mutable.ListBuffer[List[(String, String)]] = mutable.ListBuffer.empty
|
val loopLists: mutable.ListBuffer[List[(String, String)]] = mutable.ListBuffer.empty
|
||||||
def testLoop(
|
def testLoop(
|
||||||
|
|
@ -949,8 +960,9 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
||||||
val configurations0: Vector[ConfigurationReport] = ur.configurations.toVector
|
val configurations0: Vector[ConfigurationReport] = ur.configurations.toVector
|
||||||
// This is how md looks from md0 via dd's mapping.
|
// This is how md looks from md0 via dd's mapping.
|
||||||
val remappedConfigs0: Map[String, Vector[String]] = Map(rootModuleConfs map { conf0 =>
|
val remappedConfigs0: Map[String, Vector[String]] = Map(rootModuleConfs map { conf0 =>
|
||||||
val remapped
|
val remapped: Vector[String] = dd
|
||||||
: Vector[String] = dd.getDependencyConfigurations(conf0.getName).toVector flatMap { conf =>
|
.getDependencyConfigurations(conf0.getName)
|
||||||
|
.toVector flatMap { conf =>
|
||||||
node.getRealConfs(conf).toVector
|
node.getRealConfs(conf).toVector
|
||||||
}
|
}
|
||||||
conf0.getName -> remapped
|
conf0.getName -> remapped
|
||||||
|
|
|
||||||
|
|
@ -52,12 +52,16 @@ class GigahorseUrlHandler(http: OkHttpClient) extends AbstractURLHandler {
|
||||||
if (checkStatusCode(url, response)) {
|
if (checkStatusCode(url, response)) {
|
||||||
val bodyCharset =
|
val bodyCharset =
|
||||||
BasicURLHandler.getCharSetFromContentType(
|
BasicURLHandler.getCharSetFromContentType(
|
||||||
Option(response.body().contentType()).map(_.toString).orNull)
|
Option(response.body().contentType()).map(_.toString).orNull
|
||||||
|
)
|
||||||
Some(
|
Some(
|
||||||
new SbtUrlInfo(true,
|
new SbtUrlInfo(
|
||||||
|
true,
|
||||||
response.body().contentLength(),
|
response.body().contentLength(),
|
||||||
lastModifiedTimestamp(response),
|
lastModifiedTimestamp(response),
|
||||||
bodyCharset))
|
bodyCharset
|
||||||
|
)
|
||||||
|
)
|
||||||
} else None
|
} else None
|
||||||
//
|
//
|
||||||
// Commented out for now - can potentially be used for non HTTP urls
|
// Commented out for now - can potentially be used for non HTTP urls
|
||||||
|
|
@ -75,7 +79,8 @@ class GigahorseUrlHandler(http: OkHttpClient) extends AbstractURLHandler {
|
||||||
Message.warn("Host " + e.getMessage + " not found. url=" + url)
|
Message.warn("Host " + e.getMessage + " not found. url=" + url)
|
||||||
Message.info(
|
Message.info(
|
||||||
"You probably access the destination server through "
|
"You probably access the destination server through "
|
||||||
+ "a proxy server that is not well configured.")
|
+ "a proxy server that is not well configured."
|
||||||
|
)
|
||||||
None
|
None
|
||||||
case e: IOException =>
|
case e: IOException =>
|
||||||
Message.error("Server access Error: " + e.getMessage + " url=" + url)
|
Message.error("Server access Error: " + e.getMessage + " url=" + url)
|
||||||
|
|
@ -106,7 +111,8 @@ class GigahorseUrlHandler(http: OkHttpClient) extends AbstractURLHandler {
|
||||||
if (!checkStatusCode(url, response)) {
|
if (!checkStatusCode(url, response)) {
|
||||||
throw new IOException(
|
throw new IOException(
|
||||||
"The HTTP response code for " + url + " did not indicate a success."
|
"The HTTP response code for " + url + " did not indicate a success."
|
||||||
+ " See log for more detail.")
|
+ " See log for more detail."
|
||||||
|
)
|
||||||
}
|
}
|
||||||
response
|
response
|
||||||
} catch {
|
} catch {
|
||||||
|
|
@ -145,7 +151,8 @@ class GigahorseUrlHandler(http: OkHttpClient) extends AbstractURLHandler {
|
||||||
IO.delete(dest)
|
IO.delete(dest)
|
||||||
throw new IOException(
|
throw new IOException(
|
||||||
"Downloaded file size doesn't match expected Content Length for " + url
|
"Downloaded file size doesn't match expected Content Length for " + url
|
||||||
+ ". Please retry.")
|
+ ". Please retry."
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val lastModified = lastModifiedTimestamp(response)
|
val lastModified = lastModifiedTimestamp(response)
|
||||||
|
|
@ -198,11 +205,12 @@ class GigahorseUrlHandler(http: OkHttpClient) extends AbstractURLHandler {
|
||||||
|
|
||||||
object GigahorseUrlHandler {
|
object GigahorseUrlHandler {
|
||||||
// This is requires to access the constructor of URLInfo.
|
// This is requires to access the constructor of URLInfo.
|
||||||
private[sbt] class SbtUrlInfo(available: Boolean,
|
private[sbt] class SbtUrlInfo(
|
||||||
|
available: Boolean,
|
||||||
contentLength: Long,
|
contentLength: Long,
|
||||||
lastModified: Long,
|
lastModified: Long,
|
||||||
bodyCharset: String)
|
bodyCharset: String
|
||||||
extends URLInfo(available, contentLength, lastModified, bodyCharset) {
|
) extends URLInfo(available, contentLength, lastModified, bodyCharset) {
|
||||||
def this(available: Boolean, contentLength: Long, lastModified: Long) = {
|
def this(available: Boolean, contentLength: Long, lastModified: Long) = {
|
||||||
this(available, contentLength, lastModified, null)
|
this(available, contentLength, lastModified, null)
|
||||||
}
|
}
|
||||||
|
|
@ -220,7 +228,8 @@ object GigahorseUrlHandler {
|
||||||
Message.warn("Your proxy requires authentication.")
|
Message.warn("Your proxy requires authentication.")
|
||||||
} else if (status == 401) {
|
} else if (status == 401) {
|
||||||
Message.warn(
|
Message.warn(
|
||||||
"CLIENT ERROR: 401 Unauthorized. Check your resolvers username and password.")
|
"CLIENT ERROR: 401 Unauthorized. Check your resolvers username and password."
|
||||||
|
)
|
||||||
} else if (String.valueOf(status).startsWith("4")) {
|
} else if (String.valueOf(status).startsWith("4")) {
|
||||||
Message.verbose("CLIENT ERROR: " + response.message() + " url=" + url)
|
Message.verbose("CLIENT ERROR: " + response.message() + " url=" + url)
|
||||||
} else if (String.valueOf(status).startsWith("5")) {
|
} else if (String.valueOf(status).startsWith("5")) {
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,11 @@ import org.apache.ivy.util.filter.Filter
|
||||||
import scala.concurrent.duration.Duration
|
import scala.concurrent.duration.Duration
|
||||||
import scala.concurrent.{ Await, ExecutionContext, Future }
|
import scala.concurrent.{ Await, ExecutionContext, Future }
|
||||||
|
|
||||||
private[ivyint] case class DownloadResult(dep: IvyNode,
|
private[ivyint] case class DownloadResult(
|
||||||
|
dep: IvyNode,
|
||||||
report: DownloadReport,
|
report: DownloadReport,
|
||||||
totalSizeDownloaded: Long)
|
totalSizeDownloaded: Long
|
||||||
|
)
|
||||||
|
|
||||||
object ParallelResolveEngine {
|
object ParallelResolveEngine {
|
||||||
private lazy val resolveExecutionContext: ExecutionContext = {
|
private lazy val resolveExecutionContext: ExecutionContext = {
|
||||||
|
|
@ -28,14 +30,17 @@ object ParallelResolveEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Define an ivy [[ResolveEngine]] that resolves dependencies in parallel. */
|
/** Define an ivy [[ResolveEngine]] that resolves dependencies in parallel. */
|
||||||
private[sbt] class ParallelResolveEngine(settings: ResolveEngineSettings,
|
private[sbt] class ParallelResolveEngine(
|
||||||
|
settings: ResolveEngineSettings,
|
||||||
eventManager: EventManager,
|
eventManager: EventManager,
|
||||||
sortEngine: SortEngine)
|
sortEngine: SortEngine
|
||||||
extends ResolveEngine(settings, eventManager, sortEngine) {
|
) extends ResolveEngine(settings, eventManager, sortEngine) {
|
||||||
|
|
||||||
override def downloadArtifacts(report: ResolveReport,
|
override def downloadArtifacts(
|
||||||
|
report: ResolveReport,
|
||||||
artifactFilter: Filter,
|
artifactFilter: Filter,
|
||||||
options: DownloadOptions): Unit = {
|
options: DownloadOptions
|
||||||
|
): Unit = {
|
||||||
import scala.collection.JavaConverters._
|
import scala.collection.JavaConverters._
|
||||||
val start = System.currentTimeMillis
|
val start = System.currentTimeMillis
|
||||||
report.getArtifacts match {
|
report.getArtifacts match {
|
||||||
|
|
@ -82,9 +87,11 @@ private[sbt] class ParallelResolveEngine(settings: ResolveEngineSettings,
|
||||||
*
|
*
|
||||||
* Return the report and the total downloaded size.
|
* Return the report and the total downloaded size.
|
||||||
*/
|
*/
|
||||||
private def downloadNodeArtifacts(dependency: IvyNode,
|
private def downloadNodeArtifacts(
|
||||||
|
dependency: IvyNode,
|
||||||
artifactFilter: Filter,
|
artifactFilter: Filter,
|
||||||
options: DownloadOptions): DownloadResult = {
|
options: DownloadOptions
|
||||||
|
): DownloadResult = {
|
||||||
|
|
||||||
val resolver = dependency.getModuleRevision.getArtifactResolver
|
val resolver = dependency.getModuleRevision.getArtifactResolver
|
||||||
val selectedArtifacts = dependency.getSelectedArtifacts(artifactFilter)
|
val selectedArtifacts = dependency.getSelectedArtifacts(artifactFilter)
|
||||||
|
|
|
||||||
|
|
@ -94,9 +94,11 @@ private[sbt] case class SbtChainResolver(
|
||||||
|
|
||||||
/** Implements the custom sbt chain resolution with support for snapshots and caching. */
|
/** Implements the custom sbt chain resolution with support for snapshots and caching. */
|
||||||
private object CustomSbtResolution {
|
private object CustomSbtResolution {
|
||||||
def getCached(dd: DependencyDescriptor,
|
def getCached(
|
||||||
|
dd: DependencyDescriptor,
|
||||||
data: ResolveData,
|
data: ResolveData,
|
||||||
resolved0: Option[ResolvedModuleRevision]): Option[ResolvedModuleRevision] = {
|
resolved0: Option[ResolvedModuleRevision]
|
||||||
|
): Option[ResolvedModuleRevision] = {
|
||||||
resolved0.orElse {
|
resolved0.orElse {
|
||||||
val resolverName = getName
|
val resolverName = getName
|
||||||
Message.verbose(s"$resolverName: Checking cache for: $dd")
|
Message.verbose(s"$resolverName: Checking cache for: $dd")
|
||||||
|
|
@ -144,7 +146,8 @@ private[sbt] case class SbtChainResolver(
|
||||||
var currentlyResolved = resolved0
|
var currentlyResolved = resolved0
|
||||||
|
|
||||||
def performResolution(
|
def performResolution(
|
||||||
resolver: DependencyResolver): Option[(ResolvedModuleRevision, DependencyResolver)] = {
|
resolver: DependencyResolver
|
||||||
|
): Option[(ResolvedModuleRevision, DependencyResolver)] = {
|
||||||
// Resolve all resolvers when the module is changing
|
// Resolve all resolvers when the module is changing
|
||||||
val previouslyResolved = currentlyResolved
|
val previouslyResolved = currentlyResolved
|
||||||
if (useLatest) data.setCurrentResolvedModuleRevision(null)
|
if (useLatest) data.setCurrentResolvedModuleRevision(null)
|
||||||
|
|
@ -152,8 +155,9 @@ private[sbt] case class SbtChainResolver(
|
||||||
currentlyResolved = Option(resolver.getDependency(descriptor, data))
|
currentlyResolved = Option(resolver.getDependency(descriptor, data))
|
||||||
if (currentlyResolved eq previouslyResolved) None
|
if (currentlyResolved eq previouslyResolved) None
|
||||||
else if (useLatest) {
|
else if (useLatest) {
|
||||||
currentlyResolved.map(x =>
|
currentlyResolved.map(
|
||||||
(reparseModuleDescriptor(descriptor, data, resolver, x), resolver))
|
x => (reparseModuleDescriptor(descriptor, data, resolver, x), resolver)
|
||||||
|
)
|
||||||
} else currentlyResolved.map(x => (forcedRevision(x), resolver))
|
} else currentlyResolved.map(x => (forcedRevision(x), resolver))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -179,9 +183,11 @@ private[sbt] case class SbtChainResolver(
|
||||||
}
|
}
|
||||||
|
|
||||||
private final val prefix = "Undefined resolution order"
|
private final val prefix = "Undefined resolution order"
|
||||||
def resolveLatest(foundRevisions: Seq[(ResolvedModuleRevision, DependencyResolver)],
|
def resolveLatest(
|
||||||
|
foundRevisions: Seq[(ResolvedModuleRevision, DependencyResolver)],
|
||||||
descriptor: DependencyDescriptor,
|
descriptor: DependencyDescriptor,
|
||||||
data: ResolveData): Option[ResolvedModuleRevision] = {
|
data: ResolveData
|
||||||
|
): Option[ResolvedModuleRevision] = {
|
||||||
|
|
||||||
val sortedRevisions = foundRevisions.sortBy {
|
val sortedRevisions = foundRevisions.sortBy {
|
||||||
case (rmr, resolver) =>
|
case (rmr, resolver) =>
|
||||||
|
|
@ -220,13 +226,15 @@ private[sbt] case class SbtChainResolver(
|
||||||
if (resolvedModule.getId.getRevision.contains("SNAPSHOT")) {
|
if (resolvedModule.getId.getRevision.contains("SNAPSHOT")) {
|
||||||
|
|
||||||
Message.warn(
|
Message.warn(
|
||||||
"Resolving a snapshot version. It's going to be slow unless you use `updateOptions := updateOptions.value.withLatestSnapshots(false)` options.")
|
"Resolving a snapshot version. It's going to be slow unless you use `updateOptions := updateOptions.value.withLatestSnapshots(false)` options."
|
||||||
|
)
|
||||||
val resolvers = sortedRevisions.map(_._2.getName)
|
val resolvers = sortedRevisions.map(_._2.getName)
|
||||||
sortedRevisions.foreach(h => {
|
sortedRevisions.foreach(h => {
|
||||||
val (module, resolver) = h
|
val (module, resolver) = h
|
||||||
Message.info(
|
Message.info(
|
||||||
s"Out of ${sortedRevisions.size} candidates we found for ${module.getId} in ${resolvers
|
s"Out of ${sortedRevisions.size} candidates we found for ${module.getId} in ${resolvers
|
||||||
.mkString(" and ")}, we are choosing ${resolver}.")
|
.mkString(" and ")}, we are choosing ${resolver}."
|
||||||
|
)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Message.warn(s"Choosing $resolver for ${resolvedModule.getId}")
|
Message.warn(s"Choosing $resolver for ${resolvedModule.getId}")
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,12 @@ class IvyDependencyResolution private[sbt] (val ivySbt: IvySbt)
|
||||||
new Module(moduleSetting)
|
new Module(moduleSetting)
|
||||||
}
|
}
|
||||||
|
|
||||||
override def update(module: ModuleDescriptor,
|
override def update(
|
||||||
|
module: ModuleDescriptor,
|
||||||
configuration: UpdateConfiguration,
|
configuration: UpdateConfiguration,
|
||||||
uwconfig: UnresolvedWarningConfiguration,
|
uwconfig: UnresolvedWarningConfiguration,
|
||||||
log: Logger): Either[UnresolvedWarning, UpdateReport] =
|
log: Logger
|
||||||
|
): Either[UnresolvedWarning, UpdateReport] =
|
||||||
IvyActions.updateEither(toModule(module), configuration, uwconfig, log)
|
IvyActions.updateEither(toModule(module), configuration, uwconfig, log)
|
||||||
|
|
||||||
private[sbt] def toModule(module: ModuleDescriptor): Module =
|
private[sbt] def toModule(module: ModuleDescriptor): Module =
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,18 @@ class IvyPublisher private[sbt] (val ivySbt: IvySbt) extends PublisherInterface
|
||||||
new Module(moduleSetting)
|
new Module(moduleSetting)
|
||||||
}
|
}
|
||||||
|
|
||||||
override def makePomFile(module: ModuleDescriptor,
|
override def makePomFile(
|
||||||
|
module: ModuleDescriptor,
|
||||||
configuration: MakePomConfiguration,
|
configuration: MakePomConfiguration,
|
||||||
log: Logger): File =
|
log: Logger
|
||||||
|
): File =
|
||||||
IvyActions.makePomFile(toModule(module), configuration, log)
|
IvyActions.makePomFile(toModule(module), configuration, log)
|
||||||
|
|
||||||
override def publish(module: ModuleDescriptor,
|
override def publish(
|
||||||
|
module: ModuleDescriptor,
|
||||||
configuration: PublishConfiguration,
|
configuration: PublishConfiguration,
|
||||||
log: Logger): Unit =
|
log: Logger
|
||||||
|
): Unit =
|
||||||
IvyActions.publish(toModule(module), configuration, log)
|
IvyActions.publish(toModule(module), configuration, log)
|
||||||
|
|
||||||
private[sbt] def toModule(module: ModuleDescriptor): Module =
|
private[sbt] def toModule(module: ModuleDescriptor): Module =
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,11 @@ import sbt.librarymanagement._
|
||||||
import sbt.librarymanagement.ivy._
|
import sbt.librarymanagement.ivy._
|
||||||
|
|
||||||
trait BaseCachedResolutionSpec extends BaseIvySpecification {
|
trait BaseCachedResolutionSpec extends BaseIvySpecification {
|
||||||
override def module(moduleId: ModuleID,
|
override def module(
|
||||||
|
moduleId: ModuleID,
|
||||||
deps: Vector[ModuleID],
|
deps: Vector[ModuleID],
|
||||||
scalaFullVersion: Option[String]): ModuleDescriptor = {
|
scalaFullVersion: Option[String]
|
||||||
|
): ModuleDescriptor = {
|
||||||
val uo: UpdateOptions = UpdateOptions()
|
val uo: UpdateOptions = UpdateOptions()
|
||||||
.withCachedResolution(true)
|
.withCachedResolution(true)
|
||||||
module(moduleId, deps, scalaFullVersion, uo, true)
|
module(moduleId, deps, scalaFullVersion, uo, true)
|
||||||
|
|
|
||||||
|
|
@ -24,17 +24,21 @@ trait BaseIvySpecification extends AbstractEngineSpec {
|
||||||
|
|
||||||
def configurations = Vector(Compile, Test, Runtime)
|
def configurations = Vector(Compile, Test, Runtime)
|
||||||
|
|
||||||
def module(moduleId: ModuleID,
|
def module(
|
||||||
|
moduleId: ModuleID,
|
||||||
deps: Vector[ModuleID],
|
deps: Vector[ModuleID],
|
||||||
scalaFullVersion: Option[String]): ModuleDescriptor = {
|
scalaFullVersion: Option[String]
|
||||||
|
): ModuleDescriptor = {
|
||||||
module(moduleId, deps, scalaFullVersion, UpdateOptions(), true)
|
module(moduleId, deps, scalaFullVersion, UpdateOptions(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
def module(moduleId: ModuleID,
|
def module(
|
||||||
|
moduleId: ModuleID,
|
||||||
deps: Vector[ModuleID],
|
deps: Vector[ModuleID],
|
||||||
scalaFullVersion: Option[String],
|
scalaFullVersion: Option[String],
|
||||||
uo: UpdateOptions = UpdateOptions(),
|
uo: UpdateOptions = UpdateOptions(),
|
||||||
overrideScalaVersion: Boolean = true): IvySbt#Module = {
|
overrideScalaVersion: Boolean = true
|
||||||
|
): IvySbt#Module = {
|
||||||
val scalaModuleInfo = scalaFullVersion map { fv =>
|
val scalaModuleInfo = scalaFullVersion map { fv =>
|
||||||
ScalaModuleInfo(
|
ScalaModuleInfo(
|
||||||
scalaFullVersion = fv,
|
scalaFullVersion = fv,
|
||||||
|
|
@ -71,8 +75,10 @@ trait BaseIvySpecification extends AbstractEngineSpec {
|
||||||
.withUpdateOptions(uo)
|
.withUpdateOptions(uo)
|
||||||
}
|
}
|
||||||
|
|
||||||
def makeUpdateConfiguration(offline: Boolean,
|
def makeUpdateConfiguration(
|
||||||
metadataDirectory: Option[File]): UpdateConfiguration = {
|
offline: Boolean,
|
||||||
|
metadataDirectory: Option[File]
|
||||||
|
): UpdateConfiguration = {
|
||||||
val retrieveConfig = RetrieveConfiguration()
|
val retrieveConfig = RetrieveConfiguration()
|
||||||
.withRetrieveDirectory(currentManaged)
|
.withRetrieveDirectory(currentManaged)
|
||||||
.withOutputPattern(Resolver.defaultRetrievePattern)
|
.withOutputPattern(Resolver.defaultRetrievePattern)
|
||||||
|
|
@ -108,8 +114,10 @@ trait BaseIvySpecification extends AbstractEngineSpec {
|
||||||
def ivyUpdate(module: ModuleDescriptor): UpdateReport =
|
def ivyUpdate(module: ModuleDescriptor): UpdateReport =
|
||||||
update(module)
|
update(module)
|
||||||
|
|
||||||
def mkPublishConfiguration(resolver: Resolver,
|
def mkPublishConfiguration(
|
||||||
artifacts: Map[Artifact, File]): PublishConfiguration = {
|
resolver: Resolver,
|
||||||
|
artifacts: Map[Artifact, File]
|
||||||
|
): PublishConfiguration = {
|
||||||
PublishConfiguration()
|
PublishConfiguration()
|
||||||
.withResolverName(resolver.name)
|
.withResolverName(resolver.name)
|
||||||
.withArtifacts(artifacts.toVector)
|
.withArtifacts(artifacts.toVector)
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,9 @@ class ComponentManagerTest extends UnitSpec {
|
||||||
withManagerHome(ivyHome) { usingManager =>
|
withManagerHome(ivyHome) { usingManager =>
|
||||||
checksum(usingManager.file(TestID)(Fail)) shouldBe hash
|
checksum(usingManager.file(TestID)(Fail)) shouldBe hash
|
||||||
}
|
}
|
||||||
} finally { definingManager.clearCache(TestID) }
|
} finally {
|
||||||
|
definingManager.clearCache(TestID)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +84,8 @@ class ComponentManagerTest extends UnitSpec {
|
||||||
private def createFile[T](manager: ComponentManager, id: String, name: String)(f: File => T): T =
|
private def createFile[T](manager: ComponentManager, id: String, name: String)(f: File => T): T =
|
||||||
createFiles(manager, id, name)(files => f(files.toList.head))
|
createFiles(manager, id, name)(files => f(files.toList.head))
|
||||||
private def createFiles[T](manager: ComponentManager, id: String, names: String*)(
|
private def createFiles[T](manager: ComponentManager, id: String, names: String*)(
|
||||||
f: Seq[File] => T): T =
|
f: Seq[File] => T
|
||||||
|
): T =
|
||||||
withTemporaryDirectory { dir =>
|
withTemporaryDirectory { dir =>
|
||||||
val files = names.map(name => new File(dir, name))
|
val files = names.map(name => new File(dir, name))
|
||||||
files.foreach(writeRandomContent)
|
files.foreach(writeRandomContent)
|
||||||
|
|
@ -113,7 +116,8 @@ class ComponentManagerTest extends UnitSpec {
|
||||||
val location = componentLocation(id)
|
val location = componentLocation(id)
|
||||||
if (location.exists)
|
if (location.exists)
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
s"Cannot redefine component. ID: $id, files: ${files.mkString(",")}")
|
s"Cannot redefine component. ID: $id, files: ${files.mkString(",")}"
|
||||||
|
)
|
||||||
else {
|
else {
|
||||||
IO.copy(files.map { f =>
|
IO.copy(files.map { f =>
|
||||||
f -> new java.io.File(location, f.getName)
|
f -> new java.io.File(location, f.getName)
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,18 @@ class DMSerializationSpec extends UnitSpec {
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy val updateReportExample =
|
lazy val updateReportExample =
|
||||||
UpdateReport(new File("./foo"),
|
UpdateReport(
|
||||||
|
new File("./foo"),
|
||||||
Vector(configurationReportExample),
|
Vector(configurationReportExample),
|
||||||
UpdateStats(0, 0, 0, false),
|
UpdateStats(0, 0, 0, false),
|
||||||
Map(new File("./foo") -> 0))
|
Map(new File("./foo") -> 0)
|
||||||
|
)
|
||||||
lazy val configurationReportExample =
|
lazy val configurationReportExample =
|
||||||
ConfigurationReport(ConfigRef("compile"),
|
ConfigurationReport(
|
||||||
|
ConfigRef("compile"),
|
||||||
Vector(moduleReportExample),
|
Vector(moduleReportExample),
|
||||||
Vector(organizationArtifactReportExample))
|
Vector(organizationArtifactReportExample)
|
||||||
|
)
|
||||||
lazy val organizationArtifactReportExample =
|
lazy val organizationArtifactReportExample =
|
||||||
OrganizationArtifactReport("org", "name", Vector(moduleReportExample))
|
OrganizationArtifactReport("org", "name", Vector(moduleReportExample))
|
||||||
lazy val moduleReportExample =
|
lazy val moduleReportExample =
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,8 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
||||||
val m2 = "org.scala-sbt" % "util-logging_2.12" % "1.1.0"
|
val m2 = "org.scala-sbt" % "util-logging_2.12" % "1.1.0"
|
||||||
assert(
|
assert(
|
||||||
EvictionWarningOptions
|
EvictionWarningOptions
|
||||||
.defaultGuess((m1, Option(m2), Option(dummyScalaModuleInfo("2.12.4")))))
|
.defaultGuess((m1, Option(m2), Option(dummyScalaModuleInfo("2.12.4"))))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
def akkaActor214 =
|
def akkaActor214 =
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ class FrozenModeSpec extends BaseIvySpecification {
|
||||||
val toExplicitResolve = module(defaultModuleId, explicitStoml, None, normalOptions)
|
val toExplicitResolve = module(defaultModuleId, explicitStoml, None, normalOptions)
|
||||||
val frozenResolution = update(toExplicitResolve, frozenConf)
|
val frozenResolution = update(toExplicitResolve, frozenConf)
|
||||||
assert(frozenResolution.isRight)
|
assert(frozenResolution.isRight)
|
||||||
assert(frozenResolution.right.get.allModules.size == numberResolved,
|
assert(
|
||||||
s"The number of explicit modules in frozen mode should be equal than $numberResolved")
|
frozenResolution.right.get.allModules.size == numberResolved,
|
||||||
|
s"The number of explicit modules in frozen mode should be equal than $numberResolved"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,19 +61,23 @@ class IvyRepoSpec extends BaseIvySpecification {
|
||||||
val clMod = {
|
val clMod = {
|
||||||
val externalModules = Vector(dep)
|
val externalModules = Vector(dep)
|
||||||
// Note: need to extract ourModuleID so we can plug it in here, can't fish it back out of the IvySbt#Module (`m`)
|
// Note: need to extract ourModuleID so we can plug it in here, can't fish it back out of the IvySbt#Module (`m`)
|
||||||
GetClassifiersModule(ourModuleID,
|
GetClassifiersModule(
|
||||||
|
ourModuleID,
|
||||||
scalaModuleInfo,
|
scalaModuleInfo,
|
||||||
externalModules,
|
externalModules,
|
||||||
Vector(Configurations.Compile),
|
Vector(Configurations.Compile),
|
||||||
attemptedClassifiers)
|
attemptedClassifiers
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val artifactFilter = getArtifactTypeFilter(c.artifactFilter)
|
val artifactFilter = getArtifactTypeFilter(c.artifactFilter)
|
||||||
val gcm = GetClassifiersConfiguration(clMod,
|
val gcm = GetClassifiersConfiguration(
|
||||||
|
clMod,
|
||||||
Vector.empty,
|
Vector.empty,
|
||||||
c.withArtifactFilter(artifactFilter.invert),
|
c.withArtifactFilter(artifactFilter.invert),
|
||||||
srcTypes,
|
srcTypes,
|
||||||
docTypes)
|
docTypes
|
||||||
|
)
|
||||||
|
|
||||||
val report2 =
|
val report2 =
|
||||||
lmEngine()
|
lmEngine()
|
||||||
|
|
|
||||||
|
|
@ -25,51 +25,81 @@ class ScalaOverrideTest extends UnitSpec {
|
||||||
}
|
}
|
||||||
|
|
||||||
"""OverrideScalaMediator
|
"""OverrideScalaMediator
|
||||||
""" should "Override compiler version" in check(Organization, "2.11.8")(Organization,
|
""" should "Override compiler version" in check(Organization, "2.11.8")(
|
||||||
|
Organization,
|
||||||
CompilerID,
|
CompilerID,
|
||||||
"2.11.9")
|
"2.11.9"
|
||||||
it should "Override library version" in check(Organization, "2.11.8")(Organization,
|
)
|
||||||
|
it should "Override library version" in check(Organization, "2.11.8")(
|
||||||
|
Organization,
|
||||||
LibraryID,
|
LibraryID,
|
||||||
"2.11.8")
|
"2.11.8"
|
||||||
it should "Override reflect version" in check(Organization, "2.11.8")(Organization,
|
)
|
||||||
|
it should "Override reflect version" in check(Organization, "2.11.8")(
|
||||||
|
Organization,
|
||||||
ReflectID,
|
ReflectID,
|
||||||
"2.11.7")
|
"2.11.7"
|
||||||
it should "Override actors version" in check(Organization, "2.11.8")(Organization,
|
)
|
||||||
|
it should "Override actors version" in check(Organization, "2.11.8")(
|
||||||
|
Organization,
|
||||||
ActorsID,
|
ActorsID,
|
||||||
"2.11.6")
|
"2.11.6"
|
||||||
it should "Override scalap version" in check(Organization, "2.11.8")(Organization,
|
)
|
||||||
|
it should "Override scalap version" in check(Organization, "2.11.8")(
|
||||||
|
Organization,
|
||||||
ScalapID,
|
ScalapID,
|
||||||
"2.11.5")
|
"2.11.5"
|
||||||
|
)
|
||||||
|
|
||||||
it should "Override default compiler organization" in check(OtherOrgID, "2.11.8")(Organization,
|
it should "Override default compiler organization" in check(OtherOrgID, "2.11.8")(
|
||||||
|
Organization,
|
||||||
CompilerID,
|
CompilerID,
|
||||||
"2.11.9")
|
"2.11.9"
|
||||||
it should "Override default library organization" in check(OtherOrgID, "2.11.8")(Organization,
|
)
|
||||||
|
it should "Override default library organization" in check(OtherOrgID, "2.11.8")(
|
||||||
|
Organization,
|
||||||
LibraryID,
|
LibraryID,
|
||||||
"2.11.8")
|
"2.11.8"
|
||||||
it should "Override default reflect organization" in check(OtherOrgID, "2.11.8")(Organization,
|
)
|
||||||
|
it should "Override default reflect organization" in check(OtherOrgID, "2.11.8")(
|
||||||
|
Organization,
|
||||||
ReflectID,
|
ReflectID,
|
||||||
"2.11.7")
|
"2.11.7"
|
||||||
it should "Override default actors organization" in check(OtherOrgID, "2.11.8")(Organization,
|
)
|
||||||
|
it should "Override default actors organization" in check(OtherOrgID, "2.11.8")(
|
||||||
|
Organization,
|
||||||
ActorsID,
|
ActorsID,
|
||||||
"2.11.6")
|
"2.11.6"
|
||||||
it should "Override default scalap organization" in check(OtherOrgID, "2.11.8")(Organization,
|
)
|
||||||
|
it should "Override default scalap organization" in check(OtherOrgID, "2.11.8")(
|
||||||
|
Organization,
|
||||||
ScalapID,
|
ScalapID,
|
||||||
"2.11.5")
|
"2.11.5"
|
||||||
|
)
|
||||||
|
|
||||||
it should "Override custom compiler organization" in check(Organization, "2.11.8")(OtherOrgID,
|
it should "Override custom compiler organization" in check(Organization, "2.11.8")(
|
||||||
|
OtherOrgID,
|
||||||
CompilerID,
|
CompilerID,
|
||||||
"2.11.9")
|
"2.11.9"
|
||||||
it should "Override custom library organization" in check(Organization, "2.11.8")(OtherOrgID,
|
)
|
||||||
|
it should "Override custom library organization" in check(Organization, "2.11.8")(
|
||||||
|
OtherOrgID,
|
||||||
LibraryID,
|
LibraryID,
|
||||||
"2.11.8")
|
"2.11.8"
|
||||||
it should "Override custom reflect organization" in check(Organization, "2.11.8")(OtherOrgID,
|
)
|
||||||
|
it should "Override custom reflect organization" in check(Organization, "2.11.8")(
|
||||||
|
OtherOrgID,
|
||||||
ReflectID,
|
ReflectID,
|
||||||
"2.11.7")
|
"2.11.7"
|
||||||
it should "Override custom actors organization" in check(Organization, "2.11.8")(OtherOrgID,
|
)
|
||||||
|
it should "Override custom actors organization" in check(Organization, "2.11.8")(
|
||||||
|
OtherOrgID,
|
||||||
ActorsID,
|
ActorsID,
|
||||||
"2.11.6")
|
"2.11.6"
|
||||||
it should "Override custom scalap organization" in check(Organization, "2.11.8")(OtherOrgID,
|
)
|
||||||
|
it should "Override custom scalap organization" in check(Organization, "2.11.8")(
|
||||||
|
OtherOrgID,
|
||||||
ScalapID,
|
ScalapID,
|
||||||
"2.11.5")
|
"2.11.5"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.8")
|
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.9")
|
||||||
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.15")
|
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.0")
|
||||||
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.2")
|
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.2")
|
||||||
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.9")
|
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.14")
|
||||||
|
|
||||||
scalacOptions += "-language:postfixOps"
|
scalacOptions += "-language:postfixOps"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue