From 33817278329bc745d8f8a157fc6184446f82f9c4 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Tue, 13 Mar 2018 16:48:09 +0100 Subject: [PATCH] Simplify bootstrap artifacts handling a bit (#810) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If using bootstrap with "isolated" classloaders, optional artifacts weren't added to the "isolated" loaders before that… I'm not sure anyone except me uses that, so commiting that straightaway for now… (I'm using it in the context of jupyter-scala, to isolate classloaders from there) --- .../scala-2.12/coursier/cli/Bootstrap.scala | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/cli/src/main/scala-2.12/coursier/cli/Bootstrap.scala b/cli/src/main/scala-2.12/coursier/cli/Bootstrap.scala index a130b752d..5124467f7 100644 --- a/cli/src/main/scala-2.12/coursier/cli/Bootstrap.scala +++ b/cli/src/main/scala-2.12/coursier/cli/Bootstrap.scala @@ -94,27 +94,22 @@ object Bootstrap extends CaseApp[BootstrapOptions] { val (_, isolatedArtifactFiles) = options.options.isolated.targets.foldLeft((Vector.empty[String], Map.empty[String, (Seq[String], Seq[File])])) { case ((done, acc), target) => - val subRes = helper.res.subset(isolatedDeps.getOrElse(target, Nil).toSet) + + // TODO Add non regression test checking that optional artifacts indeed land in the isolated loader URLs + + val m = helper.fetchMap( + sources = false, + javadoc = false, + artifactTypes = options.artifactOptions.artifactTypes(sources = false, javadoc = false), + subset = isolatedDeps.getOrElse(target, Seq.empty).toSet + ) val (done0, subUrls, subFiles) = if (options.options.standalone) { - val subFiles0 = helper.fetch( - sources = false, - javadoc = false, - artifactTypes = options.artifactOptions.artifactTypes(sources = false, javadoc = false), - subset = isolatedDeps.getOrElse(target, Seq.empty).toSet - ) - + val subFiles0 = m.values.toSeq (done, Nil, subFiles0) } else { - val subArtifacts0 = subRes.dependencyArtifacts.map(_._2) - val artifactTypes = options.artifactOptions.artifactTypes(sources = false, javadoc = false) - val subArtifacts = - if (artifactTypes("*")) - subArtifacts0 - else - subArtifacts0.filter(a => artifactTypes(a.`type`)) - val filteredSubArtifacts = subArtifacts.map(_.url).diff(done) + val filteredSubArtifacts = m.keys.toSeq.diff(done) (done ++ filteredSubArtifacts, filteredSubArtifacts, Nil) }