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
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves the main build destination directory.buildMainDirectory
(File directory) Provides the main build destination directory.Retrieves the test build destination directory.buildTestDirectory
(File directory) Provides the test build destination directory.Retrieves the list of entries for the main compilation classpath.compileMainClasspath
(String... classpath) Provides entries for the main compilation classpath.compileMainClasspath
(Collection<String> classpath) Provides a list of entries for the main compilation classpath.Retrieves the list of compilation options for the compiler.compileOptions
(CompileKotlinOptions options) Provides a list of compilation options to pass to the Kotlin compiler.Retrieves the list of entries for the test compilation classpath.compileTestClasspath
(String... classpath) Provides entries for the test compilation classpath.compileTestClasspath
(Collection<String> classpath) Provides a list of 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
.getJarList
(File directory, String regex) Returns the list of JARs contained in a given directory.static Collection<File>
getKotlinFileList
(File directory) Returns the list of Kotlin source file {.kt
} contained in a given directory.static boolean
isNotBlank
(String s) Determines if the given string is not blank.Retrieves the list of main source directories that should be compiled.mainSourceDirectories
(File... directories) Provides main source directories that should be compiled.mainSourceDirectories
(Collection<File> directories) Provides a list of main source directories that should be compiled.Retrieves the list of main files that should be compiled.mainSourceFiles
(File... files) Provides main files that should be compiled.mainSourceFiles
(Collection<File> files) Provides a list of main files that should be compiled.plugins
(File directory, CompileKotlinPlugin... plugins) Provides compiler plugins.Provides compiler plugins.plugins
(Collection<File> jars, CompileKotlinPlugin... plugins) Provides compiler plugins.plugins
(Collection<String> plugins) Provides compiler plugins.Retrieves the list of test source directories that should be compiled.testSourceDirectories
(File... directories) Provides test source directories that should be compiled.testSourceDirectories
(Collection<File> directories) Provides a list of test source directories that should be compiled.Retrieves the list of test files that should be compiled.testSourceFiles
(File... files) Provides test files that should be compiled.testSourceFiles
(Collection<File> files) Provides a list of test files that should be compiled.Methods inherited from class rife.bld.operations.AbstractOperation
executeOnce, executeOnce, silent, silent
-
Field Details
-
KOTLIN_FILE_PATTERN
The Kotlin file (.kt) pattern.
-
-
Constructor Details
-
CompileKotlinOperation
public CompileKotlinOperation()
-
-
Method Details
-
getJarList
Returns the list of JARs contained in a given directory.- Parameters:
directory
- the directoryregex
- the regular expression to match- Returns:
- the list of JARs
-
getKotlinFileList
Returns the list of Kotlin source file {.kt
} contained in a given directory.- Parameters:
directory
- the directory- Returns:
- the list of Kotlin files
-
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
Retrieves the main build destination directory.- Returns:
- the main build destination
-
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 destination
-
compileMainClasspath
Provides entries for the main compilation classpath.- Parameters:
classpath
- one or more classpath entries- Returns:
- this operation instance
-
compileMainClasspath
Provides a list of entries for the main compilation classpath.- Parameters:
classpath
- a list of classpath entries- Returns:
- this operation instance
-
compileMainClasspath
Retrieves the list of entries for the main compilation classpath.- Returns:
- the main compilation classpath list
-
compileOptions
Retrieves the list of compilation options for the compiler.- Returns:
- the compile kotlin options
-
compileOptions
Provides a list of 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 a list of entries for the test compilation classpath.- Parameters:
classpath
- a list of classpath entries- Returns:
- this operation instance
-
compileTestClasspath
Retrieves the list of entries for the test compilation classpath.- Returns:
- the test compilation classpath list
-
execute
Performs the compile operation.- Specified by:
execute
in classAbstractOperation<CompileKotlinOperation>
- Throws:
IOException
-
executeBuildMainSources
Part of theexecute
operation, builds the main sources.- Throws:
IOException
- if an error occurs
-
executeBuildSources
protected void executeBuildSources(Collection<String> classpath, Collection<File> sources, File destination, File friendPaths) throws IOException 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:
IOException
- if an error occurs
-
executeBuildTestSources
Part of theexecute
operation, builds the test sources.- Throws:
IOException
- 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:
buildMainDirectory
buildTestDirectory
compileMainClassPath
compilesTestClassPath
mainSourceFiles
to thekotlin
directory insrcMainDirectory
testSourceFile
to thekotlin
directory insrcTestDirectory
jdkRelease
tojavaRelease
noStdLib
totrue
- Parameters:
project
- the project to configure the compile operation from- 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
-
mainSourceDirectories
Provides a list of main source directories that should be compiled.- Parameters:
directories
- a list of main source directories- Returns:
- this operation instance
-
mainSourceDirectories
Retrieves the list of main source directories that should be compiled.- Returns:
- the list of main source directories to compile
-
mainSourceFiles
Provides main files that should be compiled.- Parameters:
files
- one or more main files- Returns:
- this operation instance
-
mainSourceFiles
Provides a list of main files that should be compiled.- Parameters:
files
- a list of main files- Returns:
- this operation instance
-
mainSourceFiles
Retrieves the list of main files that should be compiled.- Returns:
- the list of main files to compile
-
plugins
Provides compiler plugins.- Parameters:
plugins
- one or more plugins- Returns:
- this class instance
-
plugins
Provides compiler plugins.- Parameters:
plugins
- a list of 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:
jars
- the list of plugin JARsplugins
- one or more plugins- Returns:
- this class instance
-
testSourceDirectories
Provides test source directories that should be compiled.- Parameters:
directories
- one or more test source directories- Returns:
- this operation instance
-
testSourceDirectories
Provides a list of test source directories that should be compiled.- Parameters:
directories
- a list of test source directories- Returns:
- this operation instance
-
testSourceDirectories
Retrieves the list of test source directories that should be compiled.- Returns:
- the list of test source directories to compile
-
testSourceFiles
Provides test files that should be compiled.- Parameters:
files
- one or more test files- Returns:
- this operation instance
-
testSourceFiles
Provides a list of test files that should be compiled.- Parameters:
files
- a list of test files- Returns:
- this operation instance
-
testSourceFiles
Retrieves the list of test files that should be compiled.- Returns:
- the list of test files to compile
-