Added even more tweaks to convention plugins setup

This commit is contained in:
Arty Bishop committed 2026-03-28 20:03:11 +00:00
1 parent e2bf2a09a4
commit 8c1df334d8
18 files changed
+142 -171

No files matched your search

+1 -1
View File
@@ -1,3 +1,3 @@
plugins { plugins {
alias(libs.plugins.convention.androidAppPlugin) alias(libs.plugins.convention.applicationPlugin)
} }
+15 -15
View File
@@ -24,25 +24,25 @@ group = "com.rtbishop.look4sat.build_logic.convention"
gradlePlugin { gradlePlugin {
plugins { plugins {
register("androidAppPlugin") { register("applicationPlugin") {
id = libs.plugins.convention.androidAppPlugin.get().pluginId id = libs.plugins.convention.applicationPlugin.get().pluginId
implementationClass = "com.rtbishop.look4sat.convention.AndroidAppPlugin" implementationClass = "com.rtbishop.look4sat.convention.ApplicationPlugin"
} }
register("androidLibraryPlugin") { register("coreDataPlugin") {
id = libs.plugins.convention.androidLibraryPlugin.get().pluginId id = libs.plugins.convention.coreDataPlugin.get().pluginId
implementationClass = "com.rtbishop.look4sat.convention.AndroidLibraryPlugin" implementationClass = "com.rtbishop.look4sat.convention.CoreDataPlugin"
} }
register("composeFeaturePlugin") { register("coreDomainPlugin") {
id = libs.plugins.convention.composeFeaturePlugin.get().pluginId id = libs.plugins.convention.coreDomainPlugin.get().pluginId
implementationClass = "com.rtbishop.look4sat.convention.ComposeFeaturePlugin" implementationClass = "com.rtbishop.look4sat.convention.CoreDomainPlugin"
} }
register("composeLibraryPlugin") { register("corePresentationPlugin") {
id = libs.plugins.convention.composeLibraryPlugin.get().pluginId id = libs.plugins.convention.corePresentationPlugin.get().pluginId
implementationClass = "com.rtbishop.look4sat.convention.ComposeLibraryPlugin" implementationClass = "com.rtbishop.look4sat.convention.CorePresentationPlugin"
} }
register("kotlinLibraryPlugin") { register("featurePlugin") {
id = libs.plugins.convention.kotlinLibraryPlugin.get().pluginId id = libs.plugins.convention.featurePlugin.get().pluginId
implementationClass = "com.rtbishop.look4sat.convention.KotlinLibraryPlugin" implementationClass = "com.rtbishop.look4sat.convention.FeaturePlugin"
} }
} }
} }
@@ -1,46 +0,0 @@
/*
* Look4Sat. Amateur radio satellite tracker and pass predictor.
* Copyright (C) 2019-2026 Arty Bishop and contributors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.rtbishop.look4sat.convention
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
@Suppress("Unused")
internal class AndroidAppPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
setupAndroidApplication()
setupComposeFeature()
setupKotlinToolchain()
setupAndroidTestDependencies()
setupTestDependencies()
dependencies {
IMPLEMENTATION(project(":core:data"))
IMPLEMENTATION(project(":core:domain"))
IMPLEMENTATION(project(":core:presentation"))
IMPLEMENTATION(project(":feature:map"))
IMPLEMENTATION(project(":feature:passes"))
IMPLEMENTATION(project(":feature:radar"))
IMPLEMENTATION(project(":feature:satellites"))
IMPLEMENTATION(project(":feature:settings"))
IMPLEMENTATION(libs.androidx.core.splashscreen)
}
}
}
}
@@ -22,25 +22,22 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies import org.gradle.kotlin.dsl.dependencies
@Suppress("Unused") @Suppress("Unused")
internal class AndroidLibraryPlugin : Plugin<Project> { internal class ApplicationPlugin : Plugin<Project> {
override fun apply(target: Project) { override fun apply(target: Project) = with(target) {
with(target) { setupAndroidApp()
with(pluginManager) { setupCompose()
alias(libs.plugins.google.ksp) setupKotlin()
} dependencies {
setupCommonLibrary() implementation(project(":core:data"))
setupKotlinToolchain() implementation(project(":core:domain"))
setupAndroidTestDependencies() implementation(project(":core:presentation"))
setupTestDependencies() implementation(project(":feature:map"))
dependencies { implementation(project(":feature:passes"))
IMPLEMENTATION(project(":core:domain")) implementation(project(":feature:radar"))
IMPLEMENTATION(libs.androidx.core.ktx) implementation(project(":feature:satellites"))
IMPLEMENTATION(libs.androidx.room.asProvider()) implementation(project(":feature:settings"))
IMPLEMENTATION(libs.androidx.room.runtime) implementation(libs.androidx.core.splashscreen)
KSP(libs.androidx.room.compiler) androidTestImplementation(libs.bundles.androidTest)
IMPLEMENTATION(libs.other.coroutines)
IMPLEMENTATION(libs.other.okhttp)
}
} }
} }
} }
@@ -0,0 +1,40 @@
/*
* Look4Sat. Amateur radio satellite tracker and pass predictor.
* Copyright (C) 2019-2026 Arty Bishop and contributors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.rtbishop.look4sat.convention
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
@Suppress("Unused")
internal class CoreDataPlugin : Plugin<Project> {
override fun apply(target: Project) = with(target) {
applyPlugin(libs.plugins.google.ksp)
setupAndroidLib()
setupKotlin()
dependencies {
implementation(project(":core:domain"))
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.room)
implementation(libs.androidx.room.runtime)
ksp(libs.androidx.room.compiler)
implementation(libs.other.coroutines)
implementation(libs.other.okhttp)
}
}
}
@@ -22,18 +22,13 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies import org.gradle.kotlin.dsl.dependencies
@Suppress("Unused") @Suppress("Unused")
internal class KotlinLibraryPlugin : Plugin<Project> { internal class CoreDomainPlugin : Plugin<Project> {
override fun apply(target: Project) { override fun apply(target: Project) = with(target) {
with(target) { applyPlugin(libs.plugins.kotlin.jvm)
with(pluginManager) { setupKotlin()
alias(libs.plugins.kotlin.jvm) dependencies {
} implementation(libs.other.coroutines)
setupKotlinToolchain() implementation(libs.other.json)
setupTestDependencies()
dependencies {
IMPLEMENTATION(libs.other.coroutines)
IMPLEMENTATION(libs.other.json)
}
} }
} }
} }
@@ -22,18 +22,14 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies import org.gradle.kotlin.dsl.dependencies
@Suppress("Unused") @Suppress("Unused")
internal class ComposeFeaturePlugin : Plugin<Project> { internal class CorePresentationPlugin : Plugin<Project> {
override fun apply(target: Project) { override fun apply(target: Project) = with(target) {
with(target) { setupAndroidLib()
setupCommonLibrary() setupCompose()
setupComposeFeature() setupKotlin()
setupKotlinToolchain() dependencies {
setupAndroidTestDependencies() implementation(project(":core:domain"))
setupTestDependencies() implementation(libs.androidx.core.splashscreen)
dependencies {
IMPLEMENTATION(project(":core:domain"))
IMPLEMENTATION(project(":core:presentation"))
}
} }
} }
} }
@@ -22,18 +22,14 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies import org.gradle.kotlin.dsl.dependencies
@Suppress("Unused") @Suppress("Unused")
internal class ComposeLibraryPlugin : Plugin<Project> { internal class FeaturePlugin : Plugin<Project> {
override fun apply(target: Project) { override fun apply(target: Project) = with(target) {
with(target) { setupAndroidLib()
setupCommonLibrary() setupCompose()
setupComposeFeature() setupKotlin()
setupKotlinToolchain() dependencies {
setupAndroidTestDependencies() implementation(project(":core:domain"))
setupTestDependencies() implementation(project(":core:presentation"))
dependencies {
IMPLEMENTATION(project(":core:domain"))
IMPLEMENTATION(libs.androidx.core.splashscreen)
}
} }
} }
} }
@@ -21,7 +21,7 @@ import com.android.build.api.dsl.ApplicationExtension
import com.android.build.api.dsl.CommonExtension import com.android.build.api.dsl.CommonExtension
import org.gradle.accessors.dm.LibrariesForLibs import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.plugins.PluginManager import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.provider.Provider import org.gradle.api.provider.Provider
import org.gradle.kotlin.dsl.accessors.runtime.extensionOf import org.gradle.kotlin.dsl.accessors.runtime.extensionOf
import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.configure
@@ -29,23 +29,30 @@ import org.gradle.kotlin.dsl.dependencies
import org.gradle.plugin.use.PluginDependency import org.gradle.plugin.use.PluginDependency
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
internal const val ANDROID_TEST_IMPLEMENTATION = "androidTestImplementation"
internal const val DEBUG_IMPLEMENTATION = "debugImplementation"
internal const val IMPLEMENTATION = "implementation"
internal const val KSP = "ksp"
internal const val TEST_IMPLEMENTATION = "testImplementation"
internal val Project.libs internal val Project.libs
get(): LibrariesForLibs = extensionOf(this, "libs") as LibrariesForLibs get(): LibrariesForLibs = extensionOf(this, "libs") as LibrariesForLibs
internal fun PluginManager.alias(notation: Provider<PluginDependency>) { internal fun Project.applyPlugin(notation: Provider<PluginDependency>) {
apply(notation.get().pluginId) pluginManager.apply(notation.get().pluginId)
} }
internal fun Project.setupAndroidApplication() { internal fun DependencyHandler.implementation(dependencyNotation: Any) =
with(pluginManager) { add("implementation", dependencyNotation)
alias(libs.plugins.android.application)
} internal fun DependencyHandler.debugImplementation(dependencyNotation: Any) =
add("debugImplementation", dependencyNotation)
internal fun DependencyHandler.testImplementation(dependencyNotation: Any) =
add("testImplementation", dependencyNotation)
internal fun DependencyHandler.androidTestImplementation(dependencyNotation: Any) =
add("androidTestImplementation", dependencyNotation)
internal fun DependencyHandler.ksp(dependencyNotation: Any) =
add("ksp", dependencyNotation)
internal fun Project.setupAndroidApp() {
applyPlugin(libs.plugins.android.application)
extensions.configure<ApplicationExtension> { extensions.configure<ApplicationExtension> {
namespace = libs.versions.packageName.get() namespace = libs.versions.packageName.get()
compileSdk = libs.versions.compileSdk.get().toInt() compileSdk = libs.versions.compileSdk.get().toInt()
@@ -55,9 +62,6 @@ internal fun Project.setupAndroidApplication() {
versionCode = libs.versions.appVersionCode.get().toInt() versionCode = libs.versions.appVersionCode.get().toInt()
versionName = libs.versions.appVersionName.get() versionName = libs.versions.appVersionName.get()
} }
buildFeatures {
compose = true
}
buildTypes { buildTypes {
debug { debug {
applicationIdSuffix = ".debug" applicationIdSuffix = ".debug"
@@ -76,43 +80,32 @@ internal fun Project.setupAndroidApplication() {
} }
} }
internal fun Project.setupCommonLibrary() { internal fun Project.setupAndroidLib() {
with(pluginManager) { applyPlugin(libs.plugins.android.library)
alias(libs.plugins.android.library)
}
extensions.configure<CommonExtension> { extensions.configure<CommonExtension> {
compileSdk = libs.versions.compileSdk.get().toInt() compileSdk = libs.versions.compileSdk.get().toInt()
defaultConfig.minSdk = libs.versions.minSdk.get().toInt() defaultConfig.minSdk = libs.versions.minSdk.get().toInt()
} }
dependencies {
androidTestImplementation(libs.bundles.androidTest)
}
} }
internal fun Project.setupComposeFeature() { internal fun Project.setupCompose() {
with(pluginManager) { applyPlugin(libs.plugins.compose.compiler)
alias(libs.plugins.compose.compiler)
}
extensions.configure<CommonExtension> { extensions.configure<CommonExtension> {
buildFeatures.compose = true buildFeatures.compose = true
} }
dependencies { dependencies {
IMPLEMENTATION(platform(libs.compose.bom)) implementation(platform(libs.compose.bom))
IMPLEMENTATION(libs.bundles.composeAll) implementation(libs.bundles.composeAll)
DEBUG_IMPLEMENTATION(libs.bundles.composeDebug) debugImplementation(libs.bundles.composeDebug)
} }
} }
internal fun Project.setupKotlinToolchain() { internal fun Project.setupKotlin() {
kotlinExtension.jvmToolchain(libs.versions.jdkVersion.get().toInt()) kotlinExtension.jvmToolchain(libs.versions.jdkVersion.get().toInt())
}
internal fun Project.setupAndroidTestDependencies() {
dependencies { dependencies {
ANDROID_TEST_IMPLEMENTATION(libs.bundles.androidTest) testImplementation(libs.bundles.unitTest)
}
}
internal fun Project.setupTestDependencies() {
dependencies {
TEST_IMPLEMENTATION(libs.test.coroutines)
TEST_IMPLEMENTATION(libs.test.junit4)
} }
} }
+1 -1
View File
@@ -1,5 +1,5 @@
plugins { plugins {
alias(libs.plugins.convention.androidLibraryPlugin) alias(libs.plugins.convention.coreDataPlugin)
} }
android { android {
+1 -1
View File
@@ -1,3 +1,3 @@
plugins { plugins {
alias(libs.plugins.convention.kotlinLibraryPlugin) alias(libs.plugins.convention.coreDomainPlugin)
} }
+1 -1
View File
@@ -1,5 +1,5 @@
plugins { plugins {
alias(libs.plugins.convention.composeLibraryPlugin) alias(libs.plugins.convention.corePresentationPlugin)
} }
android { android {
+1 -1
View File
@@ -1,5 +1,5 @@
plugins { plugins {
alias(libs.plugins.convention.composeFeaturePlugin) alias(libs.plugins.convention.featurePlugin)
} }
android { android {
+1 -1
View File
@@ -1,5 +1,5 @@
plugins { plugins {
alias(libs.plugins.convention.composeFeaturePlugin) alias(libs.plugins.convention.featurePlugin)
} }
android { android {
+1 -1
View File
@@ -1,5 +1,5 @@
plugins { plugins {
alias(libs.plugins.convention.composeFeaturePlugin) alias(libs.plugins.convention.featurePlugin)
} }
android { android {
+1 -1
View File
@@ -1,5 +1,5 @@
plugins { plugins {
alias(libs.plugins.convention.composeFeaturePlugin) alias(libs.plugins.convention.featurePlugin)
} }
android { android {
+1 -1
View File
@@ -1,5 +1,5 @@
plugins { plugins {
alias(libs.plugins.convention.composeFeaturePlugin) alias(libs.plugins.convention.featurePlugin)
} }
android { android {
+7 -7
View File
@@ -12,7 +12,7 @@ jdkVersion = "17"
#noinspection UnusedVersionCatalogEntry #noinspection UnusedVersionCatalogEntry
packageName = "com.rtbishop.look4sat" packageName = "com.rtbishop.look4sat"
android-gradle-plugin = "9.0.1" android-gradle-plugin = "9.1.0"
google-ksp = "2.3.6" google-ksp = "2.3.6"
kotlin = "2.3.20" kotlin = "2.3.20"
@@ -20,7 +20,7 @@ androidx-core-ktx = "1.18.0"
androidx-core-splashscreen = "1.2.0" androidx-core-splashscreen = "1.2.0"
androidx-room = "2.8.4" androidx-room = "2.8.4"
compose-bom = "2026.03.00" compose-bom = "2026.03.01"
compose-activity = "1.13.0" compose-activity = "1.13.0"
compose-lifecycle = "2.10.0" compose-lifecycle = "2.10.0"
compose-navigation = "2.9.7" compose-navigation = "2.9.7"
@@ -88,11 +88,11 @@ compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "
google-ksp = { id = "com.google.devtools.ksp", version.ref = "google-ksp" } google-ksp = { id = "com.google.devtools.ksp", version.ref = "google-ksp" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
# plugins defined by this project # plugins defined by this project
convention-androidAppPlugin = { id = "com.rtbishop.look4sat.convention.androidAppPlugin" } convention-applicationPlugin = { id = "com.rtbishop.look4sat.convention.applicationPlugin" }
convention-androidLibraryPlugin = { id = "com.rtbishop.look4sat.convention.androidLibraryPlugin" } convention-coreDataPlugin = { id = "com.rtbishop.look4sat.convention.coreDataPlugin" }
convention-composeFeaturePlugin = { id = "com.rtbishop.look4sat.convention.composeFeaturePlugin" } convention-coreDomainPlugin = { id = "com.rtbishop.look4sat.convention.coreDomainPlugin" }
convention-composeLibraryPlugin = { id = "com.rtbishop.look4sat.convention.composeLibraryPlugin" } convention-corePresentationPlugin = { id = "com.rtbishop.look4sat.convention.corePresentationPlugin" }
convention-kotlinLibraryPlugin = { id = "com.rtbishop.look4sat.convention.kotlinLibraryPlugin" } convention-featurePlugin = { id = "com.rtbishop.look4sat.convention.featurePlugin" }
[bundles] [bundles]
#noinspection UnusedVersionCatalogEntry #noinspection UnusedVersionCatalogEntry