Class JdkExtension
java.lang.Object
com.dua3.gradle.jdkprovider.plugin.JdkExtension
Extension for configuring the JDK selection.
-
Constructor Summary
ConstructorsConstructorDescriptionJdkExtension(org.gradle.api.model.ObjectFactory objects) Constructs a newJdkExtensioninstance with properties to configure JDK selection. -
Method Summary
Modifier and TypeMethodDescriptionorg.gradle.api.provider.Property<SystemArchitecture> getArch()Retrieves the system architecture configuration property.org.gradle.api.provider.Property<Boolean> Retrieves the property indicating whether automatic download of the JDK is enabled.org.gradle.api.provider.Property<Boolean> Retrieves the property indicating whether the JavaFX runtime is bundled with the JDK.org.gradle.api.provider.Provider<org.gradle.jvm.toolchain.JavaLauncher> getJavaLauncher(org.gradle.api.Project project) Retrieves a provider for the Java launcher associated with the specified project.org.gradle.api.provider.Provider<org.gradle.api.file.Directory> Read-only provider for the resolved JDK home directory.org.gradle.api.provider.Provider<JdkSpec> Read-only provider for the resolved JDK version specification.org.gradle.api.provider.Property<Boolean> Retrieves the property indicating whether the JDK is capable of building native images.org.gradle.api.provider.Property<OSFamily> getOs()Retrieves the property representing the operating system family.org.gradle.api.NamedDomainObjectContainer<JdkSpecOverride> Retrieves the container for JDK overrides.org.gradle.api.provider.Property<org.gradle.jvm.toolchain.JvmVendorSpec> Retrieves the property representing the vendor specification of the JVM.org.gradle.api.provider.Property<Object> Retrieves the version of the JDK configured for the extension.voidsetVersion(int version) Set the JDK version.voidsetVersion(String version) Set the JDK version.
-
Constructor Details
-
JdkExtension
@Inject public JdkExtension(org.gradle.api.model.ObjectFactory objects) Constructs a newJdkExtensioninstance with properties to configure JDK selection.- Parameters:
objects- anObjectFactoryused to create and initialize properties for the JDK configuration, such as operating system, system architecture, version, vendor, and boolean flags for specific capabilities.
-
-
Method Details
-
getOs
Retrieves the property representing the operating system family.- Returns:
- a
Property<OSFamily>that holds the operating system family configuration.
-
getArch
Retrieves the system architecture configuration property.- Returns:
- a
Propertyrepresenting the system architecture, which indicates the type of system architecture (e.g., AARCH32, AARCH64, X64, X86_32).
-
getVersion
Retrieves the version of the JDK configured for the extension.- Returns:
- a
Propertycontaining the version.
-
setVersion
public void setVersion(int version) Set the JDK version.This is a convenience method that allows setting the version using an
intargument.- Parameters:
version- the JDK version to set
-
setVersion
Set the JDK version.- Parameters:
version- the JDK version to set
-
getVendor
public org.gradle.api.provider.Property<org.gradle.jvm.toolchain.JvmVendorSpec> getVendor()Retrieves the property representing the vendor specification of the JVM.- Returns:
- a property instance containing the JVM vendor specification.
-
getNativeImageCapable
Retrieves the property indicating whether the JDK is capable of building native images.- Returns:
- a
Property<Boolean>representing whether native image capability is supported.
-
getJavaFxBundled
Retrieves the property indicating whether the JavaFX runtime is bundled with the JDK.- Returns:
- a
Property<Boolean>representing whether the JDK includes JavaFX.
-
getAutomaticDownload
Retrieves the property indicating whether automatic download of the JDK is enabled.- Returns:
- a
Propertycontaining a Boolean value that specifies if automatic downloading is enabled.
-
getOverrides
Retrieves the container for JDK overrides.- Returns:
- a
NamedDomainObjectContainerforJdkSpecOverrideinstances.
-
getJdkHome
public org.gradle.api.provider.Provider<org.gradle.api.file.Directory> getJdkHome()Read-only provider for the resolved JDK home directory.- Returns:
- a
Provider<Directory>representing the resolved JDK home directory
-
getJdkSpec
Read-only provider for the resolved JDK version specification.- Returns:
- a
Provider<JdkSpec>representing the resolved JDK specification
-
getJavaLauncher
public org.gradle.api.provider.Provider<org.gradle.jvm.toolchain.JavaLauncher> getJavaLauncher(org.gradle.api.Project project) Retrieves a provider for the Java launcher associated with the specified project. The Java launcher provides access to metadata about a specific JDK installation and the path to the Java executable.- Parameters:
project- the project for which the Java launcher is being retrieved; used to resolve paths and providers within the project scope- Returns:
- a
Provider<JavaLauncher>that supplies the Java launcher, which includes JDK metadata and the executable path
-