Class JdkExtension

java.lang.Object
com.dua3.gradle.jdkprovider.plugin.JdkExtension

public abstract class JdkExtension extends Object
Extension for configuring the JDK selection.
  • Constructor Summary

    Constructors
    Constructor
    Description
    JdkExtension(org.gradle.api.model.ObjectFactory objects)
    Constructs a new JdkExtension instance with properties to configure JDK selection.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.gradle.api.provider.Property<SystemArchitecture>
    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>
    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.
    void
    setVersion(int version)
    Set the JDK version.
    void
    setVersion(String version)
    Set the JDK version.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JdkExtension

      @Inject public JdkExtension(org.gradle.api.model.ObjectFactory objects)
      Constructs a new JdkExtension instance with properties to configure JDK selection.
      Parameters:
      objects - an ObjectFactory used 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

      public org.gradle.api.provider.Property<OSFamily> getOs()
      Retrieves the property representing the operating system family.
      Returns:
      a Property<OSFamily> that holds the operating system family configuration.
    • getArch

      public org.gradle.api.provider.Property<SystemArchitecture> getArch()
      Retrieves the system architecture configuration property.
      Returns:
      a Property representing the system architecture, which indicates the type of system architecture (e.g., AARCH32, AARCH64, X64, X86_32).
    • getVersion

      public org.gradle.api.provider.Property<Object> getVersion()
      Retrieves the version of the JDK configured for the extension.
      Returns:
      a Property containing the version.
    • setVersion

      public void setVersion(int version)
      Set the JDK version.

      This is a convenience method that allows setting the version using an int argument.

      Parameters:
      version - the JDK version to set
    • setVersion

      public void setVersion(String version)
      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

      public org.gradle.api.provider.Property<Boolean> 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

      public org.gradle.api.provider.Property<Boolean> 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

      public org.gradle.api.provider.Property<Boolean> getAutomaticDownload()
      Retrieves the property indicating whether automatic download of the JDK is enabled.
      Returns:
      a Property containing a Boolean value that specifies if automatic downloading is enabled.
    • getOverrides

      public org.gradle.api.NamedDomainObjectContainer<JdkSpecOverride> getOverrides()
      Retrieves the container for JDK overrides.
      Returns:
      a NamedDomainObjectContainer for JdkSpecOverride instances.
    • 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

      public org.gradle.api.provider.Provider<JdkSpec> 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