@@ -20,7 +20,6 @@ import dotty.tools.dotc.core.Denotations.StaleSymbol
20
20
import dotty .tools .dotc .core .Types ._
21
21
import dotty .tools .dotc .transform .SymUtils ._
22
22
import dotty .tools .dotc .util .{SrcPos , NoSourcePosition }
23
- import dotty .tools .uncheckedNN
24
23
import dotty .tools .io
25
24
import dotty .tools .io .{AbstractFile , PlainFile , ZipArchive }
26
25
import xsbti .UseScope
@@ -58,7 +57,7 @@ class ExtractDependencies extends Phase {
58
57
59
58
override def isRunnable (using Context ): Boolean = {
60
59
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)
62
61
}
63
62
64
63
// Check no needed. Does not transform trees
@@ -93,15 +92,16 @@ class ExtractDependencies extends Phase {
93
92
} finally pw.close()
94
93
}
95
94
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
+ }
105
105
106
106
collector.dependencies.foreach(recordDependency)
107
107
}
@@ -114,10 +114,10 @@ class ExtractDependencies extends Phase {
114
114
*/
115
115
def recordDependency (dep : ClassDependency )(using Context ): Unit = {
116
116
val fromClassName = classNameAsString(dep.from)
117
- val zincSourceFile = ctx.compilationUnit.source.underlyingZincFile
117
+ val sourceFile = ctx.compilationUnit.source
118
118
119
119
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) )
121
121
122
122
def processExternalDependency (depFile : AbstractFile , binaryClassName : String ) = {
123
123
depFile match {
@@ -143,8 +143,7 @@ class ExtractDependencies extends Phase {
143
143
val depFile = dep.to.associatedFile
144
144
if (depFile != null ) {
145
145
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
148
147
149
148
// Cannot ignore inheritance relationship coming from the same source (see sbt/zinc#417)
150
149
def allowLocal = dep.context == DependencyByInheritance || dep.context == LocalDependencyByInheritance
@@ -158,7 +157,7 @@ class ExtractDependencies extends Phase {
158
157
// We cannot ignore dependencies coming from the same source file because
159
158
// the dependency info needs to propagate. See source-dependencies/trait-trait-211.
160
159
val toClassName = classNameAsString(dep.to)
161
- ctx.sbtCallback .classDependency(toClassName, fromClassName, dep.context)
160
+ ctx.withIncCallback(_ .classDependency(toClassName, fromClassName, dep.context) )
162
161
}
163
162
}
164
163
}
0 commit comments