From ca883f63956c40b13adc83ec76c3675e592f35e0 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 26 Apr 2017 16:23:00 +0200 Subject: [PATCH] Fix incremental compilation dependency tracking Since #2191, `dotty.tools.dotc.io.PlainFile` is no longer an alias for `scala.reflect.io.PlainFile` but its own class. However, the backend still uses PlainFile from scala.reflect. This mess should soon be fixed by getting rid of scala-reflect (#2271). Meanwhile, this commit fixes ExtractDependencies to pattern match on the correct class, and thus avoid missing dependencies. --- compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala b/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala index 0a061c841dd2..fcef88eb3481 100644 --- a/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala +++ b/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala @@ -8,7 +8,7 @@ import Names._, NameOps._, StdNames._ import scala.collection.{Set, mutable} -import dotty.tools.io.{AbstractFile, Path, PlainFile, ZipArchive} +import dotty.tools.io.{AbstractFile, Path, ZipArchive} import java.io.File import java.util.{Arrays, Comparator} @@ -101,7 +101,7 @@ class ExtractDependencies extends Phase { val classSegments = Path(ze.path).segments binaryDependency(zipFile, className(classSegments)) } - case pf: PlainFile => + case pf: scala.reflect.io.PlainFile => val packages = dep.ownersIterator .filter(x => x.is(PackageClass) && !x.isEffectiveRoot).length // We can recover the fully qualified name of a classfile from @@ -109,6 +109,7 @@ class ExtractDependencies extends Phase { val classSegments = pf.givenPath.segments.takeRight(packages + 1) binaryDependency(pf.file, className(classSegments)) case _ => + ctx.warning(s"sbt-deps: Ignoring dependency $depFile of class ${depFile.getClass}") } } else if (depFile.file != currentSourceFile) { ctx.sbtCallback.sourceDependency(depFile.file, currentSourceFile, context)