Package rife.bld.extension
Class CompileKotlinOperation
java.lang.Object
rife.bld.operations.AbstractOperation<CompileKotlinOperation>
rife.bld.extension.CompileKotlinOperation
Compiles main and test Kotlin sources in the relevant build directories.
- Since:
- 1.0
- Author:
- Erik C. Thauvin
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the main build destination directory.buildMainDirectory
(File directory) Provides the main build destination directory.buildMainDirectory
(String directory) Provides the main build destination directory.buildMainDirectory
(Path directory) Provides the main build destination directory.Retrieves the test build destination directory.buildTestDirectory
(File directory) Provides the test build destination directory.buildTestDirectory
(String directory) Provides the test build destination directory.buildTestDirectory
(Path directory) Provides the test build destination directory.Retrieves the entries for the main compilation classpath.compileMainClasspath
(String... classpath) Provides entries for the main compilation classpath.compileMainClasspath
(Collection<String> classpath) Provides the entries for the main compilation classpath.Retrieves the compilation options for the compiler.compileOptions
(CompileOptions options) Provides the compilation options to pass to the Kotlin compiler.Retrieves the entries for the test compilation classpath.compileTestClasspath
(String... classpath) Provides entries for the test compilation classpath.compileTestClasspath
(Collection<String> classpath) Provides the entries for the test compilation classpath.void
execute()
Performs the compile operation.protected void
Part of theexecute
operation, builds the main sources.protected void
executeBuildSources
(Collection<String> classpath, Collection<File> sources, File destination, File friendPaths) Part of theexecute
operation, build sources to a given destination.protected void
Part of theexecute
operation, builds the test sources.protected void
Part of theexecute
operation, creates the build directories.fromProject
(BaseProject project) Configures a compile operation from aBaseProject
.static boolean
isNotBlank
(String s) Determines if the given string is not blank.kotlinc()
Retrieves the path to the Kotlin compiler (kotlinc
) executable, if not inkotlinHome()
.Provides the path to the Kotlin compiler (kotlinc
) executable, if not inkotlinHome()
.Provides the path to the Kotlin compiler (kotlinc
) executable, if not inkotlinHome()
.Provides the path to the Kotlin compiler (kotlinc
) executable, if not inkotlinHome()
.Retrieves the Kotlin home directory.kotlinHome
(File dir) Provides the Kotlin home directory, if it differs from the defaultKOTLIN_HOME
.kotlinHome
(String dir) Provides the Kotlin home directory, if it differs from the defaultKOTLIN_HOME
.kotlinHome
(Path dir) Provides the Kotlin home directory, if it differs from the defaultKOTLIN_HOME
.Retrieves the main source directories that should be compiled.mainSourceDirectories
(File... directories) Provides main source directories that should be compiled.mainSourceDirectories
(String... directories) Provides main source directories that should be compiled.mainSourceDirectories
(Path... directories) Provides main source directories that should be compiled.mainSourceDirectories
(Collection<File> directories) Provides the main source directories that should be compiled.mainSourceDirectoriesPaths
(Collection<Path> directories) Provides the main source directories that should be compiled.mainSourceDirectoriesStrings
(Collection<String> directories) Provides the main source directories that should be compiled.Retrieves the main files that should be compiled.mainSourceFiles
(File... files) Provides main source files that should be compiled.mainSourceFiles
(String... files) Provides main source files that should be compiled.mainSourceFiles
(Path... files) Provides main source files that should be compiled.mainSourceFiles
(Collection<File> files) Provides the main source files that should be compiled.mainSourceFilesPaths
(Collection<Path> files) Provides the main source files that should be compiled.mainSourceFilesStrings
(Collection<String> files) Provides the main source files that should be compiled.plugins()
Retrieves the compiler plugins.plugins
(File directory, CompilerPlugin... plugins) Provides compiler plugins.Provides compiler plugins.plugins
(String directory, CompilerPlugin... plugins) Provides compiler plugins.plugins
(Path directory, CompilerPlugin... plugins) Provides compiler plugins.plugins
(Collection<String> plugins) Provides compiler plugins.plugins
(CompilerPlugin... plugins) Provides compiler plugins located in thekotlinHome()
lib directory.Retrieves the test source directories that should be compiled.testSourceDirectories
(File... directories) Provides test source directories that should be compiled.testSourceDirectories
(String... directories) Provides test source directories that should be compiled.testSourceDirectories
(Path... directories) Provides test source directories that should be compiled.testSourceDirectories
(Collection<File> directories) Provides the test source directories that should be compiled.testSourceDirectoriesPaths
(Collection<Path> directories) Provides the test source directories that should be compiled.testSourceDirectoriesStrings
(Collection<String> directories) Provides the test source directories that should be compiled.Retrieves the test files that should be compiled.testSourceFiles
(File... files) Provides test source files that should be compiled.testSourceFiles
(String... files) Provides the test sources files that should be compiled.testSourceFiles
(Path... files) Provides the test sources files that should be compiled.testSourceFiles
(Collection<File> files) Provides the test source files that should be compiled.testSourceFilesPaths
(Collection<Path> files) Provides the test source files that should be compiled.testSourceFilesStrings
(Collection<String> files) Provides the test source files that should be compiled.workDir()
Retrieves the working directory.Provides the working directory, if it differs from the project's directory.Provides the working directory, if it differs from the project's directory.Provides the working directory, if it differs from the project's directory.Methods inherited from class rife.bld.operations.AbstractOperation
executeOnce, executeOnce, silent, silent
-
Constructor Details
-
CompileKotlinOperation
public CompileKotlinOperation()
-
-
Method Details
-
isNotBlank
Determines if the given string is not blank.- Parameters:
s
- the string- Returns:
true
if not blank,false
otherwise.
-
buildMainDirectory
Provides the main build destination directory.- Parameters:
directory
- the directory to use for the main build destination- Returns:
- this operation instance
-
buildMainDirectory
Provides the main build destination directory.- Parameters:
directory
- the directory to use for the main build destination- Returns:
- this operation instance
-
buildMainDirectory
Provides the main build destination directory.- Parameters:
directory
- the directory to use for the main build destination- Returns:
- this operation instance
-
buildMainDirectory
Retrieves the main build destination directory.- Returns:
- the main build directory
-
buildTestDirectory
Provides the test build destination directory.- Parameters:
directory
- the directory to use for the test build destination- Returns:
- this operation instance
-
buildTestDirectory
Provides the test build destination directory.- Parameters:
directory
- the directory to use for the test build destination- Returns:
- this operation instance
-
buildTestDirectory
Provides the test build destination directory.- Parameters:
directory
- the directory to use for the test build destination- Returns:
- this operation instance
-
buildTestDirectory
Retrieves the test build destination directory.- Returns:
- the test build directory
-
compileMainClasspath
Provides entries for the main compilation classpath.- Parameters:
classpath
- one or more classpath entries- Returns:
- this operation instance
- See Also:
-
compileMainClasspath
Provides the entries for the main compilation classpath.- Parameters:
classpath
- the classpath entries- Returns:
- this operation instance
-
compileMainClasspath
Retrieves the entries for the main compilation classpath.- Returns:
- the classpath entries
-
compileOptions
Retrieves the compilation options for the compiler.- Returns:
- the compilation options
-
compileOptions
Provides the compilation options to pass to the Kotlin compiler.- Parameters:
options
- the compiler options- Returns:
- this operation instance
-
compileTestClasspath
Provides entries for the test compilation classpath.- Parameters:
classpath
- one or more classpath entries- Returns:
- this operation instance
-
compileTestClasspath
Provides the entries for the test compilation classpath.- Parameters:
classpath
- the classpath entries- Returns:
- this operation instance
-
compileTestClasspath
Retrieves the entries for the test compilation classpath.- Returns:
- the classpath entries
-
execute
Performs the compile operation.- Specified by:
execute
in classAbstractOperation<CompileKotlinOperation>
- Throws:
Exception
-
executeBuildMainSources
Part of theexecute
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 theexecute
operation, build sources to a given destination.- Parameters:
classpath
- the classpath list used for the compilationsources
- the source files to compiledestination
- the destination directoryfriendPaths
- the output directory for friendly modules- Throws:
ExitStatusException
- if an error occurs
-
executeBuildTestSources
Part of theexecute
operation, builds the test sources.- Throws:
ExitStatusException
- if an error occurs
-
executeCreateBuildDirectories
Part of theexecute
operation, creates the build directories.- Throws:
IOException
- if an error occurs
-
fromProject
Configures a compile operation from aBaseProject
.Sets the following from the project:
kotlinHome
to theKOTLIN_HOME
environment variable, if set.workDir
to the project's directory.buildMainDirectory
buildTestDirectory
compileMainClassPath
compilesTestClassPath
mainSourceDirectories
to thekotlin
directory insrcMainDirectory
, if present.testSourceDirectories
to thekotlin
directory insrcTestDirectory
, if present.jdkRelease
tojavaRelease
noStdLib
totrue
- Parameters:
project
- the project to configure the compile operation from- Returns:
- this operation instance
-
kotlinHome
Provides the Kotlin home directory, if it differs from the defaultKOTLIN_HOME
.- Parameters:
dir
- the directory- Returns:
- this operation instance
-
kotlinHome
Provides the Kotlin home directory, if it differs from the defaultKOTLIN_HOME
.- Parameters:
dir
- the directory path- Returns:
- this operation instance
-
kotlinHome
Provides the Kotlin home directory, if it differs from the defaultKOTLIN_HOME
.- Parameters:
dir
- the directory path- Returns:
- this operation instance
-
kotlinHome
Retrieves the Kotlin home directory.- Returns:
- the directory
-
kotlinc
Retrieves the path to the Kotlin compiler (kotlinc
) executable, if not inkotlinHome()
.- Returns:
- the executable path
-
kotlinc
Provides the path to the Kotlin compiler (kotlinc
) executable, if not inkotlinHome()
.- Parameters:
executable
- the executable path- Returns:
- this operation instance
-
kotlinc
Provides the path to the Kotlin compiler (kotlinc
) executable, if not inkotlinHome()
.- Parameters:
executable
- the executable path- Returns:
- this operation instance
-
kotlinc
Provides the path to the Kotlin compiler (kotlinc
) executable, if not inkotlinHome()
.- Parameters:
executable
- the executable path- Returns:
- this operation instance
-
mainSourceDirectories
Provides main source directories that should be compiled.- Parameters:
directories
- one or more main source directories- Returns:
- this operation instance
- See Also:
-
mainSourceDirectories
Provides main source directories that should be compiled.- Parameters:
directories
- one or more main source directories- Returns:
- this operation instance
- See Also:
-
mainSourceDirectories
Provides main source directories that should be compiled.- Parameters:
directories
- one or more main source directories- Returns:
- this operation instance
- See Also:
-
mainSourceDirectories
Provides the main source directories that should be compiled.- Parameters:
directories
- the main source directories- Returns:
- this operation instance
- See Also:
-
mainSourceDirectories
Retrieves the main source directories that should be compiled.- Returns:
- the main source directories
-
mainSourceDirectoriesPaths
Provides the main source directories that should be compiled.- Parameters:
directories
- the main source directories- Returns:
- this operation instance
- See Also:
-
mainSourceDirectoriesStrings
Provides the main source directories that should be compiled.- Parameters:
directories
- the main source directories- Returns:
- this operation instance
- See Also:
-
mainSourceFiles
Provides main source files that should be compiled.- Parameters:
files
- one or more main source files- Returns:
- this operation instance
- See Also:
-
mainSourceFiles
Provides main source files that should be compiled.- Parameters:
files
- one or more main source files- Returns:
- this operation instance
- See Also:
-
mainSourceFiles
Provides main source files that should be compiled.- Parameters:
files
- one or more main source files- Returns:
- this operation instance
- See Also:
-
mainSourceFiles
Provides the main source files that should be compiled.- Parameters:
files
- the main source files- Returns:
- this operation instance
- See Also:
-
mainSourceFiles
Retrieves the main files that should be compiled.- Returns:
- the files
-
mainSourceFilesPaths
Provides the main source files that should be compiled.- Parameters:
files
- the main source files- Returns:
- this operation instance
- See Also:
-
mainSourceFilesStrings
Provides the main source files that should be compiled.- Parameters:
files
- the main source files- Returns:
- this operation instance
- See Also:
-
plugins
Provides compiler plugins.- Parameters:
directory
- the directory containing the plugin JARsplugins
- one or more plugins- Returns:
- this class instance
-
plugins
Provides compiler plugins.- Parameters:
plugins
- one or more plugins- Returns:
- this class instance
-
plugins
Retrieves the compiler plugins.- Returns:
- the compiler plugins
-
plugins
Provides compiler plugins.- Parameters:
plugins
- the compiler plugins- Returns:
- this class instance
-
plugins
Provides compiler plugins.- Parameters:
directory
- the directory containing the plugin JARsplugins
- one or more plugins- Returns:
- this class instance
-
plugins
Provides compiler plugins.- Parameters:
directory
- the directory containing the plugin JARsplugins
- one or more plugins- Returns:
- this class instance
-
plugins
Provides compiler plugins located in thekotlinHome()
lib directory.- Parameters:
plugins
- one or more plugins- Returns:
- this class instance
- See Also:
-
testSourceDirectories
Provides test source directories that should be compiled.- Parameters:
directories
- one or more test source directories- Returns:
- this operation instance
- See Also:
-
testSourceDirectories
Provides test source directories that should be compiled.- Parameters:
directories
- one or more test source directories- Returns:
- this operation instance
- See Also:
-
testSourceDirectories
Provides test source directories that should be compiled.- Parameters:
directories
- one or more test source directories- Returns:
- this operation instance
- See Also:
-
testSourceDirectories
Provides the test source directories that should be compiled.- Parameters:
directories
- the test source directories- Returns:
- this operation instance
- See Also:
-
testSourceDirectories
Retrieves the test source directories that should be compiled.- Returns:
- the test source directories
-
testSourceDirectoriesPaths
Provides the test source directories that should be compiled.- Parameters:
directories
- the test source directories- Returns:
- this operation instance
- See Also:
-
testSourceDirectoriesStrings
Provides the test source directories that should be compiled.- Parameters:
directories
- the test source directories- Returns:
- this operation instance
- See Also:
-
testSourceFiles
Provides test source files that should be compiled.- Parameters:
files
- one or more test source files- Returns:
- this operation instance
- See Also:
-
testSourceFiles
Provides the test sources files that should be compiled.- Parameters:
files
- one or more test source files- Returns:
- this operation instance
- See Also:
-
testSourceFiles
Provides the test sources files that should be compiled.- Parameters:
files
- one or more test source files- Returns:
- this operation instance
- See Also:
-
testSourceFiles
Provides the test source files that should be compiled.- Parameters:
files
- the test source files- Returns:
- this operation instance
- See Also:
-
testSourceFiles
Retrieves the test files that should be compiled.- Returns:
- the test files
-
testSourceFilesPaths
Provides the test source files that should be compiled.- Parameters:
files
- the test source files- Returns:
- this operation instance
- See Also:
-
testSourceFilesStrings
Provides the test source files that should be compiled.- Parameters:
files
- the test source files- Returns:
- this operation instance
- See Also:
-
workDir
Retrieves the working directory.- Returns:
- the directory
-
workDir
Provides the working directory, if it differs from the project's directory.- Parameters:
dir
- the directory- Returns:
- this operation instance
-
workDir
Provides the working directory, if it differs from the project's directory.- Parameters:
dir
- the directory- Returns:
- this operation instance
-
workDir
Provides the working directory, if it differs from the project's directory.- Parameters:
dir
- the directory path- Returns:
- this operation instance
-