# How Gradle compiles your build scripts

DevFeed: [How Gradle compiles your build scripts](<https://devfeed.tech/articles/how-gradle-compiles-your-build-scripts-25432.md>)

Original publisher: [Read original article](<https://blog.mbonnin.net/how-gradle-compiles-your-build-scripts>)

Author: Martin Bonnin

Published: 2022-11-18T17:14:29Z

Content type: tutorial

Language: en

Sources: [Martin Bonnin's blog](<https://devfeed.tech/sources/martin-bonnin-s-blog.md>)

Topics: [Gradle](<https://devfeed.tech/topics/gradle.md>), [Code](<https://devfeed.tech/topics/code.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Parser](<https://devfeed.tech/topics/parser.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [build](<https://devfeed.tech/tags/build.md>), [compilation](<https://devfeed.tech/tags/compilation.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [plugins](<https://devfeed.tech/tags/plugins.md>), [script](<https://devfeed.tech/tags/script.md>)

## AI overview

This tutorial explains how Gradle compiles build scripts in multiple passes. Gradle first extracts and evaluates the plugins block using the Kotlin lexer, generates accessors, and then compiles and evaluates the script with plugin dependencies on the classpath. It also discusses version catalogs and other ways to centralize Kotlin versions.

## Source excerpt

This post is inspired by a discussion on the Gradle community slack. Many thanks to @Vampire and @ephemient for their help understanding all of this Have you ever tried to do something like this? val kotlinVersion = "1.7.21" plugins { id("org.j...