Skip to content

Commit

Permalink
move applying plugins to the base plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielittner committed Sep 22, 2023
1 parent c49be97 commit e555093
Show file tree
Hide file tree
Showing 19 changed files with 21 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.freeletics.gradle.plugin

import org.gradle.api.Plugin
import org.gradle.api.Project

public abstract class FreeleticsAndroidAppBasePlugin : Plugin<Project> {

override fun apply(target: Project) {
target.plugins.apply("com.android.application")
target.plugins.apply(FreeleticsAndroidBasePlugin::class.java)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import org.gradle.api.tasks.testing.Test
public abstract class FreeleticsAndroidBasePlugin : Plugin<Project> {

override fun apply(target: Project) {
if (!target.plugins.hasPlugin("com.android.application")) {
target.plugins.apply("com.android.library")
}
target.plugins.apply("org.jetbrains.kotlin.android")
target.plugins.apply(FreeleticsBasePlugin::class.java)

target.freeleticsExtension.extensions.create("android", FreeleticsAndroidExtension::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
public abstract class FreeleticsBasePlugin : Plugin<Project> {

override fun apply(target: Project) {
target.plugins.apply("com.autonomousapps.dependency-analysis")

target.extensions.create("freeletics", FreeleticsBaseExtension::class.java)

target.makeJarsReproducible()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.gradle.api.tasks.testing.Test
public abstract class FreeleticsJvmBasePlugin : Plugin<Project> {

override fun apply(target: Project) {
target.plugins.apply("org.jetbrains.kotlin.jvm")
target.plugins.apply(FreeleticsBasePlugin::class.java)

target.freeleticsExtension.extensions.create("jvm", FreeleticsJvmExtension::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import org.gradle.api.Project
public abstract class FreeleticsAndroidAppPlugin : Plugin<Project> {

override fun apply(target: Project) {
target.plugins.apply("com.android.application")
target.plugins.apply("org.jetbrains.kotlin.android")
target.plugins.apply(FreeleticsAndroidBasePlugin::class.java)
target.plugins.apply("com.autonomousapps.dependency-analysis")
target.plugins.apply(FreeleticsAndroidAppBasePlugin::class.java)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import org.gradle.api.Project
public abstract class FreeleticsAndroidPlugin : Plugin<Project> {

override fun apply(target: Project) {
target.plugins.apply("com.android.library")
target.plugins.apply("org.jetbrains.kotlin.android")
target.plugins.apply(FreeleticsAndroidBasePlugin::class.java)
target.plugins.apply("com.autonomousapps.dependency-analysis")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ public abstract class FreeleticsGradlePluginPlugin : Plugin<Project> {

override fun apply(target: Project) {
target.plugins.apply("java-gradle-plugin")
target.plugins.apply("org.jetbrains.kotlin.jvm")
target.plugins.apply(FreeleticsJvmBasePlugin::class.java)
target.plugins.apply("com.gradleup.gr8")
target.plugins.apply("com.autonomousapps.dependency-analysis")
target.plugins.apply("com.autonomousapps.plugin-best-practices-plugin")

target.kotlin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import org.gradle.api.Project
public abstract class FreeleticsJvmPlugin : Plugin<Project> {

override fun apply(target: Project) {
target.plugins.apply("org.jetbrains.kotlin.jvm")
target.plugins.apply(FreeleticsJvmBasePlugin::class.java)
target.plugins.apply("com.autonomousapps.dependency-analysis")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public abstract class FreeleticsMultiplatformExtension(private val project: Proj
publish: Boolean = false,
configure: KotlinAndroidTarget.() -> Unit = { },
) {
project.plugins.apply("com.android.library")
project.plugins.apply(FreeleticsAndroidBasePlugin::class.java)

project.kotlinMultiplatform {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public abstract class FreeleticsMultiplatformPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply("org.jetbrains.kotlin.multiplatform")
target.plugins.apply(FreeleticsBasePlugin::class.java)
target.plugins.apply("com.autonomousapps.dependency-analysis")

target.freeleticsExtension.extensions.create("multiplatform", FreeleticsMultiplatformExtension::class.java)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import org.gradle.api.Project

public abstract class AppPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply("com.android.application")
target.plugins.apply("org.jetbrains.kotlin.android")
target.plugins.apply(FreeleticsAndroidBasePlugin::class.java)
target.plugins.apply("com.autonomousapps.dependency-analysis")
target.plugins.apply(FreeleticsAndroidAppBasePlugin::class.java)

target.freeleticsExtension.extensions.create("app", AppExtension::class.java)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import org.gradle.api.Project

public abstract class CoreAndroidPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply("com.android.library")
target.plugins.apply("org.jetbrains.kotlin.android")
target.plugins.apply(FreeleticsAndroidBasePlugin::class.java)
target.plugins.apply("com.autonomousapps.dependency-analysis")

target.freeleticsAndroidExtension.enableParcelize()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import org.gradle.api.Project

public abstract class CoreKotlinPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply("org.jetbrains.kotlin.jvm")
target.plugins.apply(FreeleticsJvmBasePlugin::class.java)
target.plugins.apply("com.autonomousapps.dependency-analysis")

target.freeleticsJvmExtension.useAndroidLint()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ import org.gradle.api.Project

public abstract class DomainAndroidPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply("com.android.library")
target.plugins.apply("org.jetbrains.kotlin.android")
target.plugins.apply(FreeleticsAndroidBasePlugin::class.java)
target.plugins.apply("com.autonomousapps.dependency-analysis")

val extension = target.freeleticsExtension.extensions.create("legacy", LegacyExtension::class.java)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import org.gradle.api.Project

public abstract class DomainKotlinPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply("org.jetbrains.kotlin.jvm")
target.plugins.apply(FreeleticsJvmBasePlugin::class.java)
target.plugins.apply("com.autonomousapps.dependency-analysis")

val extension = target.freeleticsExtension.extensions.create("legacy", LegacyExtension::class.java)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import org.gradle.api.Project

public abstract class FeaturePlugin : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply("com.android.library")
target.plugins.apply("org.jetbrains.kotlin.android")
target.plugins.apply(FreeleticsAndroidBasePlugin::class.java)
target.plugins.apply("com.autonomousapps.dependency-analysis")

val extension = target.freeleticsExtension.extensions.create("legacy", LegacyExtension::class.java)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import org.gradle.api.Project

public abstract class LegacyAndroidPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply("com.android.library")
target.plugins.apply("org.jetbrains.kotlin.android")
target.plugins.apply(FreeleticsAndroidBasePlugin::class.java)
target.plugins.apply("com.autonomousapps.dependency-analysis")

target.freeleticsAndroidExtension.enableAndroidResources()
target.freeleticsAndroidExtension.enableParcelize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import org.gradle.api.Project

public abstract class LegacyKotlinPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply("org.jetbrains.kotlin.jvm")
target.plugins.apply(FreeleticsJvmBasePlugin::class.java)
target.plugins.apply("com.autonomousapps.dependency-analysis")

target.freeleticsJvmExtension.useAndroidLint()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import org.gradle.api.Project

public abstract class NavPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply("com.android.library")
target.plugins.apply("org.jetbrains.kotlin.android")
target.plugins.apply(FreeleticsAndroidBasePlugin::class.java)
target.plugins.apply("com.autonomousapps.dependency-analysis")

target.freeleticsAndroidExtension.minSdkVersion(target.appType()?.minSdkVersion(target))
target.freeleticsAndroidExtension.enableParcelize()
Expand Down

0 comments on commit e555093

Please sign in to comment.