Class CompileKotlinOperation


public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOperation>
Compiles main and test Kotlin sources in the relevant build directories.
Since:
1.0
Author:
Erik C. Thauvin
  • Constructor Details

    • CompileKotlinOperation

      public CompileKotlinOperation()
  • Method Details

    • isNotBlank

      public static boolean isNotBlank(String s)
      Determines if the given string is not blank.
      Parameters:
      s - the string
      Returns:
      true if not blank, false otherwise.
    • buildMainDirectory

      public CompileKotlinOperation buildMainDirectory(Path directory)
      Provides the main build destination directory.
      Parameters:
      directory - the directory to use for the main build destination
      Returns:
      this operation instance
    • buildMainDirectory

      public CompileKotlinOperation buildMainDirectory(File directory)
      Provides the main build destination directory.
      Parameters:
      directory - the directory to use for the main build destination
      Returns:
      this operation instance
    • buildMainDirectory

      public CompileKotlinOperation buildMainDirectory(String directory)
      Provides the main build destination directory.
      Parameters:
      directory - the directory to use for the main build destination
      Returns:
      this operation instance
    • buildMainDirectory

      public File buildMainDirectory()
      Retrieves the main build destination directory.
      Returns:
      the main build directory
    • buildTestDirectory

      public CompileKotlinOperation buildTestDirectory(File directory)
      Provides the test build destination directory.
      Parameters:
      directory - the directory to use for the test build destination
      Returns:
      this operation instance
    • buildTestDirectory

      public CompileKotlinOperation buildTestDirectory(Path directory)
      Provides the test build destination directory.
      Parameters:
      directory - the directory to use for the test build destination
      Returns:
      this operation instance
    • buildTestDirectory

      public CompileKotlinOperation buildTestDirectory(String directory)
      Provides the test build destination directory.
      Parameters:
      directory - the directory to use for the test build destination
      Returns:
      this operation instance
    • buildTestDirectory

      public File buildTestDirectory()
      Retrieves the test build destination directory.
      Returns:
      the test build directory
    • compileMainClasspath

      public CompileKotlinOperation compileMainClasspath(String... classpath)
      Provides entries for the main compilation classpath.
      Parameters:
      classpath - one or more classpath entries
      Returns:
      this operation instance
      See Also:
    • compileMainClasspath

      public CompileKotlinOperation compileMainClasspath(Collection<String> classpath)
      Provides the entries for the main compilation classpath.
      Parameters:
      classpath - the classpath entries
      Returns:
      this operation instance
    • compileMainClasspath

      public Collection<String> compileMainClasspath()
      Retrieves the entries for the main compilation classpath.
      Returns:
      the classpath entries
    • compileOptions

      public CompileOptions compileOptions()
      Retrieves the compilation options for the compiler.
      Returns:
      the compilation options
    • compileOptions

      public CompileKotlinOperation compileOptions(CompileOptions options)
      Provides the compilation options to pass to the Kotlin compiler.
      Parameters:
      options - the compiler options
      Returns:
      this operation instance
    • compileTestClasspath

      public CompileKotlinOperation compileTestClasspath(String... classpath)
      Provides entries for the test compilation classpath.
      Parameters:
      classpath - one or more classpath entries
      Returns:
      this operation instance
    • compileTestClasspath

      public CompileKotlinOperation compileTestClasspath(Collection<String> classpath)
      Provides the entries for the test compilation classpath.
      Parameters:
      classpath - the classpath entries
      Returns:
      this operation instance
    • compileTestClasspath

      public Collection<String> compileTestClasspath()
      Retrieves the entries for the test compilation classpath.
      Returns:
      the classpath entries
    • execute

      public void execute() throws Exception
      Performs the compile operation.
      Specified by:
      execute in class AbstractOperation<CompileKotlinOperation>
      Throws:
      Exception
    • executeBuildMainSources

      protected void executeBuildMainSources() throws ExitStatusException
      Part of the execute operation, builds the main sources.
      Throws:
      ExitStatusException - if an error occurs
    • executeBuildSources

      protected void executeBuildSources(Collection<String> classpath, Collection<File> sources, File destination, File friendPaths) throws ExitStatusException
      Part of the execute operation, build sources to a given destination.
      Parameters:
      classpath - the classpath list used for the compilation
      sources - the source files to compile
      destination - the destination directory
      friendPaths - the output directory for friendly modules
      Throws:
      ExitStatusException - if an error occurs
    • executeBuildTestSources

      protected void executeBuildTestSources() throws ExitStatusException
      Part of the execute operation, builds the test sources.
      Throws:
      ExitStatusException - if an error occurs
    • executeCreateBuildDirectories

      protected void executeCreateBuildDirectories() throws IOException
      Part of the execute operation, creates the build directories.
      Throws:
      IOException - if an error occurs
    • fromProject

      public CompileKotlinOperation fromProject(BaseProject project)
      Configures a compile operation from a BaseProject.

      Sets the following from the project:

      Parameters:
      project - the project to configure the compile operation from
      Returns:
      this operation instance
    • kotlinHome

      public CompileKotlinOperation kotlinHome(File dir)
      Provides the Kotlin home directory, if it differs from the default KOTLIN_HOME.
      Parameters:
      dir - the directory
      Returns:
      this operation instance
    • kotlinHome

      public CompileKotlinOperation kotlinHome(String dir)
      Provides the Kotlin home directory, if it differs from the default KOTLIN_HOME.
      Parameters:
      dir - the directory path
      Returns:
      this operation instance
    • kotlinHome

      public CompileKotlinOperation kotlinHome(Path dir)
      Provides the Kotlin home directory, if it differs from the default KOTLIN_HOME.
      Parameters:
      dir - the directory path
      Returns:
      this operation instance
    • kotlinHome

      public File kotlinHome()
      Retrieves the Kotlin home directory.
      Returns:
      the directory
    • kotlinc

      public File kotlinc()
      Retrieves the path to the Kotlin compiler (kotlinc) executable, if not in kotlinHome().
      Returns:
      the executable path
    • kotlinc

      public CompileKotlinOperation kotlinc(File executable)
      Provides the path to the Kotlin compiler (kotlinc) executable, if not in kotlinHome().
      Parameters:
      executable - the executable path
      Returns:
      this operation instance
    • kotlinc

      public CompileKotlinOperation kotlinc(String executable)
      Provides the path to the Kotlin compiler (kotlinc) executable, if not in kotlinHome().
      Parameters:
      executable - the executable path
      Returns:
      this operation instance
    • kotlinc

      public CompileKotlinOperation kotlinc(Path executable)
      Provides the path to the Kotlin compiler (kotlinc) executable, if not in kotlinHome().
      Parameters:
      executable - the executable path
      Returns:
      this operation instance
    • mainSourceDirectories

      public CompileKotlinOperation mainSourceDirectories(File... directories)
      Provides main source directories that should be compiled.
      Parameters:
      directories - one or more main source directories
      Returns:
      this operation instance
      See Also:
    • mainSourceDirectories

      public CompileKotlinOperation mainSourceDirectories(Path... directories)
      Provides main source directories that should be compiled.
      Parameters:
      directories - one or more main source directories
      Returns:
      this operation instance
      See Also:
    • mainSourceDirectories

      public CompileKotlinOperation mainSourceDirectories(String... directories)
      Provides main source directories that should be compiled.
      Parameters:
      directories - one or more main source directories
      Returns:
      this operation instance
      See Also:
    • mainSourceDirectories

      public CompileKotlinOperation mainSourceDirectories(Collection<File> directories)
      Provides the main source directories that should be compiled.
      Parameters:
      directories - the main source directories
      Returns:
      this operation instance
      See Also:
    • mainSourceDirectories

      public Collection<File> mainSourceDirectories()
      Retrieves the main source directories that should be compiled.
      Returns:
      the main source directories
    • mainSourceDirectoriesPaths

      public CompileKotlinOperation mainSourceDirectoriesPaths(Collection<Path> directories)
      Provides the main source directories that should be compiled.
      Parameters:
      directories - the main source directories
      Returns:
      this operation instance
      See Also:
    • mainSourceDirectoriesStrings

      public CompileKotlinOperation mainSourceDirectoriesStrings(Collection<String> directories)
      Provides the main source directories that should be compiled.
      Parameters:
      directories - the main source directories
      Returns:
      this operation instance
      See Also:
    • mainSourceFiles

      public CompileKotlinOperation mainSourceFiles(File... files)
      Provides main source files that should be compiled.
      Parameters:
      files - one or more main source files
      Returns:
      this operation instance
      See Also:
    • mainSourceFiles

      public CompileKotlinOperation mainSourceFiles(String... files)
      Provides main source files that should be compiled.
      Parameters:
      files - one or more main source files
      Returns:
      this operation instance
      See Also:
    • mainSourceFiles

      public CompileKotlinOperation mainSourceFiles(Path... files)
      Provides main source files that should be compiled.
      Parameters:
      files - one or more main source files
      Returns:
      this operation instance
      See Also:
    • mainSourceFiles

      public CompileKotlinOperation mainSourceFiles(Collection<File> files)
      Provides the main source files that should be compiled.
      Parameters:
      files - the main source files
      Returns:
      this operation instance
      See Also:
    • mainSourceFiles

      public Collection<File> mainSourceFiles()
      Retrieves the main files that should be compiled.
      Returns:
      the files
    • mainSourceFilesPaths

      public CompileKotlinOperation mainSourceFilesPaths(Collection<Path> files)
      Provides the main source files that should be compiled.
      Parameters:
      files - the main source files
      Returns:
      this operation instance
      See Also:
    • mainSourceFilesStrings

      public CompileKotlinOperation mainSourceFilesStrings(Collection<String> files)
      Provides the main source files that should be compiled.
      Parameters:
      files - the main source files
      Returns:
      this operation instance
      See Also:
    • plugins

      public CompileKotlinOperation plugins(String directory, CompilerPlugin... plugins)
      Provides compiler plugins.
      Parameters:
      directory - the directory containing the plugin JARs
      plugins - one or more plugins
      Returns:
      this class instance
    • plugins

      public CompileKotlinOperation plugins(String... plugins)
      Provides compiler plugins.
      Parameters:
      plugins - one or more plugins
      Returns:
      this class instance
    • plugins

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

      public CompileKotlinOperation plugins(Collection<String> plugins)
      Provides compiler plugins.
      Parameters:
      plugins - the compiler plugins
      Returns:
      this class instance
    • plugins

      public CompileKotlinOperation plugins(File directory, CompilerPlugin... plugins)
      Provides compiler plugins.
      Parameters:
      directory - the directory containing the plugin JARs
      plugins - one or more plugins
      Returns:
      this class instance
    • plugins

      public CompileKotlinOperation plugins(Path directory, CompilerPlugin... plugins)
      Provides compiler plugins.
      Parameters:
      directory - the directory containing the plugin JARs
      plugins - one or more plugins
      Returns:
      this class instance
    • plugins

      public CompileKotlinOperation plugins(CompilerPlugin... plugins)
      Provides compiler plugins located in the kotlinHome() lib directory.
      Parameters:
      plugins - one or more plugins
      Returns:
      this class instance
      See Also:
    • testSourceDirectories

      public CompileKotlinOperation testSourceDirectories(File... directories)
      Provides test source directories that should be compiled.
      Parameters:
      directories - one or more test source directories
      Returns:
      this operation instance
      See Also:
    • testSourceDirectories

      public CompileKotlinOperation testSourceDirectories(Path... directories)
      Provides test source directories that should be compiled.
      Parameters:
      directories - one or more test source directories
      Returns:
      this operation instance
      See Also:
    • testSourceDirectories

      public CompileKotlinOperation testSourceDirectories(String... directories)
      Provides test source directories that should be compiled.
      Parameters:
      directories - one or more test source directories
      Returns:
      this operation instance
      See Also:
    • testSourceDirectories

      public CompileKotlinOperation testSourceDirectories(Collection<File> directories)
      Provides the test source directories that should be compiled.
      Parameters:
      directories - the test source directories
      Returns:
      this operation instance
      See Also:
    • testSourceDirectories

      public Collection<File> testSourceDirectories()
      Retrieves the test source directories that should be compiled.
      Returns:
      the test source directories
    • testSourceDirectoriesPaths

      public CompileKotlinOperation testSourceDirectoriesPaths(Collection<Path> directories)
      Provides the test source directories that should be compiled.
      Parameters:
      directories - the test source directories
      Returns:
      this operation instance
      See Also:
    • testSourceDirectoriesStrings

      public CompileKotlinOperation testSourceDirectoriesStrings(Collection<String> directories)
      Provides the test source directories that should be compiled.
      Parameters:
      directories - the test source directories
      Returns:
      this operation instance
      See Also:
    • testSourceFiles

      public CompileKotlinOperation testSourceFiles(File... files)
      Provides test source files that should be compiled.
      Parameters:
      files - one or more test source files
      Returns:
      this operation instance
      See Also:
    • testSourceFiles

      public CompileKotlinOperation testSourceFiles(String... files)
      Provides the test sources files that should be compiled.
      Parameters:
      files - one or more test source files
      Returns:
      this operation instance
      See Also:
    • testSourceFiles

      public CompileKotlinOperation testSourceFiles(Path... files)
      Provides the test sources files that should be compiled.
      Parameters:
      files - one or more test source files
      Returns:
      this operation instance
      See Also:
    • testSourceFiles

      public CompileKotlinOperation testSourceFiles(Collection<File> files)
      Provides the test source files that should be compiled.
      Parameters:
      files - the test source files
      Returns:
      this operation instance
      See Also:
    • testSourceFiles

      public Collection<File> testSourceFiles()
      Retrieves the test files that should be compiled.
      Returns:
      the test files
    • testSourceFilesPaths

      public CompileKotlinOperation testSourceFilesPaths(Collection<Path> files)
      Provides the test source files that should be compiled.
      Parameters:
      files - the test source files
      Returns:
      this operation instance
      See Also:
    • testSourceFilesStrings

      public CompileKotlinOperation testSourceFilesStrings(Collection<String> files)
      Provides the test source files that should be compiled.
      Parameters:
      files - the test source files
      Returns:
      this operation instance
      See Also:
    • workDir

      public File workDir()
      Retrieves the working directory.
      Returns:
      the directory
    • workDir

      public CompileKotlinOperation workDir(File dir)
      Provides the working directory, if it differs from the project's directory.
      Parameters:
      dir - the directory
      Returns:
      this operation instance
    • workDir

      public CompileKotlinOperation workDir(Path dir)
      Provides the working directory, if it differs from the project's directory.
      Parameters:
      dir - the directory
      Returns:
      this operation instance
    • workDir

      public CompileKotlinOperation workDir(String dir)
      Provides the working directory, if it differs from the project's directory.
      Parameters:
      dir - the directory path
      Returns:
      this operation instance