Extending Gradle

From NovaOrdis Knowledge Base
Revision as of 23:10, 23 September 2020 by Ovidiu (talk | contribs) (→‎Custom Task)
Jump to navigation Jump to search

Internal

Overview

The simplest way to extend Gradle is to write a custom task, which can be declared in-line in build.gradle or can be written in its own source file(s).

Custom Task

https://docs.gradle.org/current/userguide/custom_tasks.html

The simplest way of extending Gradle is write a custom task. The custom task can be declared in-line in the default build script build.gradle, as a simple task. The simple task can also be declared in-line in a separate build script, which is then included from the default build script. The code of the custom task can live in a separate source file, which in turn can be declared in a special area of the Gradle project, or can be share with other projects as part of a library. Such a task is referred to as a enhanced task.

Task. DEPLETE Gradle_Task_TODEPLETE#Explicit_Task_Declaration_.28Custom_Tasks.29

Simple Task

A simple task is defined with an in-line action closure in the build script or another script imported from the build script.

Enhanced Task

An enhanced task implies writing code into a source code file (or files) and providing that bytecode to Gradle. The behavior is built into the task and the task exposes some properties that can be configured from the build script. This is appropriate if the task needs to be shared across different projects.

Custom Script Plugin

Custom Object Plugin