Environment¶
Description¶
Environment variables can be configured in the configuration file. They will only be set for the particular command(s) defined by the relevant section of the configuration.
Environment variables can not be set directly in a command line command. The environment configuration key needs to be used for this. See section ‘environment’.
Environment¶
The environment keyword can be set for every plugin that supports the env configuration setting. Check the documentation on a specific plugin to check whether the plugin supports this configuration setting.
The environment keyword must contain a map of key-value pairs, where the key is the name of the environment variable and the value is the value associated with the specified environment variable. Patterns can be used for the environment these variable values too.
Note: The PWD environment variable, following POSIX convention, is set by the application to the working directory of the task. Therefore, its value cannot be overriden in the configuration.
Example configuration¶
commands: # The mandatory commands key
build: Build the project # A map of command keys with their explanation
clean: Clean the project
rebuild: Build + clean
patterns: # Declare the patterns for this configuration file
COMPILER: # Declare the COMPILER pattern
default-values: # Default values to use for the pattern
- g++
- clang++
short-option: c # Declare values for this pattern by using the -c [VALUES] option when calling exec-helper
long-option: compiler # Declare values for this pattern by using the --compiler [VALUES] option when calling exec-helper
MODE: # Declare the MODE pattern
default-values:
- debug
- release
short-option: m
long-option: mode
additional-search-paths:
- /tmp
# Define the commands listed under 'commands'
build:
- command-line-command # Use the command-line-command plugin when using the 'build' command
clean:
- command-line-command # Use the command-line-command plugin when using the 'clean' command
rebuild:
- clean # Call the 'clean' command when calling the 'rebuild' command
- build # Call the 'build' command when calling the 'rebuild' command
command-line-command: # Configure the command-line-command
patterns: # Define the default patterns to use
- COMPILER
- MODE
command-line: # Configure the execution when the specific command is not listed. Will be executed from the directory of this configuration file
- echo
- building
- using
- "{COMPILER}" # This value will be replaced by the COMPILER pattern value
- in
- "{MODE}" # This value will be replaced by the MODE pattern value
- mode.
- wd=$(pwd) # This command will be executed in a subshell and replaced by its value before the actual command is executed
clean: # Configure the execution of the build command
patterns: # Overwrite the parent patterns
- MODE
- EH_WORKING_DIR # Use the EH_WORKING_DIR pattern
command-line:
- echo
- cleaning
- mode.
- "{MODE}" # This value will be replaced by the MODE pattern value
- wd=$(pwd)
working-dir: "{EH_WORKING_DIR}" # The command will be executed from the current working directory rather than from the directory of this configuration file
See also¶
See Configuration (5) for information about the configuration file.