@@ -20,7 +20,6 @@ import dotty.tools.dotc.core.Denotations.StaleSymbol
2020import dotty .tools .dotc .core .Types ._
2121import dotty .tools .dotc .transform .SymUtils ._
2222import dotty .tools .dotc .util .{SrcPos , NoSourcePosition }
23- import dotty .tools .uncheckedNN
2423import dotty .tools .io
2524import dotty .tools .io .{AbstractFile , PlainFile , ZipArchive }
2625import xsbti .UseScope
@@ -58,7 +57,7 @@ class ExtractDependencies extends Phase {
5857
5958 override def isRunnable (using Context ): Boolean = {
6059 def forceRun = ctx.settings.YdumpSbtInc .value || ctx.settings.YforceSbtPhases .value
61- super .isRunnable && (ctx.sbtCallback != null && ctx.sbtCallback.enabled() || forceRun)
60+ super .isRunnable && (ctx.incrementalEnabled || forceRun)
6261 }
6362
6463 // Check no needed. Does not transform trees
@@ -93,15 +92,16 @@ class ExtractDependencies extends Phase {
9392 } finally pw.close()
9493 }
9594
96- if (ctx.sbtCallback != null && ctx.sbtCallback.enabled()) {
97- collector.usedNames.foreach {
98- case (clazz, usedNames) =>
99- val className = classNameAsString(clazz)
100- usedNames.names.foreach {
101- case (usedName, scopes) =>
102- ctx.sbtCallback.usedName(className, usedName.toString, scopes)
103- }
104- }
95+ if (ctx.incrementalEnabled) {
96+ ctx.withIncCallback: cb =>
97+ collector.usedNames.foreach {
98+ case (clazz, usedNames) =>
99+ val className = classNameAsString(clazz)
100+ usedNames.names.foreach {
101+ case (usedName, scopes) =>
102+ cb.usedName(className, usedName.toString, scopes)
103+ }
104+ }
105105
106106 collector.dependencies.foreach(recordDependency)
107107 }
@@ -114,10 +114,10 @@ class ExtractDependencies extends Phase {
114114 */
115115 def recordDependency (dep : ClassDependency )(using Context ): Unit = {
116116 val fromClassName = classNameAsString(dep.from)
117- val zincSourceFile = ctx.compilationUnit.source.underlyingZincFile
117+ val sourceFile = ctx.compilationUnit.source
118118
119119 def binaryDependency (file : Path , binaryClassName : String ) =
120- ctx.sbtCallback .binaryDependency(file, binaryClassName, fromClassName, zincSourceFile , dep.context)
120+ ctx.withIncCallback(_ .binaryDependency(file, binaryClassName, fromClassName, sourceFile , dep.context) )
121121
122122 def processExternalDependency (depFile : AbstractFile , binaryClassName : String ) = {
123123 depFile match {
@@ -143,8 +143,7 @@ class ExtractDependencies extends Phase {
143143 val depFile = dep.to.associatedFile
144144 if (depFile != null ) {
145145 def depIsSameSource =
146- val depVF : xsbti.VirtualFile | Null = ctx.zincVirtualFiles.uncheckedNN.get(depFile.absolutePath)
147- depVF != null && depVF.id() == zincSourceFile.id()
146+ depFile.absolutePath == sourceFile.file.absolutePath
148147
149148 // Cannot ignore inheritance relationship coming from the same source (see sbt/zinc#417)
150149 def allowLocal = dep.context == DependencyByInheritance || dep.context == LocalDependencyByInheritance
@@ -158,7 +157,7 @@ class ExtractDependencies extends Phase {
158157 // We cannot ignore dependencies coming from the same source file because
159158 // the dependency info needs to propagate. See source-dependencies/trait-trait-211.
160159 val toClassName = classNameAsString(dep.to)
161- ctx.sbtCallback .classDependency(toClassName, fromClassName, dep.context)
160+ ctx.withIncCallback(_ .classDependency(toClassName, fromClassName, dep.context) )
162161 }
163162 }
164163 }
0 commit comments