diff options
Diffstat (limited to 'scalaworker')
-rw-r--r-- | scalaworker/src/mill/scalaworker/ScalaWorker.scala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scalaworker/src/mill/scalaworker/ScalaWorker.scala b/scalaworker/src/mill/scalaworker/ScalaWorker.scala index 3990d9dc..07724094 100644 --- a/scalaworker/src/mill/scalaworker/ScalaWorker.scala +++ b/scalaworker/src/mill/scalaworker/ScalaWorker.scala @@ -99,6 +99,22 @@ class ScalaWorker(ctx0: mill.util.Ctx, compiledDest } + + + def discoverMainClasses(compilationResult: CompilationResult)(implicit ctx: mill.util.Ctx): Seq[String] = { + def toScala[A](o: Optional[A]): Option[A] = if (o.isPresent) Some(o.get) else None + + toScala(FileAnalysisStore.binary(compilationResult.analysisFile.toIO).get()) + .map(_.getAnalysis) + .flatMap{ + case analysis: Analysis => + Some(analysis.infos.allInfos.values.map(_.getMainClasses).flatten.toSeq.sorted) + case _ => + None + } + .getOrElse(Seq.empty[String]) + } + def compileScala(scalaVersion: String, sources: Agg[Path], compileBridgeSources: Agg[Path], |