Remove redundant collection conversions

This commit is contained in:
Pierre DAL-PRA 2015-08-01 12:05:35 +02:00
parent e528f3d163
commit ec71256040
3 changed files with 7 additions and 7 deletions

View File

@ -74,7 +74,7 @@ object IvyRetrieve {
}: _*)
def toCaller(caller: IvyCaller): Caller = {
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
}
val ddOpt = Option(caller.getDependencyDescriptor)
@ -128,16 +128,16 @@ object IvyRetrieve {
case _ => dep.getResolvedId.getExtraAttributes
})
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 {
case Some(md) => md.getLicenses.toArray.toVector collect {
case Some(md) => md.getLicenses.toVector collect {
case lic: IvyLicense if Option(lic.getName).isDefined =>
val temporaryURL = "http://localhost"
(lic.getName, nonEmptyString(lic.getUrl) orElse { Some(temporaryURL) })
}
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)
new ModuleReport(moduleId, resolved, missing, status, publicationDate, resolver, artifactResolver,

View File

@ -57,7 +57,7 @@ private[sbt] class CachedResolutionResolveCache() {
{
log.debug(s":: building artificial module descriptors from ${md0.getModuleRevisionId}")
// val expanded = expandInternalDependencies(md0, data, prOpt, log)
val rootModuleConfigs = md0.getConfigurations.toArray.toVector
val rootModuleConfigs = md0.getConfigurations.toVector
directDependencies(md0) map { dd =>
val arts = dd.getAllDependencyArtifacts.toVector map { x => s"""${x.getName}:${x.getType}:${x.getExt}:${x.getExtraAttributes}""" }
log.debug(s"::: dd: $dd (artifacts: ${arts.mkString(",")})")
@ -599,7 +599,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
case None => Vector()
}
// 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
// This is how md looks from md0 via dd's mapping.
val remappedConfigs0: Map[String, Vector[String]] = Map(rootModuleConfs map { conf0 =>

View File

@ -109,7 +109,7 @@ private final class MergedDescriptors(a: DependencyDescriptor, b: DependencyDesc
private[this] def addConfigurations(dd: DefaultDependencyArtifactDescriptor, confs: Seq[String]): Unit =
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)