Skip to content

Build Environment Functions

🛠️ Tools · ⬅ Home


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.

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)

Arguments

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

Return codes

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

Environment

  • {SEE:BUILD_HOME.sh}

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.

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

  • $envName
  • {SEE:BUILD_ENVIRONMENT_DIRS.sh} - : separated list of paths to load env files

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.

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

  • $envName
  • {SEE:BUILD_ENVIRONMENT_DIRS.sh} - : separated list of paths to load env files

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

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

  • {SEE:BUILD_ENVIRONMENT_DIRS.sh}

buildEnvironmentNames

Output the list of environment variable names which can be

Usage

buildEnvironmentNames [ --help ]

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

Arguments

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

Return codes

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

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.

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

  • {SEE:BUILD_ENVIRONMENT_DIRS.sh} - : separated list of paths to load env files

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

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 contextStart command [ ... ]

Run a command and ensure the build tools context matches the current project Avoid infinite loops here, call down.

Arguments

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

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

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

  • {SEE:BUILD_HOME.sh}

buildDeprecatedFunctions

List all functions which are currently deprecated in Zesk Build

Usage

buildDeprecatedFunctions [ --help ]

List all functions which are currently deprecated in Zesk Build

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.

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

  • {SEE:XDG_CACHE_HOME.sh}

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.

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

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.

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

Arguments

  • --local localPackageDirectory - Directory. Optional. Directory of an existing bin/build installation to mock behavior for testing
  • --version version - String. Optional. Download just this version of Zesk Build. Prevents stable breaking with new versions of Zesk Build.
  • --url url - URL. Optional. URL of a tar.gz. file. Download source code from here.
  • --debug - Flag. Optional. Debugging is on.
  • --force - Flag. Optional. Force installation even if file is up to date.
  • --diff - Flag. Optional. Show differences between old and new file.

Return codes

  • 1 - Environment error
  • 2 - Argument error

🛠️ Tools · ⬅ Top