api / org.gradle.api / Plugin

Plugin

interface Plugin<T : Any>

A Plugin represents an extension to Gradle. A plugin applies some configuration to a target object. Usually, this target object is a org.gradle.api.Project, but plugins can be applied to any type of objects.

Parameters

- The type of object which this plugin can configure.

Functions

apply

abstract fun apply(target: T): Unit

Apply this plugin to the given target object.

Inheritors

AnnouncePlugin

open class AnnouncePlugin : Plugin<Project>

This plugin allows to send announce messages to Twitter.

AntlrPlugin

open class AntlrPlugin : Plugin<Project>

A plugin for adding Antlr support to JavaPlugin.

ApplicationPlugin

open class ApplicationPlugin : Plugin<Project>

A Plugin which runs a project as a Java Application.

The plugin can be configured via its companion ApplicationPluginConvention object.

AssemblerLangPlugin

open class AssemblerLangPlugin : Plugin<Project>

Adds core Assembler language support.

AssemblerPlugin

open class AssemblerPlugin : Plugin<Project>

A plugin for projects wishing to build native binary components from Assembly language sources.

Automatically includes the AssemblerLangPlugin for core Assembler support and the NativeComponentPlugin for native component support.

  • Creates a org.gradle.language.assembler.tasks.Assemble task for each org.gradle.language.assembler.AssemblerSourceSet to assemble the sources.

BasePlugin

open class BasePlugin : Plugin<Project>

A org.gradle.api.Plugin which defines a basic project lifecycle and some common convention properties.

BinaryBasePlugin

open class BinaryBasePlugin : Plugin<Project>

Base plugin for binaries support. - Adds a BinarySpec container named binaries to the project. - Registers the base BinarySpec type. - For each BinarySpec, registers a lifecycle task to assemble that binary. - For each BinarySpec, adds the binary's source sets as its default inputs. - Links the tasks for each BinarySpec across to the tasks container.

BuildAnnouncementsPlugin

open class BuildAnnouncementsPlugin : Plugin<Project>

A plugin which announces interesting build lifecycle events.

BuildDashboardPlugin

open class BuildDashboardPlugin : Plugin<Project>

Adds a task, "buildDashboard", that aggregates the output of all tasks that produce reports.

BuildInitPlugin

open class BuildInitPlugin : Plugin<Project>

The build init plugin.

CLangPlugin

open class CLangPlugin : Plugin<Project>

Adds core C language support.

CPlugin

open class CPlugin : Plugin<Project>

A plugin for projects wishing to build native binary components from C sources.

Automatically includes the CLangPlugin for core C++ support and the org.gradle.nativeplatform.plugins.NativeComponentPlugin for native component support.

  • Creates a org.gradle.language.c.tasks.CCompile task for each org.gradle.language.c.CSourceSet to compile the C sources.

CUnitConventionPlugin

open class CUnitConventionPlugin : Plugin<Project>

A plugin that applies the CUnitPlugin and adds conventions on top of it.

CUnitPlugin

open class CUnitPlugin : Plugin<Project>

A plugin that sets up the infrastructure for testing native binaries with CUnit.

ClangCompilerPlugin

open class ClangCompilerPlugin : Plugin<Project>

A Plugin which makes the Clang compiler available for compiling C/C++ code.

CoffeeScriptBasePlugin

open class CoffeeScriptBasePlugin : Plugin<Project>

CompareGradleBuildsPlugin

open class CompareGradleBuildsPlugin : Plugin<Project>

Preconfigures the project to run a gradle build comparison.

ComponentBasePlugin

open class ComponentBasePlugin : Plugin<Project>

Base plugin for ComponentSpec support. - Registers the infrastructure to support the base ComponentSpec type and extensions to this type.

ComponentModelBasePlugin

open class ComponentModelBasePlugin : Plugin<Project>

Base plugin for component support. Adds a org.gradle.platform.base.ComponentSpecContainer named components to the model. For each binary instance added to the binaries container, registers a lifecycle task to create that binary.

