@@ -41,6 +41,11 @@ import scala.collection.mutable
41
41
class ExtractAPI extends Phase {
42
42
override def phaseName : String = " sbt-api"
43
43
44
+ override def isRunnable (implicit ctx : Context ): Boolean = {
45
+ def forceRun = ctx.settings.YdumpSbtInc .value || ctx.settings.YforceSbtPhases .value
46
+ super .isRunnable && (ctx.sbtCallback != null || forceRun)
47
+ }
48
+
44
49
// SuperAccessors need to be part of the API (see the scripted test
45
50
// `trait-super` for an example where this matters), this is only the case
46
51
// after `PostTyper` (unlike `ExtractDependencies`, the simplication to trees
@@ -50,9 +55,7 @@ class ExtractAPI extends Phase {
50
55
51
56
override def run (implicit ctx : Context ): Unit = {
52
57
val unit = ctx.compilationUnit
53
- val dumpInc = ctx.settings.YdumpSbtInc .value
54
- val forceRun = dumpInc || ctx.settings.YforceSbtPhases .value
55
- if ((ctx.sbtCallback != null || forceRun) && ! unit.isJava) {
58
+ if (! unit.isJava) {
56
59
val sourceFile = unit.source.file
57
60
if (ctx.sbtCallback != null )
58
61
ctx.sbtCallback.startSource(sourceFile.file)
@@ -61,7 +64,7 @@ class ExtractAPI extends Phase {
61
64
val classes = apiTraverser.apiSource(unit.tpdTree)
62
65
val mainClasses = apiTraverser.mainClasses
63
66
64
- if (dumpInc ) {
67
+ if (ctx.settings. YdumpSbtInc .value ) {
65
68
// Append to existing file that should have been created by ExtractDependencies
66
69
val pw = new PrintWriter (File (sourceFile.jpath).changeExtension(" inc" ).toFile
67
70
.bufferedWriter(append = true ), true )
0 commit comments