Interface Tool
public sealed interface Tool
Tools are definitions of Java libraries (may or may not be executable) that are managed by Gradle using a
ValueSource. This means that while the downloading and local caching of this file are done
in house, the Gradle-specific caching and file tracking are done by Gradle. This enables the usage of downloading
external files quickly without breaking caches.-
Method Summary
Modifier and TypeMethodDescriptiondefault org.gradle.api.provider.Provider<File> get(org.gradle.api.file.Directory cachesDir, org.gradle.api.provider.ProviderFactory providers) Gets this tool and returns a provider for the downloaded/cached file.org.gradle.api.provider.Provider<File> get(org.gradle.api.provider.Provider<? extends org.gradle.api.file.Directory> cachesDir, org.gradle.api.provider.ProviderFactory providers) Gets this tool and returns a provider for the downloaded/cached file.intThe Java version this tool was built with.The main class to use when executing this tool.getName()The name for this tool.static ToolCreates a new tool with the given information.static ToolCreates a new tool with the given information.
-
Method Details
-
of
Creates a new tool with the given information.- Parameters:
name- The name for this tool (will be used in the file name)version- The version for this tool (will be used in the file name)downloadUrl- The download URL for this tooljavaVersion- The Java version this tool was built with, or should run onmainClass- The main class to use when executing this tool- Returns:
- The tool
-
of
Creates a new tool with the given information.- Parameters:
name- The name for this tool (will be used in the file name)version- The version for this tool (will be used in the file name)downloadUrl- The download URL for this tooljavaVersion- The Java version this tool was built with, or should run on- Returns:
- The tool
-
getName
String getName()The name for this tool. Primarily used byToolExecBaseto create a default tool directory.- Returns:
- The name of this tool
-
getJavaVersion
int getJavaVersion()The Java version this tool was built with. Primarily used byToolExecBaseto determine theJavaLauncher.- Returns:
- The Java version
-
getMainClass
-
get
org.gradle.api.provider.Provider<File> get(org.gradle.api.provider.Provider<? extends org.gradle.api.file.Directory> cachesDir, org.gradle.api.provider.ProviderFactory providers) Gets this tool and returns a provider for the downloaded/cached file.- Parameters:
cachesDir- The caches directory to store the downloaded tool inproviders- The provider factory for creating the provider- Returns:
- The provider to the tool file
-
get
default org.gradle.api.provider.Provider<File> get(org.gradle.api.file.Directory cachesDir, org.gradle.api.provider.ProviderFactory providers) Gets this tool and returns a provider for the downloaded/cached file.- Parameters:
cachesDir- The caches directory to store the downloaded tool inproviders- The provider factory for creating the provider- Returns:
- The provider to the tool file
-