Skip to content

Commit 4b20674

Browse files
committed
prettier output, avoid outline typing on leaves
1 parent 8b324f5 commit 4b20674

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/compiler/scala/tools/nsc/PipelineMain.scala

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,22 @@ class PipelineMainClass {
9090
val value: Seq[String] = ClassPath.expandPath(p.command.settings.classpath.value, expandStar = true)
9191
dependsOn(p) = value.flatMap(s => produces.get(Paths.get(s).toAbsolutePath.normalize())).toList
9292
}
93+
val dependedOn: Set[Task] = dependsOn.valuesIterator.flatten.toSet
9394
var toProcess = projects.toList
9495
val done = mutable.HashSet[Task]()
9596
while (toProcess.nonEmpty) {
9697
round += 1
98+
println(s"Round #$round")
9799
val (nextRound, blocked) = toProcess.partition(x => dependsOn.getOrElse(x, Nil).forall(done))
98100
if (nextRound.isEmpty) throw new RuntimeException("cyclic dependency")
99101
toProcess = blocked
100102
for (p <- nextRound) {
101-
println(s"Round #$round: ${p.argsFile}")
102-
if (!compile(p)) return false
103+
// don't bother outline typing if nothing depends on this project's output
104+
val shouldOutlineType = dependedOn(p)
105+
println(s"Compiling: ${p.argsFile}")
106+
if (!compile(p, shouldOutlineType)) return false
103107
done += p
104-
println(f"Done: outline typing ${p.outlineDurationMs}%.2f ms, full compilation ${p.regularDurationMs}%.2f ms")
108+
println(f"Done: outline typing ${p.outlineDurationMs}%.0f ms, full compilation ${p.regularDurationMs}%.0f ms")
105109
}
106110
}
107111
true
@@ -117,7 +121,7 @@ class PipelineMainClass {
117121
def regularDurationMs: Double = (regularEnd - regularStart).toDouble / 1000 / 1000
118122
}
119123

120-
def compile(task: Task): Boolean = {
124+
def compile(task: Task, outlineType: Boolean): Boolean = {
121125
import task.command
122126
val compiler = newCompiler(command.settings)
123127
reporter = compiler.reporter
@@ -127,7 +131,7 @@ class PipelineMainClass {
127131
else if (command.shouldStopWithInfo)
128132
reporter.echo(command.getInfoMessage(compiler))
129133
else
130-
doCompile(task, compiler)
134+
doCompile(task, compiler, outlineType)
131135
} catch {
132136
case ex: Throwable =>
133137
compiler.reportThrowable(ex)
@@ -176,13 +180,14 @@ class PipelineMainClass {
176180
g
177181
}
178182

179-
protected def doCompile(task: Task, compiler: Global): Unit = {
183+
protected def doCompile(task: Task, compiler: Global, outlineType: Boolean): Unit = {
180184
import task.command
185+
command.settings.nowarn.value = true // quiet, please!
181186
if (command.files.isEmpty) {
182187
reporter.echo(command.usageMsg)
183188
reporter.echo(compiler.pluginOptionsHelp)
184189
} else {
185-
def outlineCompile(): Unit = {
190+
def outlineCompile(): Unit = if (outlineType) {
186191
command.settings.Youtline.value = true
187192
command.settings.stopAfter.value = List("pickler")
188193
val run1 = new compiler.Run()
@@ -215,6 +220,7 @@ class PipelineMainClass {
215220
object PipelineMain {
216221
def main(args: Array[String]): Unit = {
217222
for (i <- 1 to 10) {
223+
println(s"====== ITERATION $i =======")
218224
val result = new PipelineMainClass().process(args)
219225
if (!result)
220226
System.exit(1)

0 commit comments

Comments
 (0)