Skip to content

Commit

Permalink
Use sbt.nio to cache generated files (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
Atry authored Feb 15, 2022
1 parent a7654da commit 8d647dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/scala/com/thoughtworks/Example.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import java.io.File

import sbt.Keys._
import sbt._
import sbt.nio.Keys._
import sbt.plugins.JvmPlugin

import scala.collection.immutable
Expand Down Expand Up @@ -406,12 +407,13 @@ object Example extends AutoPlugin {
}

},
generateExample / fileInputs := (Compile / unmanagedSources / fileInputs).value,
generateExample := {
val outputFile = (sourceManaged in Test).value / "sbt-example-generated.scala"
val logger = (streams in generateExample).value.log
val compileDialect = (Compile / exampleDialect).value
val testDialect = (Test / autoImport.exampleDialect).value
val content = (unmanagedSources in Compile).value.view.flatMap { file =>
val content = generateExample.inputFiles.view.flatMap { file =>
val source = new ScalametaParser(Input.File(file))(compileDialect).parseSource()
exampleStats(source, logger, testDialect)
}.toList
Expand Down

0 comments on commit 8d647dd

Please sign in to comment.