Merge pull request #268 from eed3si9n/wip/contains

Fix the contains issue
This commit is contained in:
eugene yokota 2018-10-15 03:35:00 -04:00 committed by GitHub
commit 87393a3f9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 17 deletions

View File

@ -226,7 +226,7 @@ object EvictionWarning {
): Seq[OrganizationArtifactReport] = {
val buffer: mutable.ListBuffer[OrganizationArtifactReport] = mutable.ListBuffer()
val confs = report.configurations filter { x =>
options.configurations contains x.configuration
options.configurations.contains[ConfigRef](x.configuration)
}
confs flatMap { confReport =>
confReport.details map { detail =>
@ -345,9 +345,10 @@ object EvictionWarning {
val evo = a.options
val out: mutable.ListBuffer[String] = mutable.ListBuffer()
a.allEvictions foreach { ev =>
if ((a.scalaEvictions contains ev) && evo.warnScalaVersionEviction) ()
else if ((a.directEvictions contains ev) && evo.warnDirectEvictions) ()
else if ((a.transitiveEvictions contains ev) && evo.warnTransitiveEvictions) ()
if ((a.scalaEvictions.contains[EvictionPair](ev)) && evo.warnScalaVersionEviction) ()
else if ((a.directEvictions.contains[EvictionPair](ev)) && evo.warnDirectEvictions) ()
else if ((a.transitiveEvictions.contains[EvictionPair](ev)) && evo.warnTransitiveEvictions)
()
else {
out ++= ev.lines
}

View File

@ -394,7 +394,7 @@ object IvyActions {
val retReport = report retrieve { (conf: ConfigRef, mid, art, cached) =>
toRetrieve match {
case None => performRetrieve(conf, mid, art, base, pattern, cached, copyChecksums, toCopy)
case Some(refs) if refs contains conf =>
case Some(refs) if refs.contains[ConfigRef](conf) =>
performRetrieve(conf, mid, art, base, pattern, cached, copyChecksums, toCopy)
case _ => cached
}

View File

@ -254,7 +254,7 @@ object IvyRetrieve {
val node = current.findNode(revId)
if (revId == from) node :: path
else if (node == node.getRoot) Nil
else if (path contains node) path
else if (path.contains[IvyNode](node)) path
else doFindPath(node, node :: path)
}) sortBy { _.size }).reverse
paths.headOption getOrElse Nil

View File

@ -138,7 +138,7 @@ object IvyScalaUtil {
val id = dep.getDependencyRevisionId
val depBinaryVersion = CrossVersion.binaryScalaVersion(id.getRevision)
def isScalaLangOrg = id.getOrganisation == scalaOrganization
def isScalaArtifact = scalaArtifacts.contains(id.getName)
def isScalaArtifact = scalaArtifacts.contains[String](id.getName)
def hasBinVerMismatch = depBinaryVersion != scalaBinaryVersion
def matchesOneOfTheConfigs = dep.getModuleConfigurations exists { scalaVersionConfigs }
val mismatched = isScalaLangOrg && isScalaArtifact && hasBinVerMismatch && matchesOneOfTheConfigs

View File

@ -407,7 +407,9 @@ class MakePom(val log: Logger) {
def getScopeAndOptional(confs: Array[String]): (Option[String], Boolean) = {
val (opt, notOptional) = confs.partition(_ == Optional.name)
val defaultNotOptional =
Configurations.defaultMavenConfigurations.find(notOptional contains _.name)
Configurations.defaultMavenConfigurations.find({ c: Configuration =>
notOptional contains c.name
})
val scope = defaultNotOptional.map(_.name)
(scope, opt.nonEmpty)
}
@ -495,9 +497,10 @@ class MakePom(val log: Logger) {
configurations: Option[Iterable[Configuration]]
): Seq[DependencyDescriptor] = {
val keepConfigurations = IvySbt.getConfigurations(module, configurations)
val keepSet = Set(keepConfigurations.toSeq: _*)
val keepSet: Set[String] = Set(keepConfigurations.toSeq: _*)
def translate(dependency: DependencyDescriptor) = {
val keep = dependency.getModuleConfigurations.filter(keepSet.contains)
val keep = dependency.getModuleConfigurations
.filter((conf: String) => keepSet.contains(conf))
if (keep.isEmpty)
None
else // TODO: translate the dependency to contain only configurations to keep

View File

@ -593,7 +593,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
c <- mr.callers
} yield (c.caller.organization, c.caller.name)).distinct
callers foreach { c =>
if (history contains c) {
if (history.contains[(String, String)](c)) {
val loop = (c :: history.takeWhile(_ != c)) ::: List(c)
if (!loopSets(loop.toSet)) {
loopSets += loop.toSet
@ -801,7 +801,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
}
val reports: Seq[((String, String), Vector[OrganizationArtifactReport])] =
reports0.toSeq flatMap {
case (k, _) if !(pairs contains k) => Seq()
case (k, _) if !(pairs.contains[(String, String)](k)) => Seq()
case ((organization, name), oars0) =>
val oars = oars0 map { oar =>
val (affected, unaffected) = oar.modules partition { mr =>
@ -967,8 +967,8 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
}
log.debug(s"::: remapped configs $remappedConfigs")
val configurations = rootModuleConfs map { conf0 =>
val remappedCRs = configurations0 filter { cr =>
remappedConfigs(conf0.getName) contains cr.configuration
val remappedCRs: Vector[ConfigurationReport] = configurations0 filter { cr =>
remappedConfigs(conf0.getName).contains[String](cr.configuration.name)
}
mergeConfigurationReports(ConfigRef(conf0.getName), remappedCRs, os, log)
}

View File

@ -1,5 +1,6 @@
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.8")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.1")
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.9")
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.8")
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.15")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.1")
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.9")
scalacOptions += "-language:postfixOps"