Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
Use alias instead of id when specifying plugins (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
SanmerDev committed Nov 9, 2023
1 parent a79f0a1 commit 3baed68
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 21 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import com.android.build.gradle.internal.api.ApkVariantOutputImpl

plugins {
id("geomag.android.application")
id("geomag.android.application.compose")
id("geomag.android.hilt")
id("geomag.android.room")
alias(libs.plugins.pro.application)
alias(libs.plugins.pro.compose)
alias(libs.plugins.pro.hilt)
alias(libs.plugins.pro.room)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.ksp)
alias(libs.plugins.protobuf)
Expand Down
24 changes: 12 additions & 12 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ dependencies {

gradlePlugin {
plugins {
register("androidApplication") {
id = "geomag.android.application"
implementationClass = "AndroidApplicationConventionPlugin"
register("proApplication") {
id = "pro.application"
implementationClass = "ApplicationConventionPlugin"
}

register("androidApplicationCompose") {
id = "geomag.android.application.compose"
implementationClass = "AndroidApplicationComposeConventionPlugin"
register("proCompose") {
id = "pro.compose"
implementationClass = "ComposeConventionPlugin"
}

register("androidHilt") {
id = "geomag.android.hilt"
implementationClass = "AndroidHiltConventionPlugin"
register("proHilt") {
id = "pro.hilt"
implementationClass = "HiltConventionPlugin"
}

register("androidRoom") {
id = "geomag.android.room"
implementationClass = "AndroidRoomConventionPlugin"
register("proRoom") {
id = "pro.room"
implementationClass = "RoomConventionPlugin"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.kotlin.dsl.configure
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension

class AndroidApplicationConventionPlugin : Plugin<Project> {
class ApplicationConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType

class AndroidApplicationComposeConventionPlugin : Plugin<Project> {
class ComposeConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType

class AndroidHiltConventionPlugin : Plugin<Project> {
class HiltConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType

class AndroidRoomConventionPlugin : Plugin<Project> {
class RoomConventionPlugin : Plugin<Project> {

override fun apply(target: Project) {
with(target) {
Expand Down
6 changes: 6 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,9 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" }

# Plugins defined by this project
pro-application = { id = "pro.application", version = "unspecified" }
pro-compose = { id = "pro.compose", version = "unspecified" }
pro-hilt = { id = "pro.hilt", version = "unspecified" }
pro-room = { id = "pro.room", version = "unspecified" }
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencyResolutionManagement {
}

pluginManagement {
includeBuild("build-logic")
repositories {
google()
mavenCentral()
Expand All @@ -20,4 +21,3 @@ pluginManagement {

rootProject.name = "Geomag"
include(":app")
includeBuild("build-logic")

0 comments on commit 3baed68

Please sign in to comment.