Interface KotlinProject

All Superinterfaces:
FileProject, JavaProject, Project

public interface KotlinProject extends JavaProject
Extends JavaProject with functionality for building Kotlin applications and libraries.

Utility methods are provided for

  • Method Details

    • kotlin

      default void kotlin(String... args)
      Runs a Kotlin program.
      Parameters:
      args - arguments to be supplied to the Kotlin runtime
      See Also:
    • kotlinc

      default Fileset kotlinc(String path, Fileset sources, String... args)
      Compiles Kotlin code.
      Parameters:
      path - the directory path for class files, relative to FileProject.buildPath()
      sources - the source files to compile
      args - the command-line options to be passed to the kotlinc compiler
      Returns:
      a reference to the compiled .class files
      See Also:
    • kotlincJar

      default File kotlincJar(String jarPath, Fileset sources, String... args)
      Compiles Kotlin code directly to a self-contained .jar archive, bundling the Kotlin runtime with -include-runtime.
      Parameters:
      jarPath - the location and name of the generated archive, relative to FileProject.buildPath()
      sources - the source files to compile
      args - additional command-line options to be passed to the kotlinc compiler
      Returns:
      a reference to the generated archive
      See Also:
    • kotlincJava

      default Fileset kotlincJava(String path, Fileset kotlinSources, Fileset javaSources, String... args)
      Compiles mixed Kotlin and Java sources.

      Mixed compilation requires two passes: kotlinc compiles Kotlin sources first with the Java sources provided as context, then javac compiles the Java sources against the Kotlin output. Getting this order wrong produces broken output.

      Parameters:
      path - the directory path for class files, relative to FileProject.buildPath()
      kotlinSources - the Kotlin source files to compile
      javaSources - the Java source files to compile
      args - the command-line options to be passed to both compilers
      Returns:
      a reference to all compiled .class files
      See Also:
    • dokka

      default Fileset dokka(String destination, String... args)
      Generates Dokka documentation for Kotlin (and Java) sources.
      Parameters:
      destination - the path of the generated documentation, relative to FileProject.buildPath()
      args - the command-line arguments for the Dokka CLI
      Returns:
      a reference to the generated documentation
      See Also: