Simplify bootstrap artifacts handling a bit (#810)

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)
This commit is contained in:
Alexandre Archambault 2018-03-13 16:48:09 +01:00 committed by GitHub
parent 8cf4d7a16d
commit 3381727832
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 16 deletions

View File

@ -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)
}