Execution context is to be considered as a parent of TaskContext, it is created for each build execution.
The execution context provides the following functionalities:
- Accessing the build configuration
- Managing script target configurations
- Evaluating execution properties
- Providing access to loaded repositories
- Root directory management
- Execution-wide related features (e.g. appropriate caching)
- Other executional services which have a longer lifetime than task execution, but do not necessarily outlive execution lifetime
Execution properties can be evaluated using the execution context, which will be cached during the lifetime of the execution.
The execution context provides access to the root directories of the in-memory file hierarchy. They should be used tasks to handle file in- and output. The root directories are determined based on the user provided path configuration. See ExecutionDirectoryContext.getRootDirectories().
Clients should not implement this interface.
Gets the current date milliseconds for the build execution.
Gets the content descriptor of the file that is represented by the given argument path key.
Gets the environment for the current execution.
Gets the current value of the parameter execution property.
Gets the loaded repositories for this execution.
Gets the loaded script language provider for the specifeid script provider location.
Gets the mirror directory which was configured for this build execution.
Gets the path configuration which was used to start this build execution.
Gets the repository configuration which was used to start this build execution.
Gets the script configuration which was used to start this build execution.
Gets the target configuration for a given file based on the execution configuration.
Gets the arbitrary user parameters used to start this build execution.
Gets if the task implementations are recommended to provide configurations for IDE usage.
Gets if the current build execution records a build trace.
Tests the environment selection of a given selector the same way it is determined by the build system during execution.
Gets the mirror path for the argument execution path.
Converts a mirror path to execution path.
The current content descriptor is retrieved that is tracked by the build system for the given file. The in-memory file hierarchy doesn't affect the content descriptor returned by this method.
This method can be used to retrieve content descriptors for files which are not part of the build execution. I.e. are not accessible via the execution path roots.
Usually, the returned descriptor will be constructed based on the database configuration. (Attribute, hash based descriptors, etc...) If a file synchronization already took place for the given file, then the synchronized content descriptor is returned, if the file hasn't been modified since.
nullif the file doesn't exist.
For remote execution: The environment is always on the same machine as the currently running task, meaning that the build environment will be replicated for every PC that is used as a cluster.
The properties are cached during the lifetime of the execution.
The repositories are mapped to their identifiers specified by the user. If an identifier was not set by the user, an automatically generated one is used.
The script language providers are loaded based on the execution script configuration and the providers are accessible based on the script load location.
The location can be queried from the current script configuration (getScriptConfiguration()) and the
location can be retrieved from
Make sure callers report an appropriate execution property dependency when handling script providers. It is recommended that they use ScriptParsingConfigurationExecutionProperty for retrieving the requested resources.
nullif no language provider was loaded for the given location.
nullif not available.
This method can be used to retrieve a build target configuration for a given build script file.
When the target configuration is constructed, the current script configuration will be taken into account.
The target configurations are cached during an execution, which means that retrieving the target configuration for files that bear the same path will result in the same configurations returned, even if the files have changed during the two queries. This caching ensures that invoking a target from a given script at a path will run the same build steps even if the build files were changed meanwhile. This is required due to the fact that task execution is highly concurrent and ordering of tasks should not have an effect of executed build targets.
This method will report an execution dependency at the file path for the used script options. If the script
configuration for the execution changes, expect a rerun for the task with a
DeltaType.EXECUTION_PROPERTY_CHANGED delta with the property class of
The method will not report an input dependency on the file.
trueif reporting IDE configurations is recommended.
A build trace is a recording of various aspects of the build execution to be displayed later for the user.
trueif a build trace is being recorded.
This method can be used to test if a given task can be invoked with the given selector. In general, task implementations don't need to used this, however, there might be cases when it is appropriate and necessary to support incremental compilation.
One such scenario is when a task depends on the presence of an SDK installed on an executor machine. In this case, if the SDK gets removed or modified, the build system needs to trigger a reinvocation. In order to achieve this, the task implementation will need to install a dependency on an appropriate ExecutionProperty that determines if a given task can still run in the current build configuration. While this may not be necessary if the interested SDK is present on the coordinator machine, it can be crucial to support proper incremental compilation with build clusters in use.
This method converts the parameter path to the same path that would be the result of the actual mirroring.
This is the inverse conversion of toMirrorPath(
nullif the argument path has no corresponding execution path. This is usually happens when the argument is not a subpath of getMirrorDirectory(), or file mirroring is not available.