mirror of https://github.com/sbt/sbt.git
ConflictWarning cleanup, added strict convenience method for failing on any conflicts
This commit is contained in:
parent
c23226d4ae
commit
5a45faf41b
|
|
@ -11,18 +11,21 @@ object ConflictWarning
|
|||
|
||||
def default(label: String): ConflictWarning = ConflictWarning(label, moduleFilter(organization = GlobFilter(SbtArtifacts.Organization) | GlobFilter(ScalaArtifacts.Organization)), org, Level.Warn, false)
|
||||
|
||||
def strict(label: String): ConflictWarning = ConflictWarning(label, (id: ModuleID) => true, (id: ModuleID) => id.organization + ":" + id.name, Level.Error, true)
|
||||
|
||||
def apply(config: ConflictWarning, report: UpdateReport, log: Logger)
|
||||
{
|
||||
val conflicts = IvyActions.groupedConflicts(config.filter, config.group)(report)
|
||||
if(!conflicts.isEmpty)
|
||||
{
|
||||
val msg = "Potentially incompatible versions of dependencies of " + config.label + ":\n "
|
||||
val prefix = if(config.failOnConflict) "Incompatible" else "Potentially incompatible"
|
||||
val msg = prefix + " versions of dependencies of " + config.label + ":\n "
|
||||
val conflictMsgs =
|
||||
for( (label, versions) <- conflicts ) yield
|
||||
label + ": " + versions.mkString(", ")
|
||||
log.log(config.level, conflictMsgs.mkString(msg, "\n ", ""))
|
||||
}
|
||||
if(config.failOnConflict && !conflicts.isEmpty)
|
||||
error("Conflicts in " + conflicts.map(_._1).mkString )
|
||||
error("Conflicts in " + conflicts.map(_._1).mkString(", ") )
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue