KotlinScript

interface KotlinScript(source)

Base contract for all Gradle Kotlin DSL scripts.

This is the Kotlin flavored equivalent of org.gradle.api.Script.

It is not implemented directly by the IDE script templates to overcome ambiguous conflicts and Kotlin language limitations.

Since

6.0

Properties

Link copied to clipboard
abstract val logger: Logger

Logger for scripts. You can use this in your script to write log messages.

Link copied to clipboard
abstract val logging: LoggingManager

The LoggingManager which can be used to receive logging and to control the standard output/error capture for this script. By default, System.out is redirected to the Gradle logging system at the QUIET log level, and System.err is redirected at the ERROR log level.

Link copied to clipboard
abstract val resources: ResourceHandler

Provides access to resource-specific utility methods, for example factory methods that create various resources.

Functions

Link copied to clipboard
abstract fun copy(configuration: Action<CopySpec>): WorkResult

Copies the specified files.

Link copied to clipboard
abstract fun copySpec(): CopySpec
abstract fun copySpec(configuration: Action<CopySpec>): CopySpec

Creates a {@link CopySpec} which can later be used to copy files or create an archive.

Link copied to clipboard
abstract fun delete(vararg paths: Any): Boolean

Deletes files and directories.

abstract fun delete(configuration: Action<DeleteSpec>): WorkResult

Deletes the specified files.

Link copied to clipboard
abstract fun exec(configuration: Action<ExecSpec>): ExecResult

Executes an external command.

Link copied to clipboard
abstract fun file(path: Any): File
abstract fun file(path: Any, validation: PathValidation): File

Resolves a file path relative to this script's target base directory.

Link copied to clipboard
abstract fun files(vararg paths: Any): ConfigurableFileCollection

Creates a ConfigurableFileCollection containing the given files.

Link copied to clipboard
abstract fun fileTree(baseDir: Any): ConfigurableFileTree
abstract fun fileTree(baseDir: Any, configuration: Action<ConfigurableFileTree>): ConfigurableFileTree

Creates a new ConfigurableFileTree using the given base directory.

Link copied to clipboard
abstract fun javaexec(configuration: Action<JavaExecSpec>): ExecResult

Executes an external Java process.

Link copied to clipboard
abstract fun mkdir(path: Any): File

Creates a directory and returns a file pointing to it.

Link copied to clipboard
abstract fun relativePath(path: Any): String

Returns the relative path from this script's target base directory to the given path.

Link copied to clipboard
abstract fun tarTree(tarPath: Any): FileTree

Creates a new FileTree which contains the contents of the given TAR file.

Link copied to clipboard
abstract fun uri(path: Any): URI

Resolves a file path to a URI, relative to this script's target base directory.

Link copied to clipboard
abstract fun zipTree(zipPath: Any): FileTree

Creates a new FileTree which contains the contents of the given ZIP file.