CppApplicationPlugin

open class CppApplicationPlugin : Plugin<ProjectInternal>

A plugin that produces a native application from C++ source.

Assumes the source files are located in `src/main/cpp` and header files are located in `src/main/headers`.

Adds a CppApplication extension to the project to allow configuration of the application.

CppBasePlugin

open class CppBasePlugin : Plugin<ProjectInternal>

A common base plugin for the C++ executable and library plugins

CppLangPlugin

open class CppLangPlugin : Plugin<Project>

Adds core C++ language support.

CppLibraryPlugin

open class CppLibraryPlugin : Plugin<ProjectInternal>

A plugin that produces a native library from C++ source.

Assumes the source files are located in `src/main/cpp`, public headers are located in `src/main/public` and implementation header files are located in `src/main/headers`.

Adds a CppLibrary extension to the project to allow configuration of the library.

CppPlugin

open class CppPlugin : Plugin<Project>

A plugin for projects wishing to build native binary components from C++ sources.

Automatically includes the CppLangPlugin for core C++ support and the NativeComponentPlugin for native component support.

  • Creates a org.gradle.language.cpp.tasks.CppCompile task for each org.gradle.language.cpp.CppSourceSet to compile the C++ sources.

CppUnitTestPlugin

open class CppUnitTestPlugin : Plugin<ProjectInternal>

A plugin that sets up the infrastructure for testing C++ binaries using a simple test executable. Gradle will create a RunTestExecutable task that relies on the exit code of the binary.

DistributionPlugin

open class DistributionPlugin : Plugin<ProjectInternal>

A Plugin to package project as a distribution.

EarPlugin

open class EarPlugin : Plugin<Project>

A Plugin with tasks which assemble a web application into a EAR file.

EmbeddedKotlinPlugin

open class EmbeddedKotlinPlugin : Plugin<Project>

The embedded-kotlin plugin.

EnvJsPlugin

open class EnvJsPlugin : Plugin<Project>

GccCompilerPlugin

open class GccCompilerPlugin : Plugin<Project>

A Plugin which makes the GNU GCC/G++ compiler available for compiling C/C++ code.

GoogleTestConventionPlugin

open class GoogleTestConventionPlugin : Plugin<Project>

A plugin that applies the GoogleTestPlugin and adds conventions on top of it.

GoogleTestPlugin

open class GoogleTestPlugin : Plugin<Project>

A plugin that sets up the infrastructure for testing native binaries with GoogleTest.

GroovyBasePlugin

open class GroovyBasePlugin : Plugin<Project>

Extends org.gradle.api.plugins.JavaBasePlugin to provide support for compiling and documenting Groovy source files.

GroovyPlugin

open class GroovyPlugin : Plugin<Project>

A Plugin which extends the JavaPlugin to provide support for compiling and documenting Groovy source files.

HelpTasksPlugin

open class HelpTasksPlugin : Plugin<ProjectInternal>

Adds various reporting tasks that provide information about the project.

IvyPublishPlugin

open class IvyPublishPlugin : Plugin<Project>

Adds the ability to publish in the Ivy format to Ivy repositories.

JUnitTestSuitePlugin

open class JUnitTestSuitePlugin : Plugin<Project>

This plugin adds support for execution of JUnit test suites to the Java software model.

JacocoPlugin

open class JacocoPlugin : Plugin<ProjectInternal>

Plugin that provides support for generating Jacoco coverage data.

JavaBasePlugin

open class JavaBasePlugin : Plugin<ProjectInternal>

A org.gradle.api.Plugin which compiles and tests Java source, and assembles it into a JAR file.

JavaGradlePluginPlugin

open class JavaGradlePluginPlugin : Plugin<Project>

A plugin for building java gradle plugins. Automatically generates plugin descriptors. Emits warnings for common error conditions.

