mirror of https://github.com/sbt/sbt.git
integrate assumedVersionScheme and assumedEvictionErrorLevel
Fixes https://github.com/sbt/sbt/issues/6301 Fixes https://github.com/sbt/sbt/issues/6302 ```scala ThisBuild / assumedVersionScheme := VersionScheme.PVP ThisBuild / assumedVersionSchemeJava := VersionScheme.EarlySemVer ThisBuild / assumedEvictionErrorLevel := Level.Warn ```
This commit is contained in:
parent
dffa34c3ec
commit
6c18a37d3f
|
|
@ -2785,6 +2785,9 @@ object Classpaths {
|
||||||
libraryDependencies :== Nil,
|
libraryDependencies :== Nil,
|
||||||
libraryDependencySchemes :== Nil,
|
libraryDependencySchemes :== Nil,
|
||||||
evictionErrorLevel :== Level.Error,
|
evictionErrorLevel :== Level.Error,
|
||||||
|
assumedEvictionErrorLevel :== Level.Info,
|
||||||
|
assumedVersionScheme :== VersionScheme.Always,
|
||||||
|
assumedVersionSchemeJava :== VersionScheme.Always,
|
||||||
excludeDependencies :== Nil,
|
excludeDependencies :== Nil,
|
||||||
ivyLoggingLevel := (// This will suppress "Resolving..." logs on Jenkins and Travis.
|
ivyLoggingLevel := (// This will suppress "Resolving..." logs on Jenkins and Travis.
|
||||||
if (insideCI.value)
|
if (insideCI.value)
|
||||||
|
|
@ -3592,6 +3595,9 @@ object Classpaths {
|
||||||
uwConfig = (unresolvedWarningConfiguration in update).value,
|
uwConfig = (unresolvedWarningConfiguration in update).value,
|
||||||
evictionLevel = evictionErrorLevel.value,
|
evictionLevel = evictionErrorLevel.value,
|
||||||
versionSchemeOverrides = libraryDependencySchemes.value,
|
versionSchemeOverrides = libraryDependencySchemes.value,
|
||||||
|
assumedEvictionErrorLevel = assumedEvictionErrorLevel.value,
|
||||||
|
assumedVersionScheme = assumedVersionScheme.value,
|
||||||
|
assumedVersionSchemeJava = assumedVersionSchemeJava.value,
|
||||||
mavenStyle = publishMavenStyle.value,
|
mavenStyle = publishMavenStyle.value,
|
||||||
compatWarning = compatibilityWarningOptions.value,
|
compatWarning = compatibilityWarningOptions.value,
|
||||||
includeCallers = includeCallers,
|
includeCallers = includeCallers,
|
||||||
|
|
|
||||||
|
|
@ -458,7 +458,10 @@ object Keys {
|
||||||
val updateFull = taskKey[UpdateReport]("Resolves and optionally retrieves dependencies, producing a full report with callers.").withRank(CTask)
|
val updateFull = taskKey[UpdateReport]("Resolves and optionally retrieves dependencies, producing a full report with callers.").withRank(CTask)
|
||||||
val evicted = taskKey[EvictionWarning]("Display detailed eviction warnings.").withRank(CTask)
|
val evicted = taskKey[EvictionWarning]("Display detailed eviction warnings.").withRank(CTask)
|
||||||
val evictionWarningOptions = settingKey[EvictionWarningOptions]("Options on eviction warnings after resolving managed dependencies.").withRank(DSetting)
|
val evictionWarningOptions = settingKey[EvictionWarningOptions]("Options on eviction warnings after resolving managed dependencies.").withRank(DSetting)
|
||||||
val evictionErrorLevel = settingKey[Level.Value]("The log level for detected eviction errors. Level.Error will throw an error.")
|
val evictionErrorLevel = settingKey[Level.Value]("The log level for the detected eviction errors. Level.Error will throw an error.").withRank(DSetting)
|
||||||
|
val assumedEvictionErrorLevel = settingKey[Level.Value]("The log level for the assumed eviction errors. Level.Error will throw an error.").withRank(DSetting)
|
||||||
|
val assumedVersionScheme = settingKey[String]("The assumed version scheme of a Scala library when POM doesn't have versionScheme.").withRank(DSetting)
|
||||||
|
val assumedVersionSchemeJava = settingKey[String]("The assumed version scheme of a Java library when POM doesn't have versionScheme.").withRank(DSetting)
|
||||||
val transitiveUpdate = taskKey[Seq[UpdateReport]]("UpdateReports for the internal dependencies of this project.").withRank(DTask)
|
val transitiveUpdate = taskKey[Seq[UpdateReport]]("UpdateReports for the internal dependencies of this project.").withRank(DTask)
|
||||||
val updateClassifiers = TaskKey[UpdateReport]("updateClassifiers", "Resolves and optionally retrieves classified artifacts, such as javadocs and sources, for dependency definitions, transitively.", BPlusTask, update)
|
val updateClassifiers = TaskKey[UpdateReport]("updateClassifiers", "Resolves and optionally retrieves classified artifacts, such as javadocs and sources, for dependency definitions, transitively.", BPlusTask, update)
|
||||||
val transitiveClassifiers = settingKey[Seq[String]]("List of classifiers used for transitively obtaining extra artifacts for sbt or declared dependencies.").withRank(BSetting)
|
val transitiveClassifiers = settingKey[Seq[String]]("List of classifiers used for transitively obtaining extra artifacts for sbt or declared dependencies.").withRank(BSetting)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* sbt
|
||||||
|
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||||
|
* Copyright 2008 - 2010, Mark Harrah
|
||||||
|
* Licensed under Apache License 2.0 (see LICENSE)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package sbt
|
||||||
|
|
||||||
|
import sbt.internal.librarymanagement.VersionSchemes
|
||||||
|
|
||||||
|
object VersionScheme {
|
||||||
|
val Always = VersionSchemes.Always
|
||||||
|
val EarlySemVer = VersionSchemes.EarlySemVer
|
||||||
|
val PVP = VersionSchemes.PackVer
|
||||||
|
val SemVerSpec = VersionSchemes.SemVerSpec
|
||||||
|
val Strict = VersionSchemes.Strict
|
||||||
|
}
|
||||||
|
|
@ -39,6 +39,9 @@ private[sbt] object LibraryManagement {
|
||||||
uwConfig: UnresolvedWarningConfiguration,
|
uwConfig: UnresolvedWarningConfiguration,
|
||||||
evictionLevel: Level.Value,
|
evictionLevel: Level.Value,
|
||||||
versionSchemeOverrides: Seq[ModuleID],
|
versionSchemeOverrides: Seq[ModuleID],
|
||||||
|
assumedEvictionErrorLevel: Level.Value,
|
||||||
|
assumedVersionScheme: String,
|
||||||
|
assumedVersionSchemeJava: String,
|
||||||
mavenStyle: Boolean,
|
mavenStyle: Boolean,
|
||||||
compatWarning: CompatibilityWarningOptions,
|
compatWarning: CompatibilityWarningOptions,
|
||||||
includeCallers: Boolean,
|
includeCallers: Boolean,
|
||||||
|
|
@ -63,18 +66,32 @@ private[sbt] object LibraryManagement {
|
||||||
val report1 = transform(report)
|
val report1 = transform(report)
|
||||||
|
|
||||||
// Warn of any eviction and compatibility warnings
|
// Warn of any eviction and compatibility warnings
|
||||||
val evictionError = EvictionError(report1, module, versionSchemeOverrides)
|
val evictionError = EvictionError(
|
||||||
if (evictionError.incompatibleEvictions.isEmpty) ()
|
report1,
|
||||||
else
|
module,
|
||||||
evictionLevel match {
|
versionSchemeOverrides,
|
||||||
case Level.Error =>
|
assumedVersionScheme,
|
||||||
val msgs = List(
|
assumedVersionSchemeJava,
|
||||||
|
assumedEvictionErrorLevel
|
||||||
|
)
|
||||||
|
def extraLines = List(
|
||||||
"",
|
"",
|
||||||
"this can be overridden using libraryDependencySchemes or evictionErrorLevel"
|
"this can be overridden using libraryDependencySchemes or evictionErrorLevel"
|
||||||
)
|
)
|
||||||
sys.error((evictionError.lines ++ msgs).mkString(EOL))
|
val errorLines: Seq[String] =
|
||||||
case _ =>
|
(if (evictionError.incompatibleEvictions.isEmpty
|
||||||
evictionError.lines.foreach(log.log(evictionLevel, _: String))
|
|| evictionLevel != Level.Error) Nil
|
||||||
|
else evictionError.lines) ++
|
||||||
|
(if (evictionError.assumedIncompatibleEvictions.isEmpty
|
||||||
|
|| assumedEvictionErrorLevel != Level.Error) Nil
|
||||||
|
else evictionError.toAssumedLines)
|
||||||
|
if (errorLines.nonEmpty) sys.error((errorLines ++ extraLines).mkString(EOL))
|
||||||
|
else {
|
||||||
|
if (evictionError.incompatibleEvictions.isEmpty) ()
|
||||||
|
else evictionError.lines.foreach(log.log(evictionLevel, _: String))
|
||||||
|
|
||||||
|
if (evictionError.assumedIncompatibleEvictions.isEmpty) ()
|
||||||
|
else evictionError.toAssumedLines.foreach(log.log(assumedEvictionErrorLevel, _: String))
|
||||||
}
|
}
|
||||||
CompatibilityWarning.run(compatWarning, module, mavenStyle, log)
|
CompatibilityWarning.run(compatWarning, module, mavenStyle, log)
|
||||||
val report2 = transformDetails(report1, includeCallers, includeDetails)
|
val report2 = transformDetails(report1, includeCallers, includeDetails)
|
||||||
|
|
@ -272,6 +289,9 @@ private[sbt] object LibraryManagement {
|
||||||
uwConfig = (unresolvedWarningConfiguration in update).value,
|
uwConfig = (unresolvedWarningConfiguration in update).value,
|
||||||
evictionLevel = Level.Debug,
|
evictionLevel = Level.Debug,
|
||||||
versionSchemeOverrides = Nil,
|
versionSchemeOverrides = Nil,
|
||||||
|
assumedEvictionErrorLevel = Level.Debug,
|
||||||
|
assumedVersionScheme = VersionScheme.Always,
|
||||||
|
assumedVersionSchemeJava = VersionScheme.Always,
|
||||||
mavenStyle = publishMavenStyle.value,
|
mavenStyle = publishMavenStyle.value,
|
||||||
compatWarning = compatibilityWarningOptions.value,
|
compatWarning = compatibilityWarningOptions.value,
|
||||||
includeCallers = false,
|
includeCallers = false,
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ object Dependencies {
|
||||||
// sbt modules
|
// sbt modules
|
||||||
private val ioVersion = nightlyVersion.getOrElse("1.5.0-M1")
|
private val ioVersion = nightlyVersion.getOrElse("1.5.0-M1")
|
||||||
private val lmVersion =
|
private val lmVersion =
|
||||||
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.5.0-M5")
|
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.5.0-M6")
|
||||||
val zincVersion = nightlyVersion.getOrElse("1.5.0-M3")
|
val zincVersion = nightlyVersion.getOrElse("1.5.0-M3")
|
||||||
|
|
||||||
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue