aboutsummaryrefslogtreecommitdiff
path: root/dottydoc/jvm/src/dotty/tools/dottydoc/core/PrintPhase.scala
blob: 9c9070d2499904be0b0e329bb4ff75a83d8228e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package dotty.tools
package dottydoc
package core

import dotc.CompilationUnit
import dotc.core.Contexts.Context
import dotc.core.Phases.Phase
import model.{Package, Entity}

/** TODO: re-write to `DocMiniPhase` */
class PrintPhase extends Phase {
  def phaseName = "docPrintPhase"

  var currentRun = 0
  override def run(implicit ctx: Context): Unit = ()

  override def runOn(units: List[CompilationUnit])(implicit ctx: Context): List[CompilationUnit] = {
    val compUnits = super.runOn(units)
    val packages = ctx.base.packages[Package].toMap

    val outputDir = {
      val out = ctx.settings.DocOutput.value
      if (out.last == '/') out.dropRight(1)
      else out
    }
    if (!ctx.settings.YDocNoWrite.value) (new util.OutputWriter).write(packages, outputDir)

    compUnits
  }
}