Merge pull request #2137 from pdalpra/clean-ops-on-collections

Clean ops on collections
This commit is contained in:
Josh Suereth 2015-08-03 12:22:51 -04:00
commit db51a499a1
5 changed files with 13 additions and 13 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

@ -50,9 +50,9 @@ private[sbt] object JsonUtil {
(c.caller.organization != sbtOrgTemp) &&
(c.caller.organization != fakeCallerOrganization)
}
val interProj = (callers filter { c =>
(c.caller.organization == sbtOrgTemp)
}).headOption.toList
val interProj = (callers find { c =>
c.caller.organization == sbtOrgTemp
}).toList
interProj ::: nonArtificial.toList
}

View File

@ -248,7 +248,7 @@ class MakePom(val log: Logger) {
val includeArtifacts = artifacts.filter(d => includeTypes(d.getType))
if (artifacts.isEmpty) {
val configs = dependency.getModuleConfigurations
if (configs.filterNot(Set("sources", "docs")).nonEmpty) {
if (!configs.forall(Set("sources", "docs"))) {
warnIntransitve()
val (scope, optional) = getScopeAndOptional(dependency.getModuleConfigurations)
makeDependencyElem(dependency, scope, optional, None, None, excludes)
@ -271,7 +271,7 @@ class MakePom(val log: Logger) {
case Nil | "*" :: Nil => dependency.getModuleConfigurations
case x => x.toArray
}
if (configs.filterNot(Set("sources", "docs")).nonEmpty) {
if (!configs.forall(Set("sources", "docs"))) {
val (scope, optional) = getScopeAndOptional(configs)
val classifier = artifactClassifier(artifact)
val baseType = artifactType(artifact)

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(",")})")
@ -430,7 +430,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
cs match {
case Nil => Nil
case (k, Vector()) :: rest => resolveConflicts(rest)
case (k, Vector(oa)) :: rest if (oa.modules.size == 0) => resolveConflicts(rest)
case (k, Vector(oa)) :: rest if (oa.modules.isEmpty) => resolveConflicts(rest)
case (k, Vector(oa)) :: rest if (oa.modules.size == 1 && !oa.modules.head.evicted) =>
log.debug(s":: no conflict $rootModuleConf: ${oa.organization}:${oa.name}")
oa :: resolveConflicts(rest)
@ -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)