object Task extends TaskBase
- Source
- Task.scala
- Alphabetic
- By Inheritance
- Task
- TaskBase
- TraverseCtxHolder
- Applyer
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- class ApplyFactory extends TraverseCtxHolder
- class CommandFactory extends TraverseCtxHolder
- abstract class Ops[+T] extends AnyRef
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- macro def Anon[T](t: Result[T]): Task[T]
Creates an anonymous
Task
.Creates an anonymous
Task
. These depend on other tasks and be-depended-upon by other tasks, but cannot be run directly from the command line and do not perform any caching. Typically used as helpers to implementTask{...}
targets. - def Command(t: NamedParameterOnlyDummy = new NamedParameterOnlyDummy, exclusive: Boolean = false): CommandFactory
- exclusive
Exclusive commands run serially at the end of an evaluation, without any other tasks running parallel, and without the terminal logging prefixes that are applied to normal tasks. These are normally used for "top level" commands which are run directly to perform some action or display some output to the user.
- macro def Command[T](t: Result[T])(implicit w: upickle.default.Writer[T], ctx: Ctx, cls: EnclosingClass): Command[T]
Commands are only NamedTasks defined using
def foo() = Task.Command{...}
and are typically called from the command-line.Commands are only NamedTasks defined using
def foo() = Task.Command{...}
and are typically called from the command-line. Unlike other NamedTasks, Commands can be defined to take arguments that are automatically converted to command-line arguments, as long as an implicit mainargs.TokensReader is available. - macro def Input[T](value: Result[T])(implicit w: upickle.default.Writer[T], ctx: Ctx): Target[T]
InputImpls, normally defined using
Task.Input
, are NamedTasks that re-evaluate every time Mill is run.InputImpls, normally defined using
Task.Input
, are NamedTasks that re-evaluate every time Mill is run. This is in contrast to TargetImpls which only re-evaluate when upstream tasks change.InputImpls are useful when you want to capture some input to the Mill build graph that comes from outside: maybe from an environment variable, a JVM system property, the hash returned by
git rev-parse HEAD
. Reading these external mutable variables inside aTask{...}
TargetImpl will incorrectly cache them forever. Reading them inside aTask.Input{...}
will re-compute them every time, and only if the value changes would it continue to invalidate downstream TargetImplsThe most common case of InputImpl is SourceImpl and SourcesImpl, used for detecting changes to source files.
- macro def Source(value: Result[api.PathRef])(implicit ctx: Ctx): Target[api.PathRef]
- macro def Source(value: Result[Path])(implicit ctx: Ctx): Target[api.PathRef]
Similar to Source, but only for a single source file or folder.
Similar to Source, but only for a single source file or folder. Defined using
Task.Source
. - macro def Sources(values: Result[Seq[api.PathRef]])(implicit ctx: Ctx): Target[Seq[api.PathRef]]
- macro def Sources(values: Result[Path]*)(implicit ctx: Ctx): Target[Seq[api.PathRef]]
A specialization of InputImpl defined via
Task.Sources
, SourcesImpl uses PathRefs to compute a signature for a set of source files and folders.A specialization of InputImpl defined via
Task.Sources
, SourcesImpl uses PathRefs to compute a signature for a set of source files and folders.This is most used when detecting changes in source code: when you edit a file and run
mill compile
, it is theTask.Sources
that re-computes the signature for you source files/folders and decides whether downstream TargetImpls need to be invalidated and re-computed. - macro def Worker[T](t: Result[T])(implicit ctx: Ctx): Worker[T]
Worker is a NamedTask that lives entirely in-memory, defined using
Task.Worker{...}
.Worker is a NamedTask that lives entirely in-memory, defined using
Task.Worker{...}
. The value returned byTask.Worker{...}
is long-lived, persisting as long as the Mill process is kept alive (e.g. via--watch
, or via its defaultMillServerMain
server process). This allows the user to perform in-memory caching that is even more aggressive than the disk-based caching enabled by PersistentImpl: your Worker can cache running sub-processes, JVM Classloaders with JITed code, and all sorts of things that do not easily serialize to JSON on disk.Like PersistentImpl, The user defining a Worker assumes the responsibility of ensuring the implementation is idempotent regardless of what in-memory state the worker may have.
- def apply(t: NamedParameterOnlyDummy = new NamedParameterOnlyDummy, persistent: Boolean = false): ApplyFactory
Persistent tasks are defined using the
Task(persistent = true){...}
syntax.Persistent tasks are defined using the
Task(persistent = true){...}
syntax. The main difference is that while TargetImpl deletes theT.dest
folder in between runs, PersistentImpl preserves it. This lets the user make use of files on disk that persistent between runs of the task, e.g. to implement their own fine-grained caching beyond what Mill provides by default.Note that the user defining a
Task(persistent = true)
task is taking on the responsibility of ensuring that their implementation is idempotent, i.e. that it computes the same result whether there is data inT.dest
. Violating that invariant can result in confusing mis-behaviors - macro def apply[T](t: Result[T])(implicit rw: upickle.default.ReadWriter[T], ctx: Ctx): Target[T]
- macro def apply[T](t: T)(implicit rw: upickle.default.ReadWriter[T], ctx: Ctx): Target[T]
- def args(implicit ctx: api.Ctx.Args): IndexedSeq[_]
Returns the implicit mill.api.Ctx.Args.args in scope.
Returns the implicit mill.api.Ctx.Args.args in scope.
- Definition Classes
- TaskBase
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- def ctx()(implicit c: api.Ctx): api.Ctx
- Definition Classes
- Applyer
- def dest(implicit ctx: Dest): Path
T.dest
is a uniqueos.Path
(e.g.T.dest
is a uniqueos.Path
(e.g.out/classFiles.dest/
orout/run.dest/
) that is assigned to every Target or Command. It is cleared before your task runs, and you can use it as a scratch space for temporary files or a place to put returned artifacts. This is guaranteed to be unique for every Target or Command, so you can be sure that you will not collide or interfere with anyone else writing to those same paths.- Definition Classes
- TaskBase
- def env(implicit ctx: Env): Map[String, String]
T.env
is the environment variable map passed to the Mill command when it is run; typically used inside aTask.Input
to ensure any changes in the env vars are properly detected.T.env
is the environment variable map passed to the Mill command when it is run; typically used inside aTask.Input
to ensure any changes in the env vars are properly detected.Note that you should not use
sys.env
, as Mill's long-lived server process means thatsys.env
variables may not be up to date.- Definition Classes
- TaskBase
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def fork(implicit ctx: api.Ctx): Api
Provides the
.fork.async
and.fork.await
APIs for spawning and joining async futures within your task in a Mill-friendly manner.Provides the
.fork.async
and.fork.await
APIs for spawning and joining async futures within your task in a Mill-friendly manner.- Definition Classes
- TaskBase
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def home(implicit ctx: Home): Path
Returns the implicit mill.api.Ctx.Home.home in scope.
Returns the implicit mill.api.Ctx.Home.home in scope.
- Definition Classes
- TaskBase
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def log(implicit ctx: Log): Logger
T.log
is the default logger provided for every task.T.log
is the default logger provided for every task. While your task is running,System.out
andSystem.in
are also redirected to this logger. The logs for a task are streamed to standard out/error as you would expect, but each task's specific output is also streamed to a log file on disk, e.g.out/run.log
orout/classFiles.log
for you to inspect later.Messages logged with
log.debug
appear by default only in the log files. You can use the--debug
option when running mill to show them on the console too.- Definition Classes
- TaskBase
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def reporter(implicit ctx: api.Ctx): (Int) => Option[CompileProblemReporter]
Report build results to BSP for IDE integration
Report build results to BSP for IDE integration
- Definition Classes
- TaskBase
- def sequence[T](source: Seq[Task[T]]): Task[Seq[T]]
Converts a
Seq[Task[T]]
into aTask[Seq[T]]
Converts a
Seq[Task[T]]
into aTask[Seq[T]]
- Definition Classes
- TaskBase
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def testReporter(implicit ctx: api.Ctx): TestReporter
Report test results to BSP for IDE integration
Report test results to BSP for IDE integration
- Definition Classes
- TaskBase
- def toString(): String
- Definition Classes
- AnyRef → Any
- def traverse[T, V](source: Seq[T])(f: (T) => Task[V]): Task[Seq[V]]
Converts a
Seq[T]
into aTask[Seq[V]]
using the givenf: T => Task[V]
Converts a
Seq[T]
into aTask[Seq[V]]
using the givenf: T => Task[V]
- Definition Classes
- TaskBase
- def traverseCtx[I, R](xs: Seq[Task[I]])(f: (IndexedSeq[I], api.Ctx) => Result[R]): Task[R]
A variant of traverse that also provides the mill.api.Ctx to the function f
A variant of traverse that also provides the mill.api.Ctx to the function f
- Definition Classes
- TraverseCtxHolder
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def workspace(implicit ctx: api.Ctx): Path
This is the
os.Path
pointing to the project root directory.This is the
os.Path
pointing to the project root directory.This is the preferred access to the project directory, and should always be preferred over
os.pwd
* (which might also point to the project directory in classic cli scenarios, but might not in other use cases like BSP or LSP server usage).- Definition Classes
- TaskBase
Deprecated Value Members
- macro def apply[T](t: Task[T])(implicit rw: upickle.default.ReadWriter[T], ctx: Ctx): Target[T]
- Annotations
- @deprecated
- Deprecated
(Since version Mill after 0.12.0-RC1) Creating a target from a task is deprecated. You most likely forgot a parenthesis pair
()
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)