Provides a direct integration with TestKit by declaring the gradleTestKit() dependency for the test compile configuration and a dependency on the plugin classpath manifest generation task for the test runtime configuration. Default conventions can be customized with the help of GradlePluginDevelopmentExtension. Integrates with the 'maven-publish' and 'ivy-publish' plugins to automatically publish the plugins so they can be resolved using the `pluginRepositories` and `plugins` DSL.

JavaLanguagePlugin

open class JavaLanguagePlugin : Plugin<Project>

Plugin for compiling Java code. Applies the org.gradle.language.base.plugins.ComponentModelBasePlugin and org.gradle.language.jvm.plugins.JvmResourcesPlugin. Registers "java" language support with the JavaSourceSet.

JavaLibraryDistributionPlugin

open class JavaLibraryDistributionPlugin : Plugin<ProjectInternal>

A Plugin which package a Java project as a distribution including the JAR and runtime dependencies.

JavaLibraryPlugin

open class JavaLibraryPlugin : Plugin<Project>

A Plugin which extends the capabilities of the JavaPlugin by cleanly separating the API and implementation dependencies of a library.

JavaPlugin

open class JavaPlugin : Plugin<ProjectInternal>

A Plugin which compiles and tests Java source, and assembles it into a JAR file.

JavaScriptBasePlugin

open class JavaScriptBasePlugin : Plugin<Project>

JsHintPlugin

open class JsHintPlugin : Plugin<Project>

JvmComponentPlugin

open class JvmComponentPlugin : Plugin<Project>

Base plugin for JVM component support. Applies the org.gradle.language.base.plugins.ComponentModelBasePlugin. Registers the JvmLibrarySpec library type for the components container.

JvmResourcesPlugin

open class JvmResourcesPlugin : Plugin<Project>

Plugin for packaging JVM resources. Applies the org.gradle.language.base.plugins.ComponentModelBasePlugin. Registers "resources" language support with the .

KotlinDslCompilerPlugins

open class KotlinDslCompilerPlugins : Plugin<Project>

Configures the Kotlin compiler to recognise Gradle functional interface annotated with HasImplicitReceiver.

KotlinDslPlugin

open class KotlinDslPlugin : Plugin<Project>

The kotlin-dsl plugin.

LanguageBasePlugin

open class LanguageBasePlugin : Plugin<Project>

Base plugin for language support. - Adds a ProjectSourceSet named sources to the project. - Registers the base LanguageSourceSet type.

LifecycleBasePlugin

open class LifecycleBasePlugin : Plugin<ProjectInternal>

A org.gradle.api.Plugin which defines a basic project lifecycle.

MavenPlugin

open class MavenPlugin : Plugin<ProjectInternal>

A org.gradle.api.Plugin which allows project artifacts to be deployed to a Maven repository, or installed to the local Maven cache.

MavenPublishPlugin

open class MavenPublishPlugin : Plugin<Project>

Adds the ability to publish in the Maven format to Maven repositories.

MicrosoftVisualCppCompilerPlugin

open class MicrosoftVisualCppCompilerPlugin : Plugin<Project>

A Plugin which makes the Microsoft Visual C++ compiler available to compile C/C++ code.

NativeBasePlugin

open class NativeBasePlugin : Plugin<ProjectInternal>

A common base plugin for the native plugins.

