Skip to content

Reference | Rules

Oleg edited this page Mar 30, 2017 · 7 revisions

Defining rules

Rule is added by a rule directive in xake script body. "main" target is an entry point.

Similarly rules directive allows to add multiple rules passed as array. For example:

do xake ExecOptions.Default {
    rules [
        "main" <== ["hw.exe"]
        "hw.dll" *> fun exe -> // no need in action because Csc task is an action
          do! Csc {
            CscSettings with
              Out = exe
              TargetType = TargetType.Library
              Src = !! "util.cs"
            }

        "hw.exe" *> fun exe -> action {
          do! Csc {
            CscSettings with
              Out = exe
              Src = !! "hw.cs"
              Ref = !! "hw.dll"
            }
          }
    ]
}

The script defines main rule is to build "hw.exe". <== operator (described in reference) defines a rule which requires other targets to complete. When build tool meet the Ref pointing to hw.dll it looks for rule matching the file name, starts the build step and waits until it completes.

*> operator defines a "file rule". The argument is File instance pointing to demanded file. The action block has to produce the file at that location.

File/rule name matching

TBD

Clone this wiki locally