Kotlin Script Custom Build Step
A build step running a Kotlin script with the specified content
Example. Adds a Kotlin script build step with default Kotlin compiler and default JVM.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
kotlinScript {
name = "My Kotlin Script step"
content = """
// Koltin script content
println("Hello, World")
""".trimIndent()
}
Content copied to clipboard }
}
Example. Adds a Kotlin script build step with bundled Kotlin compiler and custom JDK is set to the environment variable value with additional parameter. Additional agruments are passed to the Kotlin script with a reference to the configuration parameter value. Custom working directory is provided.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
kotlinScript {
name = "My Kotlin Script step"
workingDir = "data/"
content = """
// Koltin script content
println("Hello, World")
""".trimIndent()
compiler = "%teamcity.tool.kotlin.compiler.bundled%"
arguments = "%myscript.params%"
jdkHome = "%env.JDK_15_0%"
jvmArgs = "-Xmx2048m"
}
Content copied to clipboard }
}
Example. Adds a Kotlin script build step with custom Kotlin compiler and custom JDK with additional parameter. Custom working directory is provided.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
kotlinScript {
name = "My Kotlin Script step"
workingDir = "data/"
content = """
// Koltin script content
println("Hello, World")
""".trimIndent()
compiler = "path/to/kotlin/compiler"
jdkHome = "path/to/jdk"
jvmArgs = "-Xmx2048m"
}
Content copied to clipboard }
}
See also
Properties
Optional collection of build step execution conditions
Build step execution mode
Build working directory for the script, specify it if it is different from the checkout directory.
Functions
Deletes all configured build step conditions
Configures build step conditions
Copies parameters of this object to the specified target
Validates this object and reports found errors to the provided consumer