Skip to content

Commit

Permalink
Merge pull request #492 from gemini-hlsw/pr/clean-workaround
Browse files Browse the repository at this point in the history
Register clue clean task with workaround
  • Loading branch information
armanbilge authored Apr 11, 2023
2 parents e018543 + 012d7bb commit 7870d34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
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

0 comments on commit 7870d34

Please sign in to comment.