Skip to content

Commit ebdc20f

Browse files
committed
WIP 39 - Target.apply (Task) macro
1 parent 743f616 commit ebdc20f

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

main/define/src/mill/define/Task.scala

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ object Target extends Applicative.Applyer[Task, Task, Result, mill.api.Ctx] {
209209
): Target[T] =
210210
${ Internal.targetResultImpl[T]('t)('rw, 'ctx, 'this) }
211211

212-
def apply[T](t: Task[T])(implicit rw: RW[T], ctx: mill.define.Ctx): Target[T] =
213-
??? // macro Internal.targetTaskImpl[T]
212+
inline def apply[T](inline t: Task[T])(implicit rw: RW[T], ctx: mill.define.Ctx): Target[T] =
213+
${ Internal.targetTaskImpl[T]('t)('rw, 'ctx) }
214214

215215
/**
216216
* [[PersistentImpl]] are a flavor of [[TargetImpl]], normally defined using
@@ -429,21 +429,18 @@ object Target extends Applicative.Applyer[Task, Task, Result, mill.api.Ctx] {
429429
rw: Expr[RW[T]],
430430
ctx: Expr[mill.define.Ctx]
431431
): Expr[Target[T]] = {
432-
// import c.universe._
433-
434-
// val taskIsPrivate = isPrivateTargetOption(c)
432+
val taskIsPrivate = isPrivateTargetOption()
435433

436-
// mill.moduledefs.Cacher.impl0[Target[T]](c)(
437-
// '{
438-
// new TargetImpl[T](
439-
// t.splice,
440-
// ctx.splice,
441-
// rw.splice,
442-
// taskIsPrivate.splice
443-
// )
444-
// }
445-
// )
446-
???
434+
mill.moduledefs.Cacher.impl0[Target[T]](
435+
'{
436+
new TargetImpl[T](
437+
$t,
438+
$ctx,
439+
$rw,
440+
$taskIsPrivate
441+
)
442+
}
443+
)
447444
}
448445

449446
def sourcesImpl1(using Quotes)(values: Expr[Seq[Result[os.Path]]])(

0 commit comments

Comments
 (0)