Class CompileOptions

java.lang.Object
rife.bld.extension.kotlin.CompileOptions

public class CompileOptions extends Object
Configuration for the Kotlin compiler options.
Since:
1.0
Author:
Erik C. Thauvin
  • Constructor Details

    • CompileOptions

      public CompileOptions()
  • Method Details

    • advancedOptions

      public CompileOptions advancedOptions(String... options)
      Specify advanced compiler options.
      Parameters:
      options - one or more advanced options
      Returns:
      this operation instance
    • advancedOptions

      public CompileOptions advancedOptions(Collection<String> options)
      Specify advanced compiler options.
      Parameters:
      options - the compiler options
      Returns:
      this operation instance
    • advancedOptions

      public Collection<String> advancedOptions()
      Retrieves advanced compiler options.
      Returns:
      the advanced compiler options
    • apiVersion

      public String apiVersion()
      Retrieves the version of Kotlin bundled libraries.
      Returns:
      the API version
    • apiVersion

      public CompileOptions apiVersion(String version)
      Allow using declarations only from the specified version of Kotlin bundled libraries.
      Parameters:
      version - the API version
      Returns:
      this operation instance
    • apiVersion

      public CompileOptions apiVersion(int version)
      Allow using declarations only from the specified version of Kotlin bundled libraries.
      Parameters:
      version - the API version
      Returns:
      this operation instance
    • argFile

      public CompileOptions argFile(String... files)
      Read the compiler options from the given files.

      Such a file can contain compiler options with values and paths to the source files. Options and paths should be separated by whitespaces. For example:

      • -include-runtime -d hello.jar hello.kt
      To pass values that contain whitespaces, surround them with single (') or double (") quotes. If a value contains quotation marks in it, escape them with a backslash (\).
      • -include-runtime -d 'My folder'
      If the files reside in locations different from the current directory, use relative paths.
      Parameters:
      files - one or more files
      Returns:
      this operation instance
      See Also:
    • argFile

      public CompileOptions argFile(Collection<File> files)
      Read the compiler options from the given files.
      Parameters:
      files - the compiler options files
      Returns:
      this operation instance
      See Also:
    • argFile

      public CompileOptions argFile(File... files)
      Read the compiler options from the given files.

      Such a file can contain compiler options with values and paths to the source files. Options and paths should be separated by whitespaces. For example:

      • -include-runtime -d hello.jar hello.kt
      To pass values that contain whitespaces, surround them with single (') or double (") quotes. If a value contains quotation marks in it, escape them with a backslash (\).
      • -include-runtime -d 'My folder'
      If the files reside in locations different from the current directory, use relative paths.
      Parameters:
      files - one or more files
      Returns:
      this operation instance
      See Also:
    • argFile

      public CompileOptions argFile(Path... files)
      Read the compiler options from the given files.

      Such a file can contain compiler options with values and paths to the source files. Options and paths should be separated by whitespaces. For example:

      • -include-runtime -d hello.jar hello.kt
      To pass values that contain whitespaces, surround them with single (') or double (") quotes. If a value contains quotation marks in it, escape them with a backslash (\).
      • -include-runtime -d 'My folder'
      If the files reside in locations different from the current directory, use relative paths.
      Parameters:
      files - one or more files
      Returns:
      this operation instance
      See Also:
    • argFile

      public Collection<File> argFile()
      Retrieves the files containing compiler options.
      Returns:
      the compiler options files
    • argFilePaths

      public CompileOptions argFilePaths(Collection<Path> files)
      Read the compiler options from the given files.
      Parameters:
      files - the compiler options files
      Returns:
      this operation instance
      See Also:
    • argFileStrings

      public CompileOptions argFileStrings(Collection<String> files)
      Read the compiler options from the given files.
      Parameters:
      files - the compiler options files
      Returns:
      this operation instance
      See Also:
    • args

      public List<String> args()
      Returns the formatted arguments.
      Returns:
      the arguments
    • classpath

      public CompileOptions classpath(String... paths)
      Search for class files in the specified paths.

      The classpath can contain file and directory paths, ZIP, or JAR files.

      Parameters:
      paths - one pr more paths
      Returns:
      this operation instance
      See Also:
    • classpath

      public CompileOptions classpath(File... paths)
      Search for class files in the specified paths.

      The classpath can contain file and directory paths, ZIP, or JAR files.

      Parameters:
      paths - one or more path
      Returns:
      this operation instance
      See Also:
    • classpath

      public CompileOptions classpath(Path... paths)
      Search for class files in the specified paths.

      The classpath can contain file and directory paths, ZIP, or JAR files.

      Parameters:
      paths - one or more path
      Returns:
      this operation instance
      See Also:
    • classpath

      public CompileOptions classpath(Collection<File> paths)
      Search for class files in the specified paths.

      The classpath can contain file and directory paths, ZIP, or JAR files.

      Parameters:
      paths - the search paths
      Returns:
      this operation instance
      See Also:
    • classpath

      public Collection<File> classpath()
      Retrieves the class files classpath.
      Returns:
      the class files classpath
    • classpathPaths

      public CompileOptions classpathPaths(Collection<Path> paths)
      Search for class files in the specified paths.

      The classpath can contain file and directory paths, ZIP, or JAR files.

      Parameters:
      paths - one pr more paths
      Returns:
      this operation instance
      See Also:
    • classpathStrings

      public CompileOptions classpathStrings(Collection<String> paths)
      Search for class files in the specified paths.

      The classpath can contain file and directory paths, ZIP, or JAR files.

      Parameters:
      paths - one pr more paths
      Returns:
      this operation instance
      See Also:
    • expression

      public String expression()
      Retrieves the string to evaluate as a Kotlin script.
      Returns:
      the expression
    • expression

      public CompileOptions expression(String expression)
      Evaluate the given string as a Kotlin script.
      Parameters:
      expression - the expression
      Returns:
      this operation instance
    • hasRelease

      public boolean hasRelease()
      Indicates whether the jdkRelease was set.
      Returns:
      true if the release was set; or false otherwise
    • includeRuntime

      public CompileOptions includeRuntime(boolean includeRuntime)
      Include the Kotlin runtime into the resulting JAR file. Makes the resulting archive runnable on any Java-enabled environment.
      Parameters:
      includeRuntime - true or false
      Returns:
      this operation instance
    • isIncludeRuntime

      public boolean isIncludeRuntime()
      Indicates whether the includeRuntime(boolean) was set.
      Returns:
      true or false
    • isJavaParameters

      public boolean isJavaParameters()
      Indicates whether javaParameters(boolean) was set.
      Returns:
      true or false
    • isNoJdk

      public boolean isNoJdk()
      Indicates whether noJdk was set.
      Returns:
      true or false
    • isNoReflect

      public boolean isNoReflect()
      Indicates whether noRflect was set.
      Returns:
      true or false
    • isNoStdLib

      public boolean isNoStdLib()
      Indicates whether noStdLib +was set.
      Returns:
      true or false
    • isNoWarn

      public boolean isNoWarn()
      Indicates whether noWarn was set.
      Returns:
      true or false
    • isProgressive

      public boolean isProgressive()
      Indicates whether progressive was set.
      Returns:
      true or false
    • isVerbose

      public boolean isVerbose()
      Indicates whether verbose(boolean) was set.
      Returns:
      true if verbose was set; or false otherwise
    • isWError

      public boolean isWError()
      Indicates whether warnings are turned into a compilation error.
      Returns:
      true or false
    • isWExtra

      public boolean isWExtra()
      Indicates whether additional declaration, expression, and type compiler checks emit warnings.
      Returns:
      true or false
    • javaParameters

      public CompileOptions javaParameters(boolean javaParameters)
      Generate metadata for Java 1.8 reflection on method parameters.
      Parameters:
      javaParameters - true or false
      Returns:
      this operation instance
    • jdkHome

      public CompileOptions jdkHome(File jdkHome)
      Use a custom JDK home directory to include into the classpath if it differs from the default JAVA_HOME.
      Parameters:
      jdkHome - the JDK home path
      Returns:
      this operation instance
    • jdkHome

      public CompileOptions jdkHome(String jdkHome)
      Use a custom JDK home directory to include into the classpath if it differs from the default JAVA_HOME.
      Parameters:
      jdkHome - the JDK home path
      Returns:
      this operation instance
    • jdkHome

      public CompileOptions jdkHome(Path jdkHome)
      Use a custom JDK home directory to include into the classpath if it differs from the default JAVA_HOME.
      Parameters:
      jdkHome - the JDK home path
      Returns:
      this operation instance
    • jdkHome

      public File jdkHome()
      Retrieves the custom JDK home directory.
      Returns:
      the JDK home path.
    • jdkRelease

      public String jdkRelease()
      Return the specified JDK API version.
      Returns:
      the API version
    • jdkRelease

      public CompileOptions jdkRelease(String version)
      Compile against the specified JDK API version.

      Limit the API of the JDK in the classpath to the specified Java version. Automatically sets JVM target version.

      Possible values are 1.8, 9, 10, ..., 22. The default value is 1.8.

      Parameters:
      version - the target version
      Returns:
      this operation instance
    • jdkRelease

      public CompileOptions jdkRelease(int version)
      Compile against the specified JDK API version.

      Limit the API of the JDK in the classpath to the specified Java version. Automatically sets JVM target version.

      Possible values are 1.8, 9, 10, ..., 22. The default value is 1.8.

      Parameters:
      version - the target version
      Returns:
      this operation instance
      See Also:
    • jvmOptions

      public Collection<String> jvmOptions()
      Retrieves the Java Virtual Machine options.
      Returns:
      the JVM options
    • jvmOptions

      public CompileOptions jvmOptions(Collection<String> jvmOptions)
      Pass an option directly to Java Virtual Machine
      Parameters:
      jvmOptions - the JVM options
      Returns:
      this operation instance
    • jvmOptions

      public CompileOptions jvmOptions(String... jvmOptions)
      Pass an option directly to JVM
      Parameters:
      jvmOptions - one or more JVM option
      Returns:
      this operation instance
    • jvmTarget

      public CompileOptions jvmTarget(int target)
      Specify the target version of the generated JVM bytecode.
      Parameters:
      target - the target version
      Returns:
      this operation instance
      See Also:
    • jvmTarget

      public CompileOptions jvmTarget(String target)
      Specify the target version of the generated JVM bytecode.

      Possible values are 1.8, 9, 10, ..., 22. The default value is 1.8.

      Parameters:
      target - the target version
      Returns:
      this operation instance
    • jvmTarget

      public String jvmTarget()
      Retrieves the target version of the generated JVM bytecode.
      Returns:
      the target version
    • kotlinHome

      public CompileOptions kotlinHome(File path)
      Specify a custom path to the Kotlin compiler used for the discovery of runtime libraries.
      Parameters:
      path - the Kotlin home path
      Returns:
      this operation instance
    • kotlinHome

      public File kotlinHome()
      Retrieves the custom path of the Kotlin compiler.
      Returns:
      the Kotlin home path
    • kotlinHome

      public CompileOptions kotlinHome(Path path)
      Specify a custom path to the Kotlin compiler used for the discovery of runtime libraries.
      Parameters:
      path - the Kotlin home path
      Returns:
      this operation instance
    • kotlinHome

      public CompileOptions kotlinHome(String path)
      Specify a custom path to the Kotlin compiler used for the discovery of runtime libraries.
      Parameters:
      path - the Kotlin home path
      Returns:
      this operation instance
    • languageVersion

      public CompileOptions languageVersion(String version)
      Provide source compatibility with the specified version of Kotlin.
      Parameters:
      version - the language version
      Returns:
      this operation instance
    • languageVersion

      public String languageVersion()
      Retrieves the language version.
      Returns:
      the language version
    • moduleName

      public CompileOptions moduleName(String name)
      Set a custom name for the generated .kotlin_module file.
      Parameters:
      name - the module name
      Returns:
      this operation instance
    • moduleName

      public String moduleName()
      Retrieves the module name.
      Returns:
      the module name
    • noJdk

      public CompileOptions noJdk(boolean noJdk)
      Don't automatically include the Java runtime into the classpath.
      Parameters:
      noJdk - true or false
      Returns:
      this operation instance
    • noReflect

      public CompileOptions noReflect(boolean noReflect)
      Don't automatically include the Kotlin reflection (kotlin-reflect.jar) into the classpath.
      Parameters:
      noReflect - true or false
      Returns:
      this operation instance
    • noStdLib

      public CompileOptions noStdLib(boolean noStdLib)
      Don't automatically include the Kotlin/JVM stdlib (kotlin-stdlib.jar) and Kotlin reflection (kotlin-reflect.jar) into the classpath.
      Parameters:
      noStdLib - true or false
      Returns:
      this operation instance
    • noWarn

      public CompileOptions noWarn(boolean noWarn)
      Suppress the compiler from displaying warnings during compilation.
      Parameters:
      noWarn - true or false
      Returns:
      this operation instance
    • optIn

      public CompileOptions optIn(String... annotations)
      Enable usages of API that requires opt-in with a requirement annotation with the given fully qualified name.
      Parameters:
      annotations - one or more annotation names
      Returns:
      this operation instance
    • optIn

      public Collection<String> optIn()
      Retrieves the opt-in fully qualified names.
      Returns:
      the fully qualified names
    • optIn

      public CompileOptions optIn(Collection<String> annotations)
      Enable usages of API that requires opt-in with a requirement annotation with the given fully qualified name.
      Parameters:
      annotations - the annotation names
      Returns:
      this operation instance
    • options

      public CompileOptions options(String... options)
      Specify additional compiler options.
      Parameters:
      options - one or more compiler options
      Returns:
      this operation instance
    • options

      public Collection<String> options()
      Retrieves additional compiler options.
      Returns:
      the compiler options
    • options

      public CompileOptions options(Collection<String> options)
      Specify additional compiler options.
      Parameters:
      options - the compiler options
      Returns:
      this operation instance
    • path

      public CompileOptions path(File path)
      Place the generated class files into the specified location.

      The location can be a directory, a ZIP, or a JAR file.

      Parameters:
      path - the location path
      Returns:
      this operation instance
    • path

      public File path()
      Retrieves the location to place generated class files into.
      Returns:
      the location path.
    • path

      public CompileOptions path(Path path)
      Place the generated class files into the specified location.

      The location can be a directory, a ZIP, or a JAR file.

      Parameters:
      path - the location path
      Returns:
      this operation instance
    • path

      public CompileOptions path(String path)
      Place the generated class files into the specified location.

      The location can be a directory, a ZIP, or a JAR file.

      Parameters:
      path - the location path
      Returns:
      this operation instance
    • plugin

      public CompileOptions plugin(String id, String optionName, String value)
      Pass an option to a plugin.
      Parameters:
      id - the plugin ID
      optionName - the plugin option name
      value - the plugin option value
      Returns:
      this operation instance
    • plugin

      public Collection<String> plugin()
      Retrieves the plugin options.
      Returns:
      the plugin options.
    • progressive

      public CompileOptions progressive(boolean progressive)
      Allow using declarations only from the specified version of Kotlin bundled libraries.
      Parameters:
      progressive - true or false
      Returns:
      this operation instance
    • scriptTemplates

      public CompileOptions scriptTemplates(String... classNames)
      Script definition template classes.

      Use fully qualified class names.

      Parameters:
      classNames - one or more class names
      Returns:
      this operation instance
    • scriptTemplates

      public Collection<String> scriptTemplates()
      Retrieves the script templates.
      Returns:
      the script templates.
    • scriptTemplates

      public CompileOptions scriptTemplates(Collection<String> classNames)
      Script definition template classes.

      Use fully qualified class names.

      Parameters:
      classNames - the class names
      Returns:
      this operation instance
    • verbose

      public CompileOptions verbose(boolean verbose)
      Enable verbose logging output which includes details of the compilation process.
      Parameters:
      verbose - true or false
      Returns:
      this operation instance
    • wError

      public CompileOptions wError(boolean wError)
      Turn any warnings into a compilation error.
      Parameters:
      wError - true or false
      Returns:
      this operation instance
    • wExtra

      public CompileOptions wExtra(boolean wExtra)
      Enable additional declaration, expression, and type compiler checks that emit warnings if true.
      Parameters:
      wExtra - true or false
      Returns:
      this operation instance