Skip to content

Build Environment Functions

Build Application

Configure a project to use Zesk Build.

buildApplicationConfigure

Set up a new 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.

⬅ Parent


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

  • BUILD_HOME - Directory. BUILD_HOME is . when this code is installed - at ./bin/build. Usually an absolute path and does NOT end with a trailing slash. This is computed from the current source file using ${BASH_SOURCE[0]}.

Usage

buildEnvironmentGet [ envName ] [ --application applicationHome ]

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.

Return codes

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

Environment

  • $envName
  • BUILD_ENVIRONMENT_DIRS - DirectoryList. Search directory for environment definition files. : separated.
  • : separated list of paths to load env files

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
  • BUILD_ENVIRONMENT_DIRS - DirectoryList. Search directory for environment definition files. : separated.
  • : separated list of paths to load env files

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

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

Requires

convertValue _buildEnvironmentPath find sort read __help catchEnvironment

Usage

buildEnvironmentLoad [ envName ] [ --application applicationHome ] [ --all ] [ --print ] [ --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.
  • --help - Flag. Optional. Display this help.

Return codes

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

Environment

  • BUILD_ENVIRONMENT_DIRS - DirectoryList. Search directory for environment definition files. : separated.
  • : separated list of paths to load env files

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

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 ... - Required. Command to run in new context.

Return codes

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

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

  • BUILD_HOME - Directory. BUILD_HOME is . when this code is installed - at ./bin/build. Usually an absolute path and does NOT end with a trailing slash. This is computed from the current source file using ${BASH_SOURCE[0]}.

Usage

buildDeprecatedFunctions [ --help ]

List all functions which are currently deprecated in Zesk Build

Writes to standard output

String

Arguments

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

Return codes

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

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

  • XDG_CACHE_HOME - Directory. Base directory for user-specific cache data to be stored

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

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

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

__installPackageConfiguration

!/usr/bin/env bash

Usage

__installPackageConfiguration

!/usr/bin/env bash

Copy this into your project and customize for your own installer process. Copyright © 2026 Market Acumen, Inc.

Arguments

  • none

Return codes

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