Book Image

Gradle for Android

By : Kevin Pelgrims
Book Image

Gradle for Android

By: Kevin Pelgrims

Overview of this book

Table of Contents (16 chapters)
Gradle for Android
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 7. Creating Tasks and Plugins

So far, we have been manipulating properties for our Gradle builds and learning how to run tasks. In this chapter, we will get a deeper understanding of those properties, and start creating our own tasks. Once we know how to write our own tasks, we can go even further, and look at how to make our own plugins that can be reused in several projects.

Before we look at how to create custom tasks, we need to learn a few important Groovy concepts. This is because having a basic understanding of how Groovy works makes it a lot easier to get started with custom tasks and plugins. Knowing Groovy also helps to understand how Gradle works, and why the build configuration files look the way they do.

In this chapter, we will look at the following topics:

  • Understanding Groovy

  • Getting started with tasks

  • Hooking into the Android plugin

  • Creating your own plugins