Skip to content

Build Environment Functions


Build Application

Configure a project to use Zesk Build.

buildApplicationConfigure

Configure project for Zesk Build

Usage

buildApplicationConfigure --non-interactive [ --owner ownerName ] [ --name applicationName ] [ --code codeName ] [ --help ]

Set up a new project for Zesk Build - Creates shell development environment - Registers git hooks - Configures base environment variables EXPERIMENTAL - not finished yet.

Location: bin/build/tools/application.sh

Arguments

  • --non-interactive - Flag. Optional. Do not prompt for input and fail if input is required.
  • --owner ownerName - String. Optional. The APPLICATION_OWNER.
  • --name applicationName - String. Optional. The APPLICATION_NAME.
  • --code codeName - String. Optional. The APPLICATION_CODE.
  • --help - Flag. Optional. Display this help.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Build Environment

  • Easier access to BUILD_HOME (calculates if needed) and environment variables
  • Creation and easy access to cache directory
  • Access known environment variables with defaults, and installing install-bin-build.sh in new projects.

buildHome

Prints the build home directory (usually same as the application

Usage

buildHome [ --help ]

Prints the build home directory (usually same as the application root)

Location: bin/build/tools/build.sh

Arguments

  • --help - Flag. Optional. Display this help.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

buildEnvironmentGet

Load and print one or more environment settings

Usage

buildEnvironmentGet [ envName ] [ --application applicationHome ] [ --quiet ]

Load and print one or more environment settings

If BOTH files exist, both are sourced, so application environments should anticipate values created by build's default. Modifies local environment. Not usually run within a subshell.

Location: bin/build/tools/build.sh

Arguments

  • envName - String. Optional. Name of the environment value to load. Afterwards this should be defined (possibly blank) and exported.
  • --application applicationHome - Path. Optional. Directory of alternate application home. Can be specified more than once to change state.
  • --quiet - Flag. Optional. No error is displayed when an environment variable does not exist, but return code 1 is returned.

Writes to standard output

The environment variable(s) requested, one per line

Return codes

  • 1 - The environment variable is not found.
  • 0 - The environment variable is found and the value was output to stdout

Environment

buildEnvironmentGetDirectory

Load and print one or more environment settings which represents

Usage

buildEnvironmentGetDirectory [ envName ] [ --subdirectory subdirectory ] [ --mode fileMode ] [ --owner ownerName ] [ --no-create ]

Load and print one or more environment settings which represents a directory which should be created.

If BOTH files exist, both are sourced, so application environments should anticipate values created by build's default.

Modifies local environment. Not usually run within a subshell.

Location: bin/build/tools/build.sh

Arguments

  • envName - String. Optional. Name of the environment value to load. Afterwards this should be defined (possibly blank) and exported.
  • --subdirectory subdirectory - String. Optional. Name of a subdirectory to return "beneath" the value of environment variable. Created if the flag is set.
  • --mode fileMode - String. Optional. Enforce the mode for mkdir --mode and chmod. Use special mode - to mean no mode enforcement.
  • --owner ownerName - String. Optional. Enforce the owner of the directory. Use special ownerName - to mean no owner enforcement.
  • --no-create - Flag. Optional. Do not create the subdirectory if it does not exist.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

buildEnvironmentFiles

Determine the environment file names for environment variables

Usage

buildEnvironmentFiles [ envName ] [ --application applicationHome ] [ --help ] [ --handler handler ]

Determine the environment file names for environment variables

Location: bin/build/tools/build.sh

Arguments

  • envName - String. Optional. Name of the environment value to find
  • --application applicationHome - Path. Optional. Directory of alternate application home. Can be specified more than once to change state.
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

buildEnvironmentNames

List known environment names

Usage

buildEnvironmentNames [ --help ]

Environment: Output the list of environment variable names which can be loaded via buildEnvironmentLoad or buildEnvironmentGet

Location: bin/build/tools/build.sh

Arguments

  • --help - Flag. Optional. Display this help.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

Requires

buildEnvironmentLoad

Load one or more environment settings from the environment file

Usage

buildEnvironmentLoad [ envName ] [ --application applicationHome ] [ --all ] [ --print ] [ --quiet ] [ --help ]

Load one or more environment settings from the environment file path.

If BOTH files exist, both are sourced, so application environments should anticipate values created by build's default.

Modifies local environment. Not usually run within a subshell.

Location: bin/build/tools/build.sh

Arguments

  • envName - String. Optional. Name of the environment value to load. Afterwards this should be defined (possibly blank) and exported.
  • --application applicationHome - Path. Optional. Directory of alternate application home. Can be specified more than once to change state.
  • --all - Flag. Optional. Load all environment variables defined in BUILD_ENVIRONMENT_DIRS.
  • --print - Flag. Print the environment file loaded first.
  • --quiet - Flag. Optional. No error is displayed when an environment variable does not exist, but return code 1 is returned.
  • --help - Flag. Optional. Display this help.

Return codes

  • 1 - The environment variable is not found.
  • 0 - The environment variable is found and the file was loaded (which should set to the global environment variable named)

Environment

buildEnvironmentAdd

Adds an environment variable file to a project

Usage

buildEnvironmentAdd [ --help ] [ --force ] [ --quiet ] [ --verbose ] [ --value value ] environmentName ...

Adds an environment variable file to a project

Location: bin/build/tools/build.sh

Arguments

  • --help - Flag. Optional. Display this help.
  • --force - Flag. Optional. Replace the existing file if it exists or create it if it does not.
  • --quiet - Flag. Optional. No status messages.
  • --verbose - Flag. Optional. Display status messages.
  • --value value - String. Optional. Set the value to this fixed string in the file. Only valid when a single environmentName is used.
  • environmentName ... - EnvironmentName. Required. One or more environment variable names to add to this project.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

buildEnvironmentContext

Run a command and ensure the build tools context matches

Usage

buildEnvironmentContext startDirectory command [ ... ]

Run a command and ensure the build tools context matches the current project.

Useful when you need to ensure the command is run with the correct version of Zesk Build.

Avoid infinite loops here, call down.

Location: bin/build/tools/build.sh

Arguments

  • startDirectory - Directory. Required. Context in which the command should run.
  • command - Callable. Required. Command to run in new context.
  • ... - Arguments. Optional. Arguments to the command.

Examples

buildEnvironmentContext "$(pwd)" environmentFileLoad "$(pwd)/.env" --execute timing --slow 500 "$(pwd)/bin/ping.py"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

buildFunctions

Prints the list of functions defined in Zesk Build

Usage

buildFunctions [ --help ] [ --deprecated ] [ --help ]

Prints the list of functions defined in Zesk Build

Location: bin/build/tools/build.sh

Arguments

  • --help - Flag. Optional. Display this help.
  • --deprecated - Flag. Optional. Include all deprecated functions as well.
  • --help - Flag. Optional. Display this help.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

buildFunctionsExclude

Exclude all function names in this library

Usage

buildFunctionsExclude [ --help ]

Removes any function from the text stream which is in buildFunctions

Location: bin/build/tools/build.sh

Arguments

  • --help - Flag. Optional. Display this help.

Reads standard input

line:Function

Writes to standard output

line:Function

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

buildInternalFunctions

Prints the list of internal functions defined in Zesk Build

Usage

buildInternalFunctions [ --help ]

Prints the list of internal functions defined in Zesk Build - for internal documentation use only.

Location: bin/build/tools/build.sh

Arguments

  • --help - Flag. Optional. Display this help.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

buildDeprecatedFunctions

List all functions which are currently deprecated in Zesk Build

Usage

buildDeprecatedFunctions [ --help ]

List all functions which are currently deprecated in Zesk Build

Location: bin/build/tools/build.sh

Arguments

  • --help - Flag. Optional. Display this help.

Writes to standard output

String

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

buildCacheDirectory

Path to cache directory for build system.

Usage

buildCacheDirectory [ pathSegment ] [ --help ]

Path to cache directory for build system.

Defaults to $XDG_CACHE_HOME/.build unless $XDG_CACHE_HOME is not a directory.

Appends any passed in arguments as path segments.

Location: bin/build/tools/build.sh

Arguments

  • pathSegment - One or more directory or file path, concatenated as path segments using /
  • --help - Flag. Optional. Display this help.

Examples

logFile=$(buildCacheDirectory test.log)

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

buildQuietLog

Generate the path for a quiet log in the build

Usage

buildQuietLog name [ --no-create ]

Generate the path for a quiet log in the build cache directory, creating it if necessary.

Location: bin/build/tools/build.sh

Arguments

  • name - String. Required. The log file name to create. Trims leading _ if present.
  • --no-create - Flag. Optional. Do not require creation of the directory where the log file will appear.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Running commands

tools

Run a Zesk Build command or load it

Usage

tools [ --help ] [ --start startDirectory ] [ --verbose ] [ ... ]

Run a Zesk Build command or load it

Location: bin/build/tools/build.sh

Arguments

  • --help - Flag. Optional. Display this help.
  • --start startDirectory - Directory. Optional. Start searching for a build installation at this location and searching upwards in the file hierarchy.
  • --verbose - Flag. Optional. Be verbose.
  • ... - Callable. Optional. Run this command after loading in the current build context.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Installing install-bin-build.sh

installInstallBuild

Installs install-bin-build.sh the first time in a new project, and

Usage

installInstallBuild [ --help ] [ --diff ] [ --local ] [ path ] [ applicationHome ] [ --help ]

Installs install-bin-build.sh the first time in a new project, and modifies it to work in the application path.

Location: bin/build/tools/build.sh

Arguments

  • --help - Flag. Optional. This help.
  • --diff - Flag. Optional. Show differences between new and old files if changed.
  • --local - Flag. Optional. Use local copy of install-bin-build.sh instead of downloaded version.
  • path - Directory. Optional. Path to install the binary. Default is bin. If ends with .sh will name the binary this name.
  • applicationHome - Directory. Optional. Path to the application home directory. Default is current directory.
  • --help - Flag. Optional. Display this help.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Installing Zesk Build

{__installPackageConfiguration}


🛠️ Tools · ⬅ Top