Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions build-plugin/README.md → build-logic/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Build plugins
# Build logic

The `build-plugin` project provides a set of Gradle plugins that act as the single source of truth for
The `build-logic` project provides a set of Gradle plugins that act as the single source of truth for
project-wide build configuration. This avoids duplicated build script setups and centralizes common build logic.

## Background

We use an included build to host our build logic as real Gradle plugins (written in Kotlin), not as legacy
`*.gradle.kts` convention scripts. The included build is located at `build-plugin/plugin` and registers plugins
via the Gradle `gradlePlugin` block in `build-plugin/plugin/build.gradle.kts`.
`*.gradle.kts` convention scripts. The included build is located at `build-logic/plugin` and registers plugins
via the Gradle `gradlePlugin` block in `build-logic/plugin/build.gradle.kts`.

You apply these plugins in modules using their fully-qualified plugin IDs. Each plugin focuses on a single
responsibility; one-off configuration should stay in the module’s own `build.gradle.kts`.
Expand Down Expand Up @@ -184,17 +184,17 @@ Alternatively, you may provide equivalent Gradle properties via other supported
These plugins are provided by an included build. The root `settings.gradle.kts` contains:

```
includeBuild("build-plugin")
includeBuild("build-logic")
```

## Creating a new build plugin

1. Create a Kotlin plugin class under `build-plugin/plugin/src/main/kotlin/...`, implementing `Plugin<Project>`.
2. Register it in `build-plugin/plugin/build.gradle.kts` inside the `gradlePlugin { plugins { ... } }` block with a
1. Create a Kotlin plugin class under `build-logic/plugin/src/main/kotlin/...`, implementing `Plugin<Project>`.
2. Register it in `build-logic/plugin/build.gradle.kts` inside the `gradlePlugin { plugins { ... } }` block with a
unique ID and the `implementationClass` pointing to your class.
3. Dependencies:
- Add versions and aliases to the version catalog `gradle/libs.versions.toml` (if not present yet).
- Add the dependency to `build-plugin/plugin/build.gradle.kts`.
- Add the dependency to `build-logic/plugin/build.gradle.kts`.
- Plugin dependency: `implementation(plugin(libs.plugins.YOUR_PLUGIN))`
- Library dependency: `implementation(libs.YOUR_LIBRARY)`

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
plugins {
`kotlin-dsl`
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin

import org.gradle.api.plugins.ExtensionAware
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin

import org.gradle.accessors.dm.LibrariesForLibs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin

import org.gradle.api.JavaVersion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.app.kmp.compose

import com.android.build.api.dsl.ApplicationExtension
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.bom

import org.gradle.api.Plugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog

import java.io.File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog

import kotlin.time.Clock
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog

import net.thunderbird.gradle.plugin.changelog.internal.Changelog
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog

import net.thunderbird.gradle.plugin.changelog.internal.ChangelogEntry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog.internal

import kotlinx.datetime.LocalDate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog.internal

import java.io.File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog.internal.fs

import java.io.File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog.internal.git

import net.thunderbird.gradle.plugin.changelog.internal.SectionType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog.internal.git

import java.io.File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog.internal.git

import net.thunderbird.gradle.plugin.changelog.internal.SectionType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog.internal.parser

import net.thunderbird.gradle.plugin.changelog.internal.Changelog
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog.internal.parser

import net.thunderbird.gradle.plugin.changelog.internal.ChangelogEntry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog.internal.parser

import kotlinx.datetime.LocalDate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog.internal.render

import net.thunderbird.gradle.plugin.changelog.internal.Changelog
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.changelog.internal.render

import kotlinx.datetime.LocalDate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.dependency.check

import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.library.kmp

import com.android.build.api.dsl.KotlinMultiplatformAndroidLibraryTarget
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.library.kmp

import net.thunderbird.gradle.plugin.ProjectConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.library.kmp.compose

import net.thunderbird.gradle.plugin.ProjectConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.publishing

import net.thunderbird.gradle.plugin.ProjectConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.publishing

import com.vanniktech.maven.publish.MavenPublishBaseExtension
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.publishing

import org.gradle.api.DefaultTask
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.quality.coverage

import org.gradle.api.provider.Property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.quality.coverage

import kotlinx.kover.gradle.plugin.KoverGradlePlugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.quality.coverage.filter

import kotlinx.kover.gradle.plugin.dsl.KoverReportFiltersConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.quality.coverage.filter

import kotlinx.kover.gradle.plugin.dsl.KoverReportFiltersConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.quality.coverage.filter

import kotlinx.kover.gradle.plugin.dsl.KoverReportFiltersConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.quality.detekt

import dev.detekt.gradle.Detekt
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package net.thunderbird.gradle.plugin.quality.spotless

val kotlinEditorConfigOverride = mapOf(
"ktlint_code_style" to "intellij_idea",
"ktlint_ignore_back_ticked_identifier" to "true",
"ktlint_function_naming_ignore_when_annotated_with" to "Composable",
"ktlint_standard_class-signature" to "disabled",
"ktlint_standard_function-expression-body" to "disabled",
"ktlint_standard_function-signature" to "disabled",
"ktlint_standard_parameter-list-spacing" to "disabled",
"ktlint_standard_property-naming" to "disabled",
)

val licenseHeaderMpl2 = """
|/*
| * This Source Code Form is subject to the terms of the Mozilla Public
| * License, v. 2.0. If a copy of the MPL was not distributed with this
| * file, You can obtain one at https://mozilla.org/MPL/2.0/.
| */
""".trimMargin()
Loading