Merge pull request #5005 from eatkins/classloader-performance-regression

Fix performance regression in test classloader
This commit is contained in:
eugene yokota 2019-08-29 16:10:46 -04:00 committed by GitHub
commit 785717c18a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -2041,7 +2041,6 @@ object Classpaths {
excludeFilter in unmanagedJars value
)
).map(exportClasspath) ++ Seq(
sbt.nio.Keys.classpathFiles := data(fullClasspath.value).map(_.toPath),
sbt.nio.Keys.dependencyClasspathFiles := data(dependencyClasspath.value).map(_.toPath),
)

View File

@ -30,7 +30,10 @@ private[sbt] object ClassLoaders {
*/
private[sbt] def testTask: Def.Initialize[Task[ClassLoader]] = Def.task {
val si = scalaInstance.value
val rawCP = modifiedTimes((outputFileStamps in classpathFiles).value)
val cp = fullClasspath.value.map(_.data)
val dependencyStamps = modifiedTimes((outputFileStamps in dependencyClasspathFiles).value).toMap
def getLm(f: File): Long = dependencyStamps.getOrElse(f, IO.getModifiedTimeOrZero(f))
val rawCP = cp.map(f => f -> getLm(f))
val fullCP =
if (si.isManagedVersion) rawCP
else si.libraryJars.map(j => j -> IO.getModifiedTimeOrZero(j)).toSeq ++ rawCP

View File

@ -165,8 +165,6 @@ object Keys {
.withRank(Invisible)
private[sbt] val dependencyClasspathFiles =
taskKey[Seq[Path]]("The dependency classpath for a task.").withRank(Invisible)
private[sbt] val classpathFiles =
taskKey[Seq[Path]]("The classpath for a task.").withRank(Invisible)
private[sbt] val compileOutputs = taskKey[Seq[Path]]("Compilation outputs").withRank(Invisible)
private[sbt] val compileSourceFileInputs =
taskKey[Map[String, Seq[(Path, FileStamp)]]]("Source file stamps stored by scala version")