Target Block

The target block describes requirements for running a target. A target has a unique name in the scope of this file (see identifier).

The special syntax target.^<target> denotes targets for all dependencies whereas target.<target> denotes a target for current project only.

Example below for project A with dependencies on projects B and C.

flowchart LR
  classDef default fill:moccasin,stroke:black
  classDef project fill:gainsboro,stroke:black,rx:10,ry:10
  classDef build fill:palegreen,stroke:black,rx:20,ry:20
  classDef publish fill:skyblue,stroke:black,rx:20,ry:20
  classDef target fill:white,stroke-width:2px,stroke-dasharray: 5 2

  subgraph A["Project A"]
    subgraph targetBuildA["target build"]
      direction LR
    end

    subgraph targetPublishA["target publish"]
      direction LR
    end

    class targetBuildA build
    class targetPublishA build
  end

  subgraph B["Project B"]
    subgraph targetBuildB["target build"]
      direction LR
    end

    class targetBuildB build
  end

  subgraph C["Project C"]
    subgraph targetBuildC["target build"]
      direction LR
    end

    class targetBuildC build
  end

  targetBuildA -- ^build --> targetBuildB
  targetBuildA -- ^build --> targetBuildC
  targetPublishA -- build --> targetBuildA
  
  class A,B,C project

Example Usage

target build {
    depends_on = [ target.^build
                   target.init ]
    rebuild = ~cascade
    artifacts = ~managed
}

Argument Reference

The following arguments are supported:

  • identifier - (Mandatory) Identifier of the target.
  • depends_on - (Optional) List of required targets this target depends on. Note the special syntax for ancestor: target.^build force completion of target.build target for all dependencies before proceeding. Default is no dependencies.
  • rebuild - (Optional) Override default rebuild mode. By default, the target is rebuilt if hash has changed (~auto by default). Possible values are ~auto (rebuild on changes), ~always (force build) and ~cascade (build with parent within a cluster).
  • artifacts - (Optional) Override cacheability of the artifacts. By default, the value is the cacheability of the last command. Possible values are ~none, ~workspace, ~managed and ~external.
graph BT
start -- build --> A["Project A"] -- build --> B["Project B"]
                   A["Project A"] -- build --> C["Project C"]
Last updated on