Expects plugins to register the native components in the Project#getComponents() container, and defines a number of rules that act on these components to configure them.

  • Configures the {@value LifecycleBasePlugin#ASSEMBLE_TASK_NAME} task to build the development binary of the main component, if present. Expects the main component to be of type ProductionComponent and ComponentWithBinaries.
  • Adds an "assemble" task for each binary of the main component.
  • Adds tasks to compile and link an executable. Currently requires component implements internal API ConfigurableComponentWithExecutable.
  • Adds tasks to compile and link a shared library. Currently requires component implements internal API ConfigurableComponentWithSharedLibrary.
  • Adds tasks to compile and create a static library. Currently requires component implements internal API ConfigurableComponentWithStaticLibrary.
  • Adds outgoing configuration and artifacts for link file. Currently requires component implements internal API ConfigurableComponentWithLinkUsage.
  • Adds outgoing configuration and artifacts for runtime file. Currently requires component implements internal API ConfigurableComponentWithRuntimeUsage.
  • Maven publications. Currently requires component implements internal API PublicationAwareComponent.

NativeBinariesTestPlugin

open class NativeBinariesTestPlugin : Plugin<Project>

A plugin that sets up the infrastructure for testing native binaries.

NativeComponentModelPlugin

open class NativeComponentModelPlugin : Plugin<ProjectInternal>

A plugin that sets up the infrastructure for defining native binaries.

NativeComponentPlugin

open class NativeComponentPlugin : Plugin<ProjectInternal>

A plugin that creates tasks used for constructing native binaries.

NativeTestingBasePlugin

open class NativeTestingBasePlugin : Plugin<ProjectInternal>

Common base plugin for all native testing plugins.

Expects plugins to register the native test suites in the Project#getComponents() container, and defines a number of rules that act on these components to configure them.

  • Adds a "test" task.
  • Configures the "test" task to run the tests of the test component, if present. Expects the test component to be of type TestSuiteComponent.

ObjectiveCLangPlugin

open class ObjectiveCLangPlugin : Plugin<Project>

Adds core Objective-C language support.

ObjectiveCPlugin

open class ObjectiveCPlugin : Plugin<Project>

A plugin for projects wishing to build native binary components from Objective-C sources.

Automatically includes the ObjectiveCLangPlugin for core Objective-C support and the org.gradle.nativeplatform.plugins.NativeComponentPlugin for native component support.

  • Creates a org.gradle.language.objectivec.tasks.ObjectiveCCompile task for each org.gradle.language.objectivec.ObjectiveCSourceSet to compile the Objective-C sources.

ObjectiveCppLangPlugin

open class ObjectiveCppLangPlugin : Plugin<Project>

Adds core Objective-Cpp language support.

ObjectiveCppPlugin

open class ObjectiveCppPlugin : Plugin<Project>

A plugin for projects wishing to build native binary components from Objective-C++ sources.

Automatically includes the ObjectiveCppLangPlugin for core Objective-C++ support and the NativeComponentPlugin for native component support.

  • Creates a org.gradle.language.objectivecpp.tasks.ObjectiveCppCompile task for each org.gradle.language.objectivecpp.ObjectiveCppSourceSet to compile the Objective-C++ sources.

OsgiPlugin

open class OsgiPlugin : Plugin<Project>

A Plugin which extends the JavaPlugin to add OSGi meta-information to the project Jars.

PlayApplicationPlugin

open class PlayApplicationPlugin : Plugin<Project>

Plugin for Play Framework component support. Registers the org.gradle.play.PlayApplicationSpec component type for the components container.

PlayCoffeeScriptPlugin

open class PlayCoffeeScriptPlugin : Plugin<Project>

Plugin for adding coffeescript compilation to a Play application. Adds support for defining org.gradle.language.coffeescript.CoffeeScriptSourceSet source sets. A "coffeeScript" source set is created by default.

PlayIdePlugin

open class PlayIdePlugin : Plugin<Project>

Plugin for configuring IDE plugins when the project uses the Play Framework component support.

NOTE: This currently supports configuring the 'idea' plugin only.

PlayJavaScriptPlugin

open class PlayJavaScriptPlugin : Plugin<Project>

Plugin for adding javascript processing to a Play application. Registers "javascript" language support with the org.gradle.language.javascript.JavaScriptSourceSet.

PlayPlugin

open class PlayPlugin : Plugin<Project>

Plugin for Play Framework component support. Registers the org.gradle.play.PlayApplicationSpec component type for the components container.

PrecompiledScriptPlugins

open class PrecompiledScriptPlugins : Plugin<Project>

ProjectReportsPlugin

open class ProjectReportsPlugin : Plugin<Project>

A Plugin which adds some project visualization report tasks to a project.

PublishingPlugin

open class PublishingPlugin : Plugin<Project>

Installs a org.gradle.api.publish.PublishingExtension with name {@value org.gradle.api.publish.PublishingExtension#NAME}.

ReportingBasePlugin

open class ReportingBasePlugin : Plugin<ProjectInternal>

A Plugin which provides the basic skeleton for reporting.

This plugin adds the following extension objects to the project:

  • org.gradle.api.reporting.ReportingExtension

RhinoPlugin

open class RhinoPlugin : Plugin<Project>

ScalaBasePlugin

open class ScalaBasePlugin : Plugin<Project>

A Plugin which compiles and tests Scala sources.

ScalaLanguagePlugin

open class ScalaLanguagePlugin : Plugin<Project>

Plugin for compiling Scala code. Applies the org.gradle.language.base.plugins.ComponentModelBasePlugin and org.gradle.language.jvm.plugins.JvmResourcesPlugin. Registers "scala" language support with the org.gradle.language.scala.ScalaLanguageSourceSet.

ScalaPlugin

open class ScalaPlugin : Plugin<Project>

A Plugin which sets up a Scala project.

SigningPlugin

open class SigningPlugin : Plugin<Project>

Adds the ability to digitally sign files and artifacts.

SwiftApplicationPlugin

open class SwiftApplicationPlugin : Plugin<ProjectInternal>

A plugin that produces an executable from Swift source.

Adds compile, link and install tasks to build the executable. Defaults to looking for source files in `src/main/swift`.

Adds a SwiftApplication extension to the project to allow configuration of the executable.

SwiftBasePlugin

open class SwiftBasePlugin : Plugin<ProjectInternal>

A common base plugin for the Swift application and library plugins

SwiftCompilerPlugin

open class SwiftCompilerPlugin : Plugin<Project>

A Plugin which makes the Swiftc compiler available for compiling Swift code.

SwiftLibraryPlugin

open class SwiftLibraryPlugin : Plugin<Project>

A plugin that produces a shared library from Swift source.

Adds compile, link and install tasks to build the shared library. Defaults to looking for source files in `src/main/swift`.

Adds a SwiftComponent extension to the project to allow configuration of the library.

SwiftPackageManagerExportPlugin

open class SwiftPackageManagerExportPlugin : Plugin<Project>

A plugin that produces a Swift Package Manager manifests from the Gradle model.

This plugin should only be applied to the root project of a build.

TestingBasePlugin

open class TestingBasePlugin : Plugin<Project>

Base plugin for testing. - Adds default locations for test reporting

TestingModelBasePlugin

open class TestingModelBasePlugin : Plugin<Project>

Base plugin for testing. - Adds a org.gradle.testing.base.TestSuiteContainer named testSuites to the model. - Copies test binaries from testSuites into binaries.

WarPlugin

open class WarPlugin : Plugin<Project>

A Plugin which extends the JavaPlugin to add tasks which assemble a web application into a WAR file.

WindowsResourceScriptPlugin

open class WindowsResourceScriptPlugin : Plugin<Project>

Adds core language support for Windows resource script files.

WindowsResourcesPlugin

open class WindowsResourcesPlugin : Plugin<Project>

A plugin for projects wishing to build native binary components from Windows Resource sources.

Automatically includes the WindowsResourceScriptPlugin for core Windows Resource source support and the NativeComponentPlugin for native component support.

  • Creates a org.gradle.language.rc.tasks.WindowsResourceCompile task for each org.gradle.language.rc.WindowsResourceSet to compile the sources.

WrapperPlugin

open class WrapperPlugin : Plugin<Project>

The wrapper plugin.

XCTestConventionPlugin

open class XCTestConventionPlugin : Plugin<ProjectInternal>

A plugin that sets up the infrastructure for testing native binaries with XCTest test framework. It also adds conventions on top of it.