Class BaseNativeImageOptions

java.lang.Object
org.graalvm.buildtools.gradle.internal.BaseNativeImageOptions
All Implemented Interfaces:
NativeImageCompileOptions, NativeImageOptions, NativeImageRuntimeOptions, org.gradle.api.Named

public abstract class BaseNativeImageOptions extends Object implements NativeImageOptions
Class that declares native image options.
  • Constructor Details

    • BaseNativeImageOptions

      @Inject public BaseNativeImageOptions(String name, org.gradle.api.file.ProjectLayout layout, org.gradle.api.model.ObjectFactory objectFactory, org.gradle.api.provider.ProviderFactory providers, org.gradle.jvm.toolchain.JavaToolchainService toolchains, org.gradle.api.tasks.TaskContainer tasks, String defaultImageName)
  • Method Details

    • getName

      @Internal public String getName()
      Specified by:
      getName in interface org.gradle.api.Named
      Specified by:
      getName in interface NativeImageOptions
    • getImageName

      @Input public abstract org.gradle.api.provider.Property<String> getImageName()
      Gets the name of the native executable to be generated.
      Specified by:
      getImageName in interface NativeImageCompileOptions
      Returns:
      The image name property.
    • getMainClass

      @Input @Optional public abstract org.gradle.api.provider.Property<String> getMainClass()
      Returns the fully qualified name of the Main class to be executed.

      This does not need to be set if using an Executable Jar with a Main-Class attribute.

      Specified by:
      getMainClass in interface NativeImageCompileOptions
      Returns:
      mainClass The main class.
    • getBuildArgs

      @Input public abstract org.gradle.api.provider.ListProperty<String> getBuildArgs()
      Returns the arguments for the native-image invocation.
      Specified by:
      getBuildArgs in interface NativeImageCompileOptions
      Returns:
      Arguments for the native-image invocation.
    • getSystemProperties

      @Input public abstract org.gradle.api.provider.MapProperty<String,Object> getSystemProperties()
      Returns the system properties which will be used by the native-image builder process.
      Specified by:
      getSystemProperties in interface NativeImageCompileOptions
      Returns:
      The system properties. Returns an empty map when there are no system properties.
    • getEnvironmentVariables

      public abstract org.gradle.api.provider.MapProperty<String,Object> getEnvironmentVariables()
      Returns the environment variables which will be used by the native-image builder process.
      Specified by:
      getEnvironmentVariables in interface NativeImageCompileOptions
      Returns:
      the environment variables. Returns an empty map when there are no environment variables.
      Since:
      0.9.14
    • getClasspath

      @InputFiles @Classpath public abstract org.gradle.api.file.ConfigurableFileCollection getClasspath()
      Returns the classpath for the native-image building.
      Specified by:
      getClasspath in interface NativeImageCompileOptions
      Returns:
      classpath The classpath for the native-image building.
    • getJvmArgs

      @Input public abstract org.gradle.api.provider.ListProperty<String> getJvmArgs()
      Returns the extra arguments to use when launching the JVM for the native-image building process. Does not include system properties and the minimum/maximum heap size.
      Specified by:
      getJvmArgs in interface NativeImageCompileOptions
      Returns:
      The arguments. Returns an empty list if there are no arguments.
    • getRuntimeArgs

      @Input public abstract org.gradle.api.provider.ListProperty<String> getRuntimeArgs()
      Returns the arguments to use when launching the built image.
      Specified by:
      getRuntimeArgs in interface NativeImageRuntimeOptions
      Returns:
      The arguments. Returns an empty list if there are no arguments.
    • getDebug

      @Input public abstract org.gradle.api.provider.Property<Boolean> getDebug()
      Gets the value which toggles native-image debug symbol output.
      Specified by:
      getDebug in interface NativeImageCompileOptions
      Returns:
      Is debug enabled
    • getFallback

      @Input public abstract org.gradle.api.provider.Property<Boolean> getFallback()
      Specified by:
      getFallback in interface NativeImageCompileOptions
      Returns:
      Whether to enable fallbacks (defaults to false).
    • getVerbose

      @Input public abstract org.gradle.api.provider.Property<Boolean> getVerbose()
      Gets the value which toggles native-image verbose output.
      Specified by:
      getVerbose in interface NativeImageCompileOptions
      Returns:
      Is verbose output
    • getSharedLibrary

      @Input public abstract org.gradle.api.provider.Property<Boolean> getSharedLibrary()
      Gets the value which determines if shared library is being built.
      Specified by:
      getSharedLibrary in interface NativeImageCompileOptions
      Returns:
      The value which determines if shared library is being built.
    • getQuickBuild

      @Input public abstract org.gradle.api.provider.Property<Boolean> getQuickBuild()
      Gets the value which determines if image is being built in quick build mode.
      Specified by:
      getQuickBuild in interface NativeImageCompileOptions
      Returns:
      The value which determines if image is being built in quick build mode.
    • getRichOutput

      @Input public abstract org.gradle.api.provider.Property<Boolean> getRichOutput()
      Gets the value which determines if image is being built with rich output.
      Specified by:
      getRichOutput in interface NativeImageCompileOptions
      Returns:
      The value which determines if image is being built with rich output.
    • getJavaLauncher

      @Optional public abstract org.gradle.api.provider.Property<org.gradle.jvm.toolchain.JavaLauncher> getJavaLauncher()
      Returns the toolchain used to invoke native-image. Currently, pointing to a Java launcher due to Gradle limitations.
      Specified by:
      getJavaLauncher in interface NativeImageCompileOptions
      Returns:
      the detected java launcher
    • getConfigurationFileDirectories

      @InputFiles public abstract org.gradle.api.file.ConfigurableFileCollection getConfigurationFileDirectories()
      Returns the list of configuration file directories (e.g. resource-config.json, ...) which need to be passed to native-image.
      Specified by:
      getConfigurationFileDirectories in interface NativeImageCompileOptions
      Returns:
      a collection of directories
    • getExcludeConfig

      @Input public abstract org.gradle.api.provider.MapProperty<Object,List<String>> getExcludeConfig()
      Returns the MapProperty that contains information about configuration that should be excluded during image building. It consists of dependency coordinates and a list of regular expressions that match resources that should be excluded.
      Specified by:
      getExcludeConfig in interface NativeImageCompileOptions
      Returns:
      a map of filters for configuration exclusion
    • getResources

      public abstract NativeResourcesOptions getResources()
      Specified by:
      getResources in interface NativeImageCompileOptions
    • resources

      public void resources(org.gradle.api.Action<? super NativeResourcesOptions> spec)
      Specified by:
      resources in interface NativeImageOptions
    • buildArgs

      public BaseNativeImageOptions buildArgs(Object... buildArgs)
      Adds arguments for the native-image invocation.
      Specified by:
      buildArgs in interface NativeImageOptions
      Parameters:
      buildArgs - Arguments for the native-image invocation.
      Returns:
      this
    • buildArgs

      public BaseNativeImageOptions buildArgs(Iterable<?> buildArgs)
      Adds arguments for the native-image invocation.
      Specified by:
      buildArgs in interface NativeImageOptions
      Parameters:
      buildArgs - Arguments for the native-image invocation.
      Returns:
      this
    • systemProperties

      public BaseNativeImageOptions systemProperties(Map<String,?> properties)
      Adds some system properties to be used by the native-image builder process.
      Specified by:
      systemProperties in interface NativeImageOptions
      Parameters:
      properties - The system properties. Must not be null.
      Returns:
      this
    • systemProperty

      public BaseNativeImageOptions systemProperty(String name, Object value)
      Adds a system property to be used by the native-image builder process.
      Specified by:
      systemProperty in interface NativeImageOptions
      Parameters:
      name - The name of the property
      value - The value for the property. May be null.
      Returns:
      this
    • classpath

      public BaseNativeImageOptions classpath(Object... paths)
      Adds elements to the classpath for the native-image building.
      Specified by:
      classpath in interface NativeImageOptions
      Parameters:
      paths - The classpath elements.
      Returns:
      this
    • jvmArgs

      public BaseNativeImageOptions jvmArgs(Object... arguments)
      Adds some arguments to use when launching the JVM for the native-image building process.
      Specified by:
      jvmArgs in interface NativeImageOptions
      Parameters:
      arguments - The arguments.
      Returns:
      this
    • jvmArgs

      public BaseNativeImageOptions jvmArgs(Iterable<?> arguments)
      Adds some arguments to use when launching the JVM for the native-image building process.
      Specified by:
      jvmArgs in interface NativeImageOptions
      Parameters:
      arguments - The arguments. Must not be null.
      Returns:
      this
    • runtimeArgs

      public BaseNativeImageOptions runtimeArgs(Object... arguments)
      Adds some arguments to use when launching the built image.
      Specified by:
      runtimeArgs in interface NativeImageOptions
      Parameters:
      arguments - The arguments.
      Returns:
      this
    • runtimeArgs

      public BaseNativeImageOptions runtimeArgs(Iterable<?> arguments)
      Adds some arguments to use when launching the built image.
      Specified by:
      runtimeArgs in interface NativeImageOptions
      Parameters:
      arguments - The arguments. Must not be null.
      Returns:
      this
    • getAgent

      public abstract DeprecatedAgentOptions getAgent()
      Specified by:
      getAgent in interface NativeImageCompileOptions
    • agent

      public void agent(org.gradle.api.Action<? super DeprecatedAgentOptions> spec)
      Specified by:
      agent in interface NativeImageOptions
    • getLayers

      public org.gradle.api.DomainObjectSet<LayerOptions> getLayers()
      Specified by:
      getLayers in interface NativeImageCompileOptions
    • layers

      public void layers(org.gradle.api.Action<? super org.gradle.api.DomainObjectSet<LayerOptions>> spec)
      Specified by:
      layers in interface NativeImageCompileOptions
    • useLayer

      public void useLayer(String name)
      Specified by:
      useLayer in interface NativeImageCompileOptions
    • createLayer

      public void createLayer(org.gradle.api.Action<? super CreateLayerOptions> spec)
      Specified by:
      createLayer in interface NativeImageCompileOptions