<book id="dsl">
    <bookinfo>
        <title>Gradle Build Language Reference</title>
        <titleabbrev>Gradle DSL</titleabbrev>
    </bookinfo>

    <section>
        <title>Introduction</title>
        <para>This reference guide describes the various types which make up the Gradle build language, or DSL.</para>
    </section>

    <section>
        <title>Some basics</title>
        <para>There are a few basic concepts that you should understand, which will help you write Gradle scripts.</para>

        <para>First, Gradle scripts are <firstterm>configuration scripts</firstterm>. As the script executes, it
            configures an object of a particular type. For example, as a build script executes, it configures an
            object of type <apilink class="org.gradle.api.Project"/>. This object is called the <firstterm>delegate object</firstterm>
            of the script. The following table shows the delegate for each type of Gradle script.
        </para>

        <table>
            <title>Script delegates</title>
            <thead>
                <tr>
                    <td>Type of script</td>
                    <td>Delegates to instance of</td>
                </tr>
            </thead>
            <tr>
                <td>Build script</td>
                <td>
                    <apilink class="org.gradle.api.Project"/>
                </td>
            </tr>
            <tr>
                <td>Init script</td>
                <td>
                    <apilink class="org.gradle.api.invocation.Gradle"/>
                </td>
            </tr>
            <tr>
                <td>Settings script</td>
                <td>
                    <apilink class="org.gradle.api.initialization.Settings"/>
                </td>
            </tr>
        </table>

        <para>The properties and methods of the delegate object are available for you to use in the script.</para>

        <para>Second, each Gradle script implements the <apilink class="org.gradle.api.Script"/> interface. This
            interface defines a number of properties and methods which you can use in the script.
        </para>
    </section>

    <!--
      -
      - To add more types to this guide, add them to one of the following tables. The contents of
      - ${classname}.xml for each type listed below is then included in the guide.
      -
      -->

    <section>
        <title>Build script structure</title>
        <para>A build script is made up of zero or more statements and script blocks. Statements can include method calls,
            property assignments, and local variable definitions. A script block is a method call which takes a closure
            as a parameter. The closure is treated as a <firstterm>configuration closure</firstterm> which configures
            some delegate object as it executes. The top level script blocks are listed below.</para>
        <table>
            <title>Build script blocks</title>
            <tr>
                <td>allprojects</td>
            </tr>
            <tr>
                <td>artifacts</td>
            </tr>
            <tr>
                <td>buildscript</td>
            </tr>
            <tr>
                <td>configurations</td>
            </tr>
            <tr>
                <td>dependencies</td>
            </tr>
            <tr>
                <td>repositories</td>
            </tr>
            <tr>
                <td>sourceSets</td>
            </tr>
            <tr>
                <td>subprojects</td>
            </tr>
        </table>
        <para>A build script is also a Groovy script, and so can contain those elements allowed in a Groovy script,
            such as method definitions and class definitions.
        </para>
    </section>

    <section>
        <title>Core types</title>
        <para>Listed below are some of the central types which are used in Gradle scripts:</para>
        <table>
            <title>Core types</title>
            <tr>
                <td>org.gradle.api.Project</td>
            </tr>
            <tr>
                <td>org.gradle.api.Task</td>
            </tr>
            <tr>
                <td>org.gradle.api.invocation.Gradle</td>
            </tr>
            <tr>
                <td>org.gradle.api.initialization.Settings</td>
            </tr>
            <tr>
                <td>org.gradle.api.Script</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.SourceSet</td>
            </tr>
            <tr>
                <td>org.gradle.api.artifacts.Configuration</td>
            </tr>
        </table>
    </section>

    <section>
        <title>Task types</title>
        <para>Listed below are the various task types which are available for use in your build script:</para>
        <table>
            <title>Task types</title>
            <tr>
                <td>org.gradle.api.plugins.antlr.AntlrTask</td>
            </tr>
            <tr>
                <td>org.gradle.api.plugins.quality.Checkstyle</td>
            </tr>
            <tr>
                <td>org.gradle.api.plugins.quality.CodeNarc</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.compile.Compile</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.Copy</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.Delete</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.Directory</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.diagnostics.DependencyReportTask</td>
            </tr>
            <tr>
                <td>org.gradle.plugins.eclipse.EclipseClasspath</td>
            </tr>
            <tr>
                <td>org.gradle.plugins.eclipse.EclipseJdt</td>
            </tr>
            <tr>
                <td>org.gradle.plugins.eclipse.EclipseProject</td>
            </tr>
            <tr>
                <td>org.gradle.plugins.eclipse.EclipseWtp</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.Exec</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.GradleBuild</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.compile.GroovyCompile</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.javadoc.Groovydoc</td>
            </tr>
            <tr>
                <td>org.gradle.plugins.idea.IdeaModule</td>
            </tr>
            <tr>
                <td>org.gradle.plugins.idea.IdeaProject</td>
            </tr>
            <tr>
                <td>org.gradle.plugins.idea.IdeaWorkspace</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.bundling.Jar</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.javadoc.Javadoc</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.JavaExec</td>
            </tr>
            <tr>
                <td>org.gradle.api.plugins.jetty.JettyRun</td>
            </tr>
            <tr>
                <td>org.gradle.api.plugins.jetty.JettyRunWar</td>
            </tr>
            <tr>
                <td>org.gradle.api.plugins.jetty.JettyStop</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.diagnostics.PropertyReportTask</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.diagnostics.ProjectReportTask</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.scala.ScalaCompile</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.scala.ScalaDoc</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.Sync</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.bundling.Tar</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.diagnostics.TaskReportTask</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.testing.Test</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.Upload</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.bundling.War</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.wrapper.Wrapper</td>
            </tr>
            <tr>
                <td>org.gradle.api.tasks.bundling.Zip</td>
            </tr>
        </table>
    </section>
</book>