From 557bf1dcc78633680222676e5d974425f23da752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolf=20Montwe=CC=81?= Date: Mon, 13 Feb 2023 16:02:16 +0100 Subject: [PATCH] Add build-plugin --- build-plugin/build.gradle.kts | 11 ++++++++++ build-plugin/settings.gradle.kts | 21 +++++++++++++++++++ .../src/main/kotlin/ProjectExtension.kt | 6 ++++++ settings.gradle.kts | 2 ++ 4 files changed, 40 insertions(+) create mode 100644 build-plugin/build.gradle.kts create mode 100644 build-plugin/settings.gradle.kts create mode 100644 build-plugin/src/main/kotlin/ProjectExtension.kt diff --git a/build-plugin/build.gradle.kts b/build-plugin/build.gradle.kts new file mode 100644 index 000000000..cf9ed6405 --- /dev/null +++ b/build-plugin/build.gradle.kts @@ -0,0 +1,11 @@ +plugins { + `kotlin-dsl` +} + +dependencies { + implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) +} + +fun plugin(provider: Provider) = with(provider.get()) { + "$pluginId:$pluginId.gradle.plugin:$version" +} diff --git a/build-plugin/settings.gradle.kts b/build-plugin/settings.gradle.kts new file mode 100644 index 000000000..46a867ddc --- /dev/null +++ b/build-plugin/settings.gradle.kts @@ -0,0 +1,21 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} + +dependencyResolutionManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } + + versionCatalogs.create("libs") { + from(files("../gradle/libs.versions.toml")) + } +} + +rootProject.name = "build-plugin" diff --git a/build-plugin/src/main/kotlin/ProjectExtension.kt b/build-plugin/src/main/kotlin/ProjectExtension.kt new file mode 100644 index 000000000..916ab22a0 --- /dev/null +++ b/build-plugin/src/main/kotlin/ProjectExtension.kt @@ -0,0 +1,6 @@ +import org.gradle.accessors.dm.LibrariesForLibs +import org.gradle.api.Project +import org.gradle.kotlin.dsl.getByName + +val Project.libs: LibrariesForLibs + get() = extensions.getByName("libs") diff --git a/settings.gradle.kts b/settings.gradle.kts index e7f79efef..6f3e687fe 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -15,6 +15,8 @@ dependencyResolutionManagement { } } +includeBuild("build-plugin") + include(":app:k9mail") include(":app:ui:base") include(":app:ui:setup")