Added more tweaks to convention plugins setup

This commit is contained in:
Arty Bishop committed 2026-03-18 15:59:55 +00:00
1 parent c1966442a7
commit 082b52c58b
14 files changed
+80 -269

No files matched your search

-4
View File
@@ -1,7 +1,3 @@
plugins {
alias(libs.plugins.convention.androidAppPlugin)
}
android {
namespace = "com.rtbishop.look4sat"
}
-18
View File
@@ -1,8 +1,6 @@
import org.gradle.initialization.DependenciesAccessors
import org.gradle.kotlin.dsl.support.serviceOf
//import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`kotlin-dsl`
}
@@ -10,7 +8,6 @@ plugins {
dependencies {
compileOnly(libs.android.gradlePlugin)
compileOnly(libs.kotlin.gradlePlugin)
gradle.serviceOf<DependenciesAccessors>().classes.asFiles.forEach {
compileOnly(files(it.absolutePath))
}
@@ -25,21 +22,6 @@ tasks {
group = "com.rtbishop.look4sat.build_logic.convention"
//kotlin {
// jvmToolchain(libs.versions.jdkVersion.get().toInt())
//}
//java {
// sourceCompatibility = JavaVersion.VERSION_17
// targetCompatibility = JavaVersion.VERSION_17
//}
//
//tasks.withType<KotlinCompile>().configureEach {
// kotlinOptions {
// jvmTarget = JavaVersion.VERSION_17.toString()
// }
//}
gradlePlugin {
plugins {
register("androidAppPlugin") {
@@ -17,44 +17,29 @@
*/
package com.rtbishop.look4sat.convention
import com.android.build.api.dsl.ApplicationExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
@Suppress("Unused")
class AndroidAppPlugin : Plugin<Project> {
internal class AndroidAppPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
alias(libs.plugins.android.application)
alias(libs.plugins.compose.compiler)
}
configureKotlinLibrary()
extensions.configure<ApplicationExtension> {
configureAndroidApp(this)
}
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)
IMPLEMENTATION(platform(libs.compose.bom))
IMPLEMENTATION(libs.bundles.composeAll)
IMPLEMENTATION(libs.other.osmdroid)
DEBUG_IMPLEMENTATION(libs.bundles.composeDebug)
TEST_IMPLEMENTATION(libs.test.coroutines)
TEST_IMPLEMENTATION(libs.test.junit4)
ANDROID_TEST_IMPLEMENTATION(libs.bundles.androidTest)
}
}
}
@@ -17,39 +17,29 @@
*/
package com.rtbishop.look4sat.convention
import com.android.build.api.dsl.LibraryExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
@Suppress("Unused")
class AndroidLibraryPlugin : Plugin<Project> {
internal class AndroidLibraryPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
alias(libs.plugins.android.library)
alias(libs.plugins.google.ksp)
}
// setupAndroidModule(isApplication = false)
// setupBaseDependencies()
configureKotlinLibrary()
extensions.configure<LibraryExtension> {
configureAndroidLibrary(this)
}
setupCommonLibrary()
setupKotlinToolchain()
setupAndroidTestDependencies()
setupTestDependencies()
dependencies {
IMPLEMENTATION(project(":core:domain"))
IMPLEMENTATION(libs.androidx.core.ktx)
IMPLEMENTATION(libs.androidx.room.asProvider())
IMPLEMENTATION(libs.androidx.room.runtime)
KSP(libs.androidx.room.compiler)
IMPLEMENTATION(libs.other.coroutines)
IMPLEMENTATION(libs.other.okhttp)
TEST_IMPLEMENTATION(libs.test.coroutines)
TEST_IMPLEMENTATION(libs.test.junit4)
ANDROID_TEST_IMPLEMENTATION(libs.bundles.androidTest)
}
}
}
@@ -17,47 +17,22 @@
*/
package com.rtbishop.look4sat.convention
import com.android.build.api.dsl.LibraryExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
@Suppress("Unused")
class ComposeFeaturePlugin : Plugin<Project> {
internal class ComposeFeaturePlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
alias(libs.plugins.android.library)
alias(libs.plugins.compose.compiler)
}
configureKotlinLibrary()
extensions.configure<LibraryExtension> {
configureAndroidLibrary(this)
configureComposeFeature(this)
}
setupCommonLibrary()
setupComposeFeature()
setupKotlinToolchain()
setupAndroidTestDependencies()
setupTestDependencies()
dependencies {
IMPLEMENTATION(project(":core:domain"))
IMPLEMENTATION(project(":core:presentation"))
IMPLEMENTATION(libs.androidx.core.splashscreen)
IMPLEMENTATION(platform(libs.compose.bom))
IMPLEMENTATION(libs.compose.activity)
IMPLEMENTATION(libs.compose.lifecycle)
IMPLEMENTATION(libs.compose.navigation)
IMPLEMENTATION(libs.compose.viewmodel)
IMPLEMENTATION(libs.compose.animation)
IMPLEMENTATION(libs.compose.material3)
// IMPLEMENTATION(libs.compose.material3.asProvider())
IMPLEMENTATION(libs.compose.material3.navigation)
IMPLEMENTATION(libs.compose.runtime)
IMPLEMENTATION(libs.compose.tooling)
IMPLEMENTATION(libs.other.osmdroid)
DEBUG_IMPLEMENTATION(libs.bundles.composeDebug)
TEST_IMPLEMENTATION(libs.test.coroutines)
TEST_IMPLEMENTATION(libs.test.junit4)
ANDROID_TEST_IMPLEMENTATION(libs.bundles.androidTest)
}
}
}
@@ -17,46 +17,21 @@
*/
package com.rtbishop.look4sat.convention
import com.android.build.api.dsl.LibraryExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
@Suppress("Unused")
class ComposeLibraryPlugin : Plugin<Project> {
internal class ComposeLibraryPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
alias(libs.plugins.android.library)
alias(libs.plugins.compose.compiler)
}
configureKotlinLibrary()
extensions.configure<LibraryExtension> {
configureAndroidLibrary(this)
configureComposeFeature(this)
}
setupCommonLibrary()
setupComposeFeature()
setupKotlinToolchain()
setupAndroidTestDependencies()
setupTestDependencies()
dependencies {
IMPLEMENTATION(project(":core:domain"))
IMPLEMENTATION(libs.androidx.core.splashscreen)
IMPLEMENTATION(platform(libs.compose.bom))
IMPLEMENTATION(libs.compose.activity)
IMPLEMENTATION(libs.compose.lifecycle)
IMPLEMENTATION(libs.compose.navigation)
IMPLEMENTATION(libs.compose.viewmodel)
IMPLEMENTATION(libs.compose.animation)
IMPLEMENTATION(libs.compose.material3)
// IMPLEMENTATION(libs.compose.material3.asProvider())
IMPLEMENTATION(libs.compose.material3.navigation)
IMPLEMENTATION(libs.compose.runtime)
IMPLEMENTATION(libs.compose.tooling)
IMPLEMENTATION(libs.other.osmdroid)
DEBUG_IMPLEMENTATION(libs.bundles.composeDebug)
TEST_IMPLEMENTATION(libs.test.coroutines)
TEST_IMPLEMENTATION(libs.test.junit4)
ANDROID_TEST_IMPLEMENTATION(libs.bundles.androidTest)
}
}
}
@@ -22,18 +22,17 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
@Suppress("Unused")
class KotlinLibraryPlugin : Plugin<Project> {
internal class KotlinLibraryPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
alias(libs.plugins.kotlin.jvm)
}
configureKotlinLibrary()
setupKotlinToolchain()
setupTestDependencies()
dependencies {
implementation(libs.other.coroutines)
implementation(libs.other.json)
testImplementation(libs.test.coroutines)
testImplementation(libs.test.junit4)
IMPLEMENTATION(libs.other.coroutines)
IMPLEMENTATION(libs.other.json)
}
}
}
@@ -18,15 +18,11 @@
package com.rtbishop.look4sat.convention
import com.android.build.api.dsl.ApplicationExtension
import com.android.build.api.dsl.LibraryExtension
import com.android.build.api.dsl.CommonExtension
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.artifacts.MinimalExternalModuleDependency
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.plugins.PluginManager
import org.gradle.api.provider.Provider
import org.gradle.api.provider.ProviderConvertible
import org.gradle.kotlin.dsl.accessors.runtime.extensionOf
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
@@ -40,71 +36,21 @@ internal const val KSP = "ksp"
internal const val TEST_IMPLEMENTATION = "testImplementation"
internal val Project.libs
// get(): VersionCatalog = extensions.getByType<VersionCatalogsExtension>().named("libs")
get(): LibrariesForLibs = extensionOf(this, "libs") as LibrariesForLibs
internal fun Project.configureKotlinLibrary() {
// kotlinExtension.jvmToolchain(libs.findVersion("jdkVersion").get().requiredVersion.toInt())
kotlinExtension.jvmToolchain(libs.versions.jdkVersion.get().toInt())
// tasks.withType(AbstractTestTask::class.java).configureEach { setProperty("failOnNoDiscoveredTests", false) }
}
fun PluginManager.alias(notation: Provider<PluginDependency>) {
internal fun PluginManager.alias(notation: Provider<PluginDependency>) {
apply(notation.get().pluginId)
}
fun PluginManager.alias(notation: ProviderConvertible<PluginDependency>) {
apply(notation.asProvider().get().pluginId)
internal fun Project.setupAndroidApplication() {
with(pluginManager) {
alias(libs.plugins.android.application)
}
fun DependencyHandler.implementation(provider: Provider<MinimalExternalModuleDependency>) {
add("implementation", provider.get().group + ":" + provider.get().name + ":" + provider.get().version)
}
fun DependencyHandler.testImplementation(provider: Provider<MinimalExternalModuleDependency>) {
add("testImplementation", provider.get().group + ":" + provider.get().name + ":" + provider.get().version)
}
fun DependencyHandler.ksp(provider: Provider<MinimalExternalModuleDependency>) {
add("ksp", provider.get().group + ":" + provider.get().name + ":" + provider.get().version)
}
internal fun Project.configureAndroidLibrary(commonExtension: LibraryExtension) {
commonExtension.apply {
extensions.configure<ApplicationExtension> {
namespace = libs.versions.packageName.get()
compileSdk = libs.versions.compileSdk.get().toInt()
defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()
}
// compileOptions { isCoreLibraryDesugaringEnabled = true }
// testOptions {
// unitTests {
// all { it.useJUnitPlatform() }
// isReturnDefaultValues = true
// isIncludeAndroidResources = true
// }
// }
// packaging { resources { excludes += listOf("META-INF/*") } }
// dependencies {
// IMPLEMENTATION(libs.findLibrary("androidx-core").get())
// IMPLEMENTATION(libs.findLibrary("kotlinx-serialization-json").get())
// IMPLEMENTATION(libs.findLibrary("other-timber").get())
// IMPLEMENTATION(libs.findLibrary("google-hilt-android").get())
// KSP(libs.findLibrary("google-hilt-compiler").get())
//
// ANDROID_TEST_IMPLEMENTATION(libs.findBundle("androidTest").get())
// ANDROID_TEST_IMPLEMENTATION(libs.findBundle("unitTest").get())
// CORE_LIBRARY_DESUGARING(libs.findLibrary("other-desugaring").get())
// TEST_IMPLEMENTATION(libs.findBundle("unitTest").get())
// }
}
}
internal fun Project.configureAndroidApp(commonExtension: ApplicationExtension) {
commonExtension.apply {
namespace = "com.rtbishop.look4sat"
compileSdk = libs.versions.compileSdk.get().toInt()
defaultConfig {
applicationId = "com.rtbishop.look4sat"
applicationId = libs.versions.packageName.get()
minSdk = libs.versions.minSdk.get().toInt()
versionCode = libs.versions.appVersionCode.get().toInt()
versionName = libs.versions.appVersionName.get()
@@ -126,84 +72,47 @@ internal fun Project.configureAndroidApp(commonExtension: ApplicationExtension)
generateLocaleConfig = true
localeFilters.addAll(listOf("en", "es", "ru", "si", "uk", "zh"))
}
}
// extensions.configure<ApplicationExtension> {
// namespace = "com.rtbishop.look4sat"
// compileSdk = 36
// defaultConfig {
// applicationId = "com.rtbishop.look4sat"
// minSdk = 24
// versionCode = 410
// versionName = "4.1.0"
// }
// buildFeatures {
// compose = true
// }
// buildTypes {
// debug {
// applicationIdSuffix = ".debug"
// }
// release {
// isMinifyEnabled = true
// isShrinkResources = true
// proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"))
// }
// }
// androidResources {
// generateLocaleConfig = true
// localeFilters.addAll(listOf("en", "es", "ru", "si", "uk", "zh"))
// }
// }
}
internal fun Project.configureComposeFeature(commonExtension: LibraryExtension) {
commonExtension.apply {
buildFeatures { compose = true }
// testOptions { animationsDisabled = true }
dependencies {
// IMPLEMENTATION(platform(libs.findLibrary("compose-bom").get()))
// IMPLEMENTATION(libs.findBundle("composeAll").get())
//
// ANDROID_TEST_IMPLEMENTATION(libs.findBundle("composeDebug").get())
// DEBUG_IMPLEMENTATION(libs.findBundle("composeDebug").get())
// SCREENSHOT_TEST_IMPLEMENTATION(libs.findLibrary("compose-ui-tooling").get())
}
packaging { resources { excludes += listOf("META-INF/*") } }
}
}
fun Project.setupAndroidModule(isApplication: Boolean) {
internal fun Project.setupCommonLibrary() {
with(pluginManager) {
if (isApplication) {
alias(libs.plugins.android.application)
alias(libs.plugins.compose.compiler)
} else {
alias(libs.plugins.android.library)
alias(libs.plugins.google.ksp)
}
}
extensions.configure<ApplicationExtension> {
extensions.configure<CommonExtension> {
compileSdk = libs.versions.compileSdk.get().toInt()
defaultConfig {
minSdk = 26
versionCode = 1
versionName = "1.0"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildTypes {
buildTypes {
maybeCreate("debug")
maybeCreate("release")
named("release") {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
defaultConfig.minSdk = libs.versions.minSdk.get().toInt()
}
}
internal fun Project.setupComposeFeature() {
with(pluginManager) {
alias(libs.plugins.compose.compiler)
}
extensions.configure<CommonExtension> {
buildFeatures.compose = true
}
dependencies {
IMPLEMENTATION(platform(libs.compose.bom))
IMPLEMENTATION(libs.bundles.composeAll)
DEBUG_IMPLEMENTATION(libs.bundles.composeDebug)
}
}
internal fun Project.setupKotlinToolchain() {
kotlinExtension.jvmToolchain(libs.versions.jdkVersion.get().toInt())
}
internal fun Project.setupAndroidTestDependencies() {
dependencies {
ANDROID_TEST_IMPLEMENTATION(libs.bundles.androidTest)
}
}
internal fun Project.setupTestDependencies() {
dependencies {
TEST_IMPLEMENTATION(libs.test.coroutines)
TEST_IMPLEMENTATION(libs.test.junit4)
}
}
-3
View File
@@ -1,5 +1,3 @@
@file:Suppress("UnstableApiUsage")
dependencyResolutionManagement {
repositories {
google()
@@ -13,4 +11,3 @@ dependencyResolutionManagement {
}
rootProject.name = "build-logic"
include(":convention")
//enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
+4
View File
@@ -5,3 +5,7 @@ plugins {
android {
namespace = "com.rtbishop.look4sat.feature.map"
}
dependencies {
implementation(libs.other.osmdroid)
}
-1
View File
@@ -1,5 +1,4 @@
# Configure your build environment: http://www.gradle.org/docs/current/userguide/build_environment.html
android.disallowKotlinSourceSets=false
org.gradle.caching=true
org.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
+6 -4
View File
@@ -9,17 +9,19 @@ compileSdk = "36"
minSdk = "24"
#noinspection UnusedVersionCatalogEntry
jdkVersion = "17"
#noinspection UnusedVersionCatalogEntry
packageName = "com.rtbishop.look4sat"
android-gradle-plugin = "9.0.1"
google-ksp = "2.3.6"
kotlin = "2.3.10"
kotlin = "2.3.20"
androidx-core-ktx = "1.17.0"
androidx-core-ktx = "1.18.0"
androidx-core-splashscreen = "1.2.0"
androidx-room = "2.8.4"
compose-bom = "2026.02.01"
compose-activity = "1.12.4"
compose-bom = "2026.03.00"
compose-activity = "1.13.0"
compose-lifecycle = "2.10.0"
compose-navigation = "2.9.7"
+2 -2
View File
@@ -1,7 +1,7 @@
#Fri Jan 30 17:28:14 GMT 2026
#Fri Mar 13 09:30:16 GMT 2026
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
-2
View File
@@ -1,4 +1,3 @@
@file:Suppress("UnstableApiUsage")
pluginManagement {
includeBuild("build-logic")
repositories {
@@ -28,4 +27,3 @@ include(
":feature:satellites",
":feature:settings"
)
//enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")