@groovy.transform.CompileStatic abstract class AbstractBaseToolExtension<T extends AbstractBaseToolExtension> extends CombinedProjectTaskExtensionBase<T> implements BaseToolLocation
Use as a base class for project and task extensions that will wrap tools.
This base class will also enable extensions to discover whether they are inside a task or a project.
- > The extension class that extends this base class.
Modifiers | Name | Description |
---|---|---|
class |
AbstractBaseToolExtension.1 |
|
class |
AbstractBaseToolExtension.2 |
Modifiers | Name | Description |
---|---|---|
protected boolean |
noGlobalExecSearch |
Type | Name and description |
---|---|
Iterable<String> |
windowsExtensionSearchOrder |
Constructor and description |
---|
protected AbstractBaseToolExtension
(ProjectOperations projectOperations) Attach this extension to a project |
protected AbstractBaseToolExtension
(Task task, ProjectOperations projectOperations, T projectExtension) Attach this extension to a task |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
executableByPath(Object path) Locate an executable by a local path. |
|
void |
executableBySearchPath(Object baseName) Locate executable by searching the current environmental search path. |
|
protected File |
executablePathOrNull() If a path has been set instead of a version, resolve the path. |
|
protected File |
executableSearchPathOrNull() If a search path has been set, resolve the location by searching path |
|
protected void |
failNoExecConfig() Call this when there is no preset way to local the executable. |
|
Provider<File> |
getExecutable() A provider for a resolved executable. |
|
java.util.List<String> |
getWindowsExtensionSearchOrder() The order in which extensions will be checked for locating an executable on Windows. |
|
protected T |
noProjectExtension() Pass to the task constructor when no project extension will be available or required. |
|
protected File |
resolveExecutable() Resolves an executable to a physical local file location. |
|
Provider<String> |
resolvedExecutableVersion() If configured by version returns that, otherwise it might run the executable to obtain the version. |
|
protected abstract String |
runExecutableAndReturnVersion() Runs the executable and returns the version. |
|
protected void |
setExecutableVersionProvider(Provider<String> provider) Overrides the default way or determining what the version is of a tool. |
|
void |
setWindowsExtensionSearchOrder(Iterable<String> order) When searching for executables, the order in which to use check for file extensions. |
|
void |
setWindowsExtensionSearchOrder(String[] order) |
|
protected void |
unsetNonPaths() This is used when path or search path is set to unset other search mechanisms. |
|
protected void |
unsetPaths() Unset both the fixed path and search path. |
Attach this extension to a project
projectOperations
- ProjectOperations instance.Attach this extension to a task
task
- Task to attach to.projectOperations
- ProjectOperations instance.projectExtName
- Extension that is attached to the project.
Pass {@Link #noProjectExtension} is project extension is available or required.Locate an executable by a local path.
path
- Something resolvable to a File.Locate executable by searching the current environmental search path.
baseName
- The base name of the executableIf a path has been set instead of a version, resolve the path.
null
If a search path has been set, resolve the location by searching path
null
if search path was not setCall this when there is no preset way to local the executable.
A provider for a resolved executable.
The order in which extensions will be checked for locating an executable on Windows.
The default is to use whatever is in the PATHEXT
environmental variable.
@return
Pass to the task constructor when no project extension will be available or required.
Resolves an executable to a physical local file location.
If configured by version returns that, otherwise it might run the executable to obtain the version.
Runs the executable and returns the version. See ExecTools.parseVersionFromOutput as a helper to implement this method.
Overrides the default way or determining what the version is of a tool.
provider
- Provider of the version.When searching for executables, the order in which to use check for file extensions.
order
- List of extensions.This is used when path or search path is set to unset other search mechanisms. This is primarily intended to be used within Grolifant itself as part of its base classes and MUST be overridden in those. The default operation is NOOP.
Unset both the fixed path and search path. THis can be used by derived classes to ensure that paths are not included in exectuble resolution
Groovy Documentation