TaskCtx

mill.define.TaskCtx
See theTaskCtx companion object
@Scaladoc(value = "/**\n * Represents the data and utilities that are contextually available inside the\n * implementation of a `Task`.\n */")
trait TaskCtx extends Dest, Log, Args, Env, Workspace, Fork, Jobs, Offline, Fail

Represents the data and utilities that are contextually available inside the implementation of a Task.

Attributes

Companion
object
Source
TaskCtx.scala
Graph
Supertypes
trait Fail
trait Offline
trait Jobs
trait Fork
trait Workspace
trait Env
trait Args
trait Log
trait Dest
class Object
trait Matchable
class Any
Show all

Members list

Value members

Abstract methods

def reporter: Int => Option[CompileProblemReporter]

Attributes

Source
TaskCtx.scala
def systemExit: Int => Nothing

Attributes

Source
TaskCtx.scala

Attributes

Source
TaskCtx.scala

Inherited and Abstract methods

def arg[T](index: Int): T

Attributes

Inherited from:
Args
Source
TaskCtx.scala
def args: IndexedSeq[_]

Attributes

Inherited from:
Args
Source
TaskCtx.scala
@Scaladoc(value = "/**\n * `Task.dest` is a unique `os.Path` (e.g. `out/classFiles.dest/` or `out/run.dest/`)\n * that is assigned to every Target or Command. It is cleared before your\n * task runs, and you can use it as a scratch space for temporary files or\n * a place to put returned artifacts. This is guaranteed to be unique for\n * every Target or Command, so you can be sure that you will not collide or\n * interfere with anyone else writing to those same paths.\n */")
def dest: Path

Task.dest is a unique os.Path (e.g. out/classFiles.dest/ or out/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.

Task.dest is a unique os.Path (e.g. out/classFiles.dest/ or out/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.

Attributes

Inherited from:
Dest
Source
TaskCtx.scala
@Scaladoc(value = "/**\n * `Task.env` is the environment variable map passed to the Mill command when\n * it is run; typically used inside a `Task.Input` to ensure any changes in\n * the env vars are properly detected.\n *\n * Note that you should not use `sys.env`, as Mill\'s long-lived server\n * process means that `sys.env` variables may not be up to date.\n */")
def env: Map[String, String]

Task.env is the environment variable map passed to the Mill command when it is run; typically used inside a Task.Input to ensure any changes in the env vars are properly detected.

Task.env is the environment variable map passed to the Mill command when it is run; typically used inside a Task.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 that sys.env variables may not be up to date.

Attributes

Inherited from:
Env
Source
TaskCtx.scala
@Scaladoc(value = "/**\n * Fail this task with a message.\n * This is a convenient alternative to returning [[Result.Failure]]\n * which also requires the happy path to return [[Result.Success]].\n */")
def fail(msg: String): Nothing

Fail this task with a message. This is a convenient alternative to returning Result.Failure which also requires the happy path to return Result.Success.

Fail this task with a message. This is a convenient alternative to returning Result.Failure which also requires the happy path to return Result.Success.

Attributes

Inherited from:
Fail
Source
TaskCtx.scala
@Scaladoc(value = "/**\n * Provides APIs for Mill tasks to spawn `async` \"future\" computations that\n * can be `await`ed upon to yield their result. Unlike other thread pools or\n * `Executor`s, `fork.async` spawns futures that follow Mill\'s `-j`/`--jobs` config,\n * sandbox their `os.pwd` in separate folders, and integrate with Mill\'s terminal\n * logging prefixes and prompt so a user can easily see what futures are running\n * and what logs belong to each future.\n */")
def fork: Api

Provides APIs for Mill tasks to spawn async "future" computations that can be awaited upon to yield their result. Unlike other thread pools or Executors, fork.async spawns futures that follow Mill's -j/--jobs config, sandbox their os.pwd in separate folders, and integrate with Mill's terminal logging prefixes and prompt so a user can easily see what futures are running and what logs belong to each future.

Provides APIs for Mill tasks to spawn async "future" computations that can be awaited upon to yield their result. Unlike other thread pools or Executors, fork.async spawns futures that follow Mill's -j/--jobs config, sandbox their os.pwd in separate folders, and integrate with Mill's terminal logging prefixes and prompt so a user can easily see what futures are running and what logs belong to each future.

Attributes

Inherited from:
Fork
Source
TaskCtx.scala
def jobs: Int

Attributes

Inherited from:
Jobs
Source
TaskCtx.scala
@Scaladoc(value = "/**\n * `Task.log` is the default logger provided for every task. While your task is running,\n * `System.out` and `System.in` are also redirected to this logger. The logs for a\n * task are streamed to standard out/error as you would expect, but each task\'s\n * specific output is also streamed to a log file on disk, e.g. `out/run.log` or\n * `out/classFiles.log` for you to inspect later.\n *\n * Messages logged with `log.debug` appear by default only in the log files.\n * You can use the `--debug` option when running mill to show them on the console too.\n */")
def log: Logger

Task.log is the default logger provided for every task. While your task is running, System.out and System.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 or out/classFiles.log for you to inspect later.

Task.log is the default logger provided for every task. While your task is running, System.out and System.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 or out/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.

Attributes

Inherited from:
Log
Source
TaskCtx.scala
def offline: Boolean

Attributes

Inherited from:
Offline
Source
TaskCtx.scala
@Scaladoc(value = "/**\n * This is the `os.Path` pointing to the project root directory.\n *\n * This is the preferred access to the project directory, and should\n * always be preferred over `os.pwd`* (which might also point to the\n * project directory in classic cli scenarios, but might not in other\n * use cases like BSP or LSP server usage).\n */")
def workspace: 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).

Attributes

Inherited from:
Workspace
Source
TaskCtx.scala