Skip to content

Commit

Permalink
chore(gradle): create test plugin convention for test modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
GerardPaligot committed Dec 10, 2024
1 parent 78200c5 commit 93b10d5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 20 deletions.
4 changes: 4 additions & 0 deletions build-logic/plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ gradlePlugin {
id = "confily.test.scopes"
implementationClass = "conventions.TestScopesLibraryPlugin"
}
register("testLibrary") {
id = "confily.test"
implementationClass = "conventions.TestLibraryPlugin"
}
register("androidWearLibrary") {
id = "confily.android.wear.library"
implementationClass = "AndroidWearLibraryPlugin"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package conventions

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType
import org.jetbrains.compose.ComposeExtension
import org.jetbrains.compose.ExperimentalComposeLibrary

class TestLibraryPlugin: Plugin<Project> {
@OptIn(ExperimentalComposeLibrary::class)
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("confily.android.library")
apply("confily.android.library.compose")
apply("confily.quality")
}
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
val compose = extensions.getByType<ComposeExtension>()
dependencies {
add("api", project(":android-core:core-test-patterns"))
add("api", libs.findLibrary("androidx-espresso-core").get())
add("api", compose.dependencies.uiTestJUnit4)
}
}
}
}
11 changes: 1 addition & 10 deletions features/schedules/schedules-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
@file:OptIn(ExperimentalComposeLibrary::class)

import org.jetbrains.compose.ExperimentalComposeLibrary

plugins {
id("confily.android.library")
id("confily.android.library.compose")
id("confily.quality")
id("confily.test")
}

android {
Expand All @@ -14,7 +8,4 @@ android {

dependencies {
api(projects.features.schedules.schedulesTestScopes)
api(projects.androidCore.coreTestPatterns)
api(libs.androidx.espresso.core)
api(compose.uiTestJUnit4)
}
11 changes: 1 addition & 10 deletions features/speakers/speakers-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
@file:OptIn(ExperimentalComposeLibrary::class)

import org.jetbrains.compose.ExperimentalComposeLibrary

plugins {
id("confily.android.library")
id("confily.android.library.compose")
id("confily.quality")
id("confily.test")
}

android {
Expand All @@ -14,7 +8,4 @@ android {

dependencies {
api(projects.features.speakers.speakersTestScopes)
api(projects.androidCore.coreTestPatterns)
api(libs.androidx.espresso.core)
api(compose.uiTestJUnit4)
}

0 comments on commit 93b10d5

Please sign in to comment.