mirror of https://github.com/sbt/sbt.git
Remove redundant collection conversions
This commit is contained in:
parent
e528f3d163
commit
ec71256040
|
|
@ -74,7 +74,7 @@ object IvyRetrieve {
|
||||||
}: _*)
|
}: _*)
|
||||||
def toCaller(caller: IvyCaller): Caller = {
|
def toCaller(caller: IvyCaller): Caller = {
|
||||||
val m = toModuleID(caller.getModuleRevisionId)
|
val m = toModuleID(caller.getModuleRevisionId)
|
||||||
val callerConfigurations = caller.getCallerConfigurations.toArray.toVector collect {
|
val callerConfigurations = caller.getCallerConfigurations.toVector collect {
|
||||||
case x if nonEmptyString(x).isDefined => x
|
case x if nonEmptyString(x).isDefined => x
|
||||||
}
|
}
|
||||||
val ddOpt = Option(caller.getDependencyDescriptor)
|
val ddOpt = Option(caller.getDependencyDescriptor)
|
||||||
|
|
@ -128,16 +128,16 @@ object IvyRetrieve {
|
||||||
case _ => dep.getResolvedId.getExtraAttributes
|
case _ => dep.getResolvedId.getExtraAttributes
|
||||||
})
|
})
|
||||||
val isDefault = Option(dep.getDescriptor) map { _.isDefault }
|
val isDefault = Option(dep.getDescriptor) map { _.isDefault }
|
||||||
val configurations = dep.getConfigurations(confReport.getConfiguration).toArray.toList
|
val configurations = dep.getConfigurations(confReport.getConfiguration).toList
|
||||||
val licenses: Seq[(String, Option[String])] = mdOpt match {
|
val licenses: Seq[(String, Option[String])] = mdOpt match {
|
||||||
case Some(md) => md.getLicenses.toArray.toVector collect {
|
case Some(md) => md.getLicenses.toVector collect {
|
||||||
case lic: IvyLicense if Option(lic.getName).isDefined =>
|
case lic: IvyLicense if Option(lic.getName).isDefined =>
|
||||||
val temporaryURL = "http://localhost"
|
val temporaryURL = "http://localhost"
|
||||||
(lic.getName, nonEmptyString(lic.getUrl) orElse { Some(temporaryURL) })
|
(lic.getName, nonEmptyString(lic.getUrl) orElse { Some(temporaryURL) })
|
||||||
}
|
}
|
||||||
case _ => Nil
|
case _ => Nil
|
||||||
}
|
}
|
||||||
val callers = dep.getCallers(confReport.getConfiguration).toArray.toVector map { toCaller }
|
val callers = dep.getCallers(confReport.getConfiguration).toVector map { toCaller }
|
||||||
val (resolved, missing) = artifacts(moduleId, confReport getDownloadReports revId)
|
val (resolved, missing) = artifacts(moduleId, confReport getDownloadReports revId)
|
||||||
|
|
||||||
new ModuleReport(moduleId, resolved, missing, status, publicationDate, resolver, artifactResolver,
|
new ModuleReport(moduleId, resolved, missing, status, publicationDate, resolver, artifactResolver,
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ private[sbt] class CachedResolutionResolveCache() {
|
||||||
{
|
{
|
||||||
log.debug(s":: building artificial module descriptors from ${md0.getModuleRevisionId}")
|
log.debug(s":: building artificial module descriptors from ${md0.getModuleRevisionId}")
|
||||||
// val expanded = expandInternalDependencies(md0, data, prOpt, log)
|
// val expanded = expandInternalDependencies(md0, data, prOpt, log)
|
||||||
val rootModuleConfigs = md0.getConfigurations.toArray.toVector
|
val rootModuleConfigs = md0.getConfigurations.toVector
|
||||||
directDependencies(md0) map { dd =>
|
directDependencies(md0) map { dd =>
|
||||||
val arts = dd.getAllDependencyArtifacts.toVector map { x => s"""${x.getName}:${x.getType}:${x.getExt}:${x.getExtraAttributes}""" }
|
val arts = dd.getAllDependencyArtifacts.toVector map { x => s"""${x.getName}:${x.getType}:${x.getExt}:${x.getExtraAttributes}""" }
|
||||||
log.debug(s"::: dd: $dd (artifacts: ${arts.mkString(",")})")
|
log.debug(s"::: dd: $dd (artifacts: ${arts.mkString(",")})")
|
||||||
|
|
@ -599,7 +599,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
||||||
case None => Vector()
|
case None => Vector()
|
||||||
}
|
}
|
||||||
// These are the configurations from the original project we want to resolve.
|
// These are the configurations from the original project we want to resolve.
|
||||||
val rootModuleConfs = md0.getConfigurations.toArray.toVector
|
val rootModuleConfs = md0.getConfigurations.toVector
|
||||||
val configurations0 = ur.configurations.toVector
|
val configurations0 = 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 =>
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ private final class MergedDescriptors(a: DependencyDescriptor, b: DependencyDesc
|
||||||
private[this] def addConfigurations(dd: DefaultDependencyArtifactDescriptor, confs: Seq[String]): Unit =
|
private[this] def addConfigurations(dd: DefaultDependencyArtifactDescriptor, confs: Seq[String]): Unit =
|
||||||
confs foreach dd.addConfiguration
|
confs foreach dd.addConfiguration
|
||||||
|
|
||||||
private[this] def concat[T: reflect.ClassTag](a: Array[T], b: Array[T]): Array[T] = (a ++ b).distinct.toArray
|
private[this] def concat[T: reflect.ClassTag](a: Array[T], b: Array[T]): Array[T] = (a ++ b).distinct
|
||||||
|
|
||||||
def getAllExcludeRules = concat(a.getAllExcludeRules, b.getAllExcludeRules)
|
def getAllExcludeRules = concat(a.getAllExcludeRules, b.getAllExcludeRules)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue