Extending Gradle: Difference between revisions
Line 8: | Line 8: | ||
=Custom Task= | =Custom Task= | ||
{{External|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]]. The custom class 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 [[#Standalone_Custom_Task|standalone custom task]]. | 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]]. The custom class 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 [[#Standalone_Custom_Task|standalone custom task]]. | ||
Line 26: | Line 27: | ||
Simple Task | Simple Task | ||
Enhanced Task | Enhanced Task | ||
=Custom Script Plugin= | =Custom Script Plugin= | ||
=Custom Object Plugin= | =Custom Object Plugin= |
Revision as of 22:54, 23 September 2020
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 part of a different artifact.
Custom Task
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. The custom class 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 standalone custom 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.
Enhanced Task
Standalone Custom Task
Using the Custom Task
Enhanced task.
Simple Task
Enhanced Task