enso/project/RecompileParser.scala

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
582 B
Scala
Raw Normal View History

2020-07-01 14:21:13 +03:00
import sbt._
import sbt.Keys._
object RecompileParser {
/** Ensures that the project is recompiled whenever the project from
2020-07-01 14:21:13 +03:00
* `syntaxDefinition` is changed. Should be attached to the `compile` task as
* a dependency.
*/
def run(syntaxDefinition: Project) =
2020-07-01 14:21:13 +03:00
Def.taskDyn {
val parserCompile =
(syntaxDefinition / Compile / compileIncremental).value
2020-07-01 14:21:13 +03:00
if (parserCompile.hasModified) {
Def.task {
streams.value.log.info("Parser changed, forcing recompilation.")
clean.value
}
} else Def.task {}
}
}