Fix += on sourceGenerators

This commit is contained in:
Adrien Piquerez 2024-03-26 14:33:31 +01:00
parent 35520e6cfe
commit 0005705eb6
9 changed files with 17 additions and 14 deletions

View File

@ -319,7 +319,7 @@ object Def extends Init[Scope] with TaskMacroExtra with InitializeImplicits:
inline def value: A1 = InputWrapper.`wrapInitTask_\u2603\u2603`[A1](in)
/**
* This treats the `Initailize[Task[A]]` as a setting that returns the Task value,
* This treats the `Initialize[Task[A]]` as a setting that returns the Task value,
* instead of evaluating the task.
*/
inline def taskValue: Task[A1] = InputWrapper.`wrapInit_\u2603\u2603`[Task[A1]](in)

View File

@ -82,7 +82,7 @@ sealed abstract class SettingKey[A1]
final inline def :=(inline v: A1): Setting[A1] =
${ TaskMacro.settingAssignMacroImpl('this, 'v) }
final inline def +=[A2](inline v: A2)(using Append.Value[A1, A2]): Setting[A1] =
final inline def +=[A2](inline v: A2)(using inline ev: Append.Value[A1, A2]): Setting[A1] =
${ TaskMacro.settingAppend1Impl[A1, A2]('this, 'v) }
final inline def append1[A2](v: Initialize[A2])(using

View File

@ -93,7 +93,7 @@ object TaskMacro:
'{
InputWrapper.`wrapInitTask_\u2603\u2603`[Option[A1]](Previous.runtime[A1]($t)($ev))
}
case _ => report.errorAndAbort(s"JsonFormat[${Type.of[A1]}] missing")
case _ => report.errorAndAbort(s"JsonFormat[${Type.show[A1]}] missing")
/** Implementation of := macro for settings. */
def settingAssignMacroImpl[A1: Type](rec: Expr[Scoped.DefinableSetting[A1]], v: Expr[A1])(using
@ -147,7 +147,7 @@ object TaskMacro:
$rec.+=($v2.taskValue)(using $ev)
}
case _ =>
report.errorAndAbort(s"Append.Value[${Type.of[A1]}, ${Type.of[Task[a]]}] missing")
report.errorAndAbort(s"Append.Value[${Type.show[A1]}, ${Type.show[Task[a]]}] missing")
case _ =>
Expr.summon[Append.Value[A1, A2]] match
case Some(ev) =>
@ -155,7 +155,8 @@ object TaskMacro:
'{
$rec.append1[A2]($init)(using $ev)
}
case _ => report.errorAndAbort(s"Append.Value[${Type.of[A1]}, ${Type.of[A2]}] missing")
case _ =>
report.errorAndAbort(s"Append.Value[${Type.show[A1]}, ${Type.show[A2]}] missing")
/*
private[this] def transformMacroImpl[A](using qctx: Quotes)(init: Expr[A])(

View File

@ -1,5 +1,7 @@
import sbt.nio.file.Glob
name := "clean-managed"
scalaVersion := "3.3.1"
Compile / sourceGenerators += {
Def.task {
val files = Seq(sourceManaged.value / "foo.txt", sourceManaged.value / "bar.txt")

View File

@ -1,6 +0,0 @@
> compile
$ exists target/scala-2.12/src_managed/foo.txt target/scala-2.12/src_managed/bar.txt
> clean
$ absent target/scala-2.12/src_managed/foo.txt
$ exists target/scala-2.12/src_managed/bar.txt

View File

@ -0,0 +1,6 @@
> compile
$ exists target/out/jvm/scala-3.3.1/clean-managed/src_managed/foo.txt target/out/jvm/scala-3.3.1/clean-managed/src_managed/bar.txt
> clean
$ absent target/out/jvm/scala-3.3.1/clean-managed/src_managed/foo.txt
$ exists target/out/jvm/scala-3.3.1/clean-managed/src_managed/bar.txt

View File

@ -10,5 +10,5 @@ lazy val root = (project in file("."))
file :: Nil
},
Compile / sourceGenerators += buildInfo,
Compile / sourceGenerators += Def.task { Nil },
Compile / sourceGenerators += Def.task { Seq.empty[File] },
)

View File

@ -1,2 +0,0 @@
> compile
$ exists target/scala-2.12/src_managed/BuildInfo.scala

View File

@ -0,0 +1,2 @@
> compile
$ exists target/out/jvm/scala-2.12.12/root/src_managed/BuildInfo.scala