Skip to content

Commit

Permalink
Remove parallel collection of known products
Browse files Browse the repository at this point in the history
  • Loading branch information
retronym committed Nov 9, 2020
1 parent 46d2659 commit f00ef7d
Showing 1 changed file with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import sbt.util.{ InterfaceUtil, Level, Logger }
import sbt.util.InterfaceUtil.{ jo2o, t2 }
import scala.collection.JavaConverters._
import scala.util.control.NonFatal
import scala.collection.parallel.immutable.ParVector
import xsbti.{ FileConverter, Position, Problem, Severity, UseScope, VirtualFile, VirtualFileRef }
import xsbt.api.{ APIUtil, HashAPI, NameHashing }
import xsbti.api._
Expand Down Expand Up @@ -526,10 +525,6 @@ object Incremental {

private object AnalysisCallback {

private val parallelKnownProducts = "true" == System.getProperty(
"sbt.analysis.known.products.parallel"
)

/** Allow creating new callback instance to be used in each compile iteration */
class Builder(
internalBinaryToSourceClassName: String => Option[String],
Expand Down Expand Up @@ -1090,29 +1085,22 @@ private final class AnalysisCallback(

private def knownProducts(merged: Analysis) = {
// List classes defined in the files that were compiled in this run.
val ps: java.util.Set[String] =
if (AnalysisCallback.parallelKnownProducts)
java.util.concurrent.ConcurrentHashMap.newKeySet[String]
else
new java.util.HashSet[String]()
val ps: java.util.Set[String] = new java.util.HashSet[String]()
val knownProducts: Vector[VirtualFileRef] =
merged.relations.allSources.toVector.flatMap(merged.relations.products)

def knownProductsPar =
if (AnalysisCallback.parallelKnownProducts) new ParVector(knownProducts) else knownProducts

// extract product paths
jo2o(output.getSingleOutputAsPath) match {
case Some(so) if so.getFileName.toString.endsWith(".jar") =>
knownProductsPar foreach { product =>
knownProducts foreach { product =>
new JarUtils.ClassInJar(product.id).toClassFilePathOrNull match {
case null =>
case path =>
ps.add(path.replace('\\', '/'))
}
}
case Some(so) =>
knownProductsPar foreach { product =>
knownProducts foreach { product =>
val productPath = converter.toPath(product)
try {
ps.add(so.relativize(productPath).toString.replace('\\', '/'))
Expand Down

0 comments on commit f00ef7d

Please sign in to comment.