Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions sbt-plugin/src/main/scala/clue/sbt/CluePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@ object CluePlugin extends AutoPlugin {
object autoImport {
lazy val clueSourceDirectory = settingKey[File]("Clue input schemas and sources")
lazy val clueSourceGenerators = settingKey[Seq[Task[Seq[File]]]]("Clue source generators")
lazy val clueClean = taskKey[Unit]("Clue clean task")
}
import autoImport._

override def buildSettings: Seq[Setting[_]] = Seq(
scalafixScalaBinaryVersion := "2.13",
scalafixDependencies += BuildInfo.organization %% BuildInfo.rulesModule % BuildInfo.version,
Compile / clueSourceGenerators := Seq.empty
Compile / clueSourceGenerators := Seq.empty,
clueClean := {}
)

override def projectSettings: Seq[Setting[_]] = Seq(
Compile / clueSourceDirectory := sourceDirectory.value / "clue",
Compile / sourceGenerators ++= (Compile / clueSourceGenerators).value, // workaround for sbt/sbt#7173
libraryDependencies += BuildInfo.organization %%% BuildInfo.coreModule % BuildInfo.version
libraryDependencies += BuildInfo.organization %%% BuildInfo.coreModule % BuildInfo.version,
// another workaround
clean := clean.dependsOn(clueClean).value
)

override def derivedProjects(proj: ProjectDefinition[_]): Seq[Project] = Seq(
Expand Down Expand Up @@ -61,9 +65,8 @@ object CluePlugin extends AutoPlugin {
}.taskValue,

// register clean
LocalProject(proj.id) / clean := {
val _ = clean.value
(LocalProject(proj.id) / clean).value
LocalProject(proj.id) / clueClean := {
clean.value
},

// scalafix stuff
Expand Down
1 change: 1 addition & 0 deletions sbt-plugin/src/sbt-test/clue-plugin/starwars/test
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
> app/compile
> app/clean
$ absent app-clue/target/scala-2.13
> app/compile