Tasks can access features of the build system which outlive the time of a build execution.
The environment provides features for querying properties, caching data between executions, and is parameterizable using user parameters.
The lifetime of the environment outlives the build executions.
The environmenmt always resides on the machine which is used to execute the task. This is important to keep in mind when designing tasks for remote execution.
public < | getCachedData( Gets a cached data from the environment. |
public ClassPathLoadManager | Gets the object which is used to manage the classpath loading for the build environment. |
public UUID | Gets the unique identifier of this environment. |
public Path | Gets the path to the JAR which was used to load the build system related classes. |
public < | getEnvironmentPropertyCurrentValue( Gets the current value of an environment property. |
public ThreadGroup | Gets the base thread group for the environment. |
public Map< | Gets the user parameters which were used to instantiate this environment. |
The build system manages a cache for the keys. Each key uniquely identifies a cache entry, and it is used to calculate the cached data. The cache stores objects in a resource-data pair, which is used for proper deallocation of the resources. More information in the documentation of CacheKey.
Clients should only use this when caching data via getCachedData(
Each environment that exists have an unique UUID identifier. They are automatically generated when the environment is constructed. Callers should not rely on these identifiers being the same between two build executions. The identifiers may change between different invocations of a build.
The identifier can be used in some build system features to uniquely identify environments to run operations on.
This method may throw UnsupportedOperationException when it is called in an inappropriate time. Currently the only one is when the suitability of an environment is being determined by tasks to execute on. See TaskExecutionEnvironmentSelector for more information.
For example this JAR can be used to start external processes which require the build system classes on their classpath.
Environment properties are cached and only calculated once for each property that equals.
Any exception thrown during property calculation is relayed to the caller.
null
.
Callers can use this threadgroup to start threads which outlives the lifetime of an execution. They should
not start threads arbitrarily, but only when they are caching data via getCachedData(
If tasks need to start threads for cached data, they are required to start these on the environment thread group. If they don't, then an exception will be thrown when the corresponding build execution finishes. The build environment may call ThreadGroup.destroy() on the build execution thread group to ensure that task executions do not leak threads. If any alive threads remain in the build execution thread group, the build may be considered failed.
This thread group will be destroyed when the build environment is closed.
This is not the same user parameters used during build execution.
The map contains arbitrarily specified key-value pairs by the user. Values may be null
.