concept script plugin in category gradle

This is an excerpt from Manning's book Gradle in Action - corrected 9052019.
Plugin development in Gradle isn’t hard. You’ll need to get to know some new concepts while at the same time applying techniques you’ve already learned in previous chapters. Gradle distinguishes two types of plugins: script plugins and object plugins. A script plugin is nothing more than a regular Gradle build script that can be imported into other build scripts. With script plugins, you can do everything you’ve learned so far. Object plugins need to implement the interface org.gradle.api.Plugin. The source code for object plugins usually lives in the buildSrc directory alongside your project or a standalone project and is distributed as a JAR file. In this chapter, you’ll learn how to use both approaches.
A script plugin is no different from your ordinary build.gradle file. You can use the same Gradle build language constructs. You’ll create a new script named cloudbees.gradle that will contain the future CloudBees tasks. Because the build script’s filename deviates from the default naming convention, you’ll need to use the –b command-line option to invoke it. Executing gradle –b cloudbees.gradle tasks should only present you with the default help tasks. Before you can write the first task, the build script needs to become aware of the CloudBees API client library.