Skip to content

The format of a .dyalogbuild file

Michael Baas edited this page Jul 22, 2020 · 12 revisions

Each non-empty line of a DyalogBuild script has the following syntax: INSTRUCTION : argument, Parameter1=value1, Parameter2=value2,... Comment-lines starting with are also supported.

Using Environment-Variables with $EnvVar

Everything after INSTRUCTION (every argument used) may reference environment-variables using syntax $EnvVar. You can continue with any non-alphabetic chars immediately following the name of the var, otherwise leave a blank.

Examples

  • "$Foo\Goo" => "C:\TEMP\Goo"
  • "$Git MyDir" => "c:\git\MyDir"
  • "$Git MyDir" => "c:\git\ MyDir"

Possible INSTRUCTIONs discussed below.

Warning

The logic is rather "brutal": we're looking for $ followed by any number of _,⎕A,⎕D and replace them with the value the environment returns. There currently is no way to avoid that replacement for usage of $ in strings. Please submit an issue if that is a problem.

DYALOGBUILD

DYALOGBUILD : nnn

This instruction must be included and be the first one. "nnn" specifies the minimum version required to run this script.

ID

ID : name[, Version=nnn]

This instruction is purely informational and causes a log entry of "Building name" or "Building name version nnn" where "nnn" is a number.

COPY

COPY : path1, Target=path2

Copies one or more files from path1 to path2.

NS

NS : pathname[, Target=namespace]

Loads the APL object(s) defined in the file(s) matching the pattern "pathname" into "namespace" (default is #), establishing the namespace if it does not exist.

{CLASS|APL}

{CLASS|APL}: pathname[, Target=namespace]

Loads the APL object defined in "pathname" into "namespace" (default is #).

LIB

LIB : name[, Target=namespace]

Loads the library utility "name" into "namespace" (default is #).

A "library utility" is any utility in the folder $DYALOG\Library. These tools can be loaded directly through the LIB-Command without adding pathnames.

Examples

  • LIB: InitConga, Target=#.cng

    Loads the file InitConga.dyalog into namespace #.cng

  • LIB: APLProcess

    Loads APLProcess into #.

CSV

CSV : pathname, Target=matname[, ColTypes=spec]

Loads the CSV file "pathname" as a matrix called "matname". "spec" corresponds to the third element of ⎕CSV's right argument; for details, see https://help.dyalog.com/18.0/Content/Language/System%20Functions/csv.htm

DATA

DATA : pathname, Target=namespace[, Format=type[, SetEOL=nl]]

Loads the contents of the file(s) matching the pattern "pathname" into one or more variables in "namespace" (default is #). The variable(s) will be named with the base filename(s).

"type" dictates how the file content of each file is interpreted, and may be one of:

  • charvec - meaning as a simple character vector. If SetEOL=nl is specified, the lines will be separated by the chosen line ending sequence; one or more of the leftmost character codes or the corresponding decimal numbers of:

                LF   Line Feed            ⎕UCS 10    (the default)
                VT   Vertical Tab         ⎕UCS 11
                FF   Form Feed            ⎕UCS 12
                CR   Carriage Return      ⎕UCS 13
                NEL  New Line             ⎕UCS 133
                LS   Line Separator       ⎕UCS 8282
                PS   Paragraph Separator  ⎕UCS 8233
    
  • charvecs - meaning as a vector of character vectors

  • charmat - meaning as a character matrix

  • json - meaning as json. The variable will be a numeric scalar, a vector, or a namespace in accordance with the JSON code in the file.

LX

LX : expression

Sets the workspace's ⎕LX to "expression".

EXEC

EXEC : expression

Executes the APL expression "expression".

PROD

PROD : expression

Executes the APL expression "expression" only if ]DBuild was called with the -production modifier

DEFAULTS

DEFAULTS : "expression"

Executes the APL expression "expression" in each namespace created or accessed by the NS instruction (and in #, of course). A build-file may contain multiple DEFAULTS-statements, the expressions will be executed in the sequence they were found. To be very clear:

DEFAULTS: ⎕IO←0
NS: MyNS, Target=#.myNS
DEFAULTS: ⎕IO←1
NS: MyNS2, Target=#.myNS2

⎕IO will be set to 1 in #,myNS and myNS2.

TARGET

TARGET : wsname.dws

Sets the WSID to "wsname.dws" so the workspace is ready to )SAVE. Supports optional parameters:

  • save=0|1 (Default 0): save the workspace after a successfull (=no errors were logged) build.
  • off=0|1 (Default=0): )OFF after completion of Build. If errors were logged, a logfile (same name as the .dyalogbuild-file with .log-extension) will be created and exit code 1 will be set.