Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Gamedge Dagger Hilt plugin #224

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
plugins {
id(libs.plugins.androidApplication.get().pluginId)
id(libs.plugins.gamedgeAndroid.get().pluginId)
id(libs.plugins.kotlinKapt.get().pluginId)
id(libs.plugins.gamedgeDaggerHilt.get().pluginId)

alias(libs.plugins.jetpackCompose)
alias(libs.plugins.ksp)
alias(libs.plugins.daggerHilt)
}

dependencies {
Expand Down Expand Up @@ -57,12 +55,6 @@ dependencies {
implementation(libs.commonsCore)
implementation(libs.commonsKtx)

implementation(libs.daggerHiltAndroid)
kapt(libs.daggerHiltAndroidCompiler)

implementation(libs.hiltBinder)
ksp(libs.hiltBinderCompiler)

testImplementation(libs.jUnit)

androidTestImplementation(libs.jUnitExt)
Expand Down
4 changes: 4 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ gradlePlugin {
id = "com.paulrybitskyi.gamedge.protobuf"
implementationClass = "com.paulrybitskyi.gamedge.plugins.GamedgeProtobufPlugin"
}
create("com.paulrybitskyi.gamedge.dagger.hilt") {
id = "com.paulrybitskyi.gamedge.dagger.hilt"
implementationClass = "com.paulrybitskyi.gamedge.plugins.GamedgeDaggerHiltPlugin"
}
create("com.paulrybitskyi.gamedge.feature") {
id = "com.paulrybitskyi.gamedge.feature"
implementationClass = "com.paulrybitskyi.gamedge.plugins.GamedgeFeaturePlugin"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.paulrybitskyi.gamedge.plugins

import com.paulrybitskyi.gamedge.extensions.libs
import org.gradle.api.Plugin
import org.gradle.api.Project

class GamedgeDaggerHiltPlugin : Plugin<Project> {

override fun apply(project: Project) = with(project) {
setupPlugins()
addDependencies()
}

private fun Project.setupPlugins(): Unit = with(plugins) {
apply(libs.plugins.kotlinKapt.get().pluginId)
apply(libs.plugins.ksp.get().pluginId)
apply(libs.plugins.daggerHilt.get().pluginId)
}

private fun Project.addDependencies(): Unit = with(dependencies) {
add("implementation", libs.daggerHiltAndroid.get())
add("kapt", libs.daggerHiltAndroidCompiler.get())

add("implementation", libs.hiltBinder.get())
add("ksp", libs.hiltBinderCompiler.get())

add("androidTestImplementation", libs.daggerHiltTesting.get())
add("kaptAndroidTest", libs.daggerHiltAndroidCompiler.get())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ class GamedgeFeaturePlugin : Plugin<Project> {
private fun Project.setupPlugins(): Unit = with(plugins) {
apply(libs.plugins.androidLibrary.get().pluginId)
apply(libs.plugins.gamedgeAndroid.get().pluginId)
apply(libs.plugins.kotlinKapt.get().pluginId)
apply(libs.plugins.jetpackCompose.get().pluginId)
apply(libs.plugins.ksp.get().pluginId)
apply(libs.plugins.daggerHilt.get().pluginId)
apply(libs.plugins.gamedgeDaggerHilt.get().pluginId)
}

private fun Project.addDependencies(): Unit = with(dependencies) {
Expand Down Expand Up @@ -46,10 +44,6 @@ class GamedgeFeaturePlugin : Plugin<Project> {
add("implementation", libs.accompanistNavigationAnimations.get())
add("implementation", libs.kotlinResult.get())
add("implementation", libs.coil.get())
add("implementation", libs.daggerHiltAndroid.get())
add("kapt", libs.daggerHiltAndroidCompiler.get())
add("implementation", libs.hiltBinder.get())
add("ksp", libs.hiltBinderCompiler.get())
add("testImplementation", project(localModules.commonTesting))
add("testImplementation", libs.jUnit.get())
add("testImplementation", libs.truth.get())
Expand Down
10 changes: 1 addition & 9 deletions common-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
plugins {
id(libs.plugins.androidLibrary.get().pluginId)
id(libs.plugins.gamedgeAndroid.get().pluginId)
id(libs.plugins.kotlinKapt.get().pluginId)

alias(libs.plugins.ksp)
id(libs.plugins.gamedgeDaggerHilt.get().pluginId)
}

android {
Expand All @@ -41,12 +39,6 @@ dependencies {

implementation(libs.kotlinResult)

implementation(libs.daggerHiltAndroid)
kapt(libs.daggerHiltAndroidCompiler)

implementation(libs.hiltBinder)
ksp(libs.hiltBinderCompiler)

testImplementation(libs.jUnit)
androidTestImplementation(libs.jUnitExt)
}
10 changes: 1 addition & 9 deletions common-data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
plugins {
id(libs.plugins.androidLibrary.get().pluginId)
id(libs.plugins.gamedgeAndroid.get().pluginId)
id(libs.plugins.kotlinKapt.get().pluginId)
id(libs.plugins.gamedgeProtobuf.get().pluginId)

alias(libs.plugins.ksp)
id(libs.plugins.gamedgeDaggerHilt.get().pluginId)
}

android {
Expand All @@ -40,12 +38,6 @@ dependencies {

implementation(libs.kotlinResult)

implementation(libs.daggerHiltAndroid)
kapt(libs.daggerHiltAndroidCompiler)

implementation(libs.hiltBinder)
ksp(libs.hiltBinderCompiler)

testImplementation(project(localModules.commonTesting))
testImplementation(libs.jUnit)
testImplementation(libs.truth)
Expand Down
10 changes: 1 addition & 9 deletions common-ui-widgets/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
plugins {
id(libs.plugins.androidLibrary.get().pluginId)
id(libs.plugins.gamedgeAndroid.get().pluginId)
id(libs.plugins.kotlinKapt.get().pluginId)
id(libs.plugins.gamedgeDaggerHilt.get().pluginId)

alias(libs.plugins.jetpackCompose)
alias(libs.plugins.ksp)
alias(libs.plugins.daggerHilt)
}

android {
Expand All @@ -45,12 +43,6 @@ dependencies {

implementation(libs.coil)

implementation(libs.daggerHiltAndroid)
kapt(libs.daggerHiltAndroidCompiler)

implementation(libs.hiltBinder)
ksp(libs.hiltBinderCompiler)

testImplementation(libs.jUnit)
androidTestImplementation(libs.jUnitExt)
}
9 changes: 1 addition & 8 deletions common-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
plugins {
id(libs.plugins.androidLibrary.get().pluginId)
id(libs.plugins.gamedgeAndroid.get().pluginId)
id(libs.plugins.kotlinKapt.get().pluginId)
id(libs.plugins.gamedgeDaggerHilt.get().pluginId)

alias(libs.plugins.jetpackCompose)
alias(libs.plugins.ksp)
}

android {
Expand All @@ -44,12 +43,6 @@ dependencies {

implementation(libs.coil)

implementation(libs.daggerHiltAndroid)
kapt(libs.daggerHiltAndroidCompiler)

implementation(libs.hiltBinder)
ksp(libs.hiltBinderCompiler)

testImplementation(libs.jUnit)
androidTestImplementation(libs.jUnitExt)
}
10 changes: 1 addition & 9 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
plugins {
id(libs.plugins.androidLibrary.get().pluginId)
id(libs.plugins.gamedgeAndroid.get().pluginId)
id(libs.plugins.kotlinKapt.get().pluginId)

alias(libs.plugins.ksp)
id(libs.plugins.gamedgeDaggerHilt.get().pluginId)
}

android {
Expand All @@ -41,12 +39,6 @@ dependencies {

implementation(libs.kotlinResult)

implementation(libs.daggerHiltAndroid)
kapt(libs.daggerHiltAndroidCompiler)

implementation(libs.hiltBinder)
ksp(libs.hiltBinderCompiler)

testImplementation(project(localModules.commonTesting))
testImplementation(libs.jUnit)
testImplementation(libs.truth)
Expand Down
13 changes: 1 addition & 12 deletions database/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
plugins {
id(libs.plugins.androidLibrary.get().pluginId)
id(libs.plugins.gamedgeAndroid.get().pluginId)
id(libs.plugins.kotlinKapt.get().pluginId)
id(libs.plugins.gamedgeDaggerHilt.get().pluginId)

alias(libs.plugins.ksp)
alias(libs.plugins.daggerHilt)
alias(libs.plugins.kotlinxSerialization)
}

Expand Down Expand Up @@ -53,12 +51,6 @@ dependencies {
implementation(libs.roomKtx)
ksp(libs.roomCompiler)

implementation(libs.daggerHiltAndroid)
kapt(libs.daggerHiltAndroidCompiler)

implementation(libs.hiltBinder)
ksp(libs.hiltBinderCompiler)

testImplementation(project(localModules.commonTesting))
testImplementation(libs.jUnit)
testImplementation(libs.truth)
Expand All @@ -73,7 +65,4 @@ dependencies {
androidTestImplementation(libs.coroutinesTesting)
androidTestImplementation(libs.turbine)
androidTestImplementation(libs.roomTesting)

androidTestImplementation(libs.daggerHiltTesting)
kaptAndroidTest(libs.daggerHiltAndroidCompiler)
}
13 changes: 1 addition & 12 deletions gamespot-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ import com.paulrybitskyi.gamedge.extensions.stringField
plugins {
id(libs.plugins.androidLibrary.get().pluginId)
id(libs.plugins.gamedgeAndroid.get().pluginId)
id(libs.plugins.kotlinKapt.get().pluginId)
id(libs.plugins.gamedgeDaggerHilt.get().pluginId)

alias(libs.plugins.ksp)
alias(libs.plugins.daggerHilt)
alias(libs.plugins.kotlinxSerialization)
}

Expand Down Expand Up @@ -51,12 +49,6 @@ dependencies {

implementation(libs.kotlinResult)

implementation(libs.daggerHiltAndroid)
kapt(libs.daggerHiltAndroidCompiler)

implementation(libs.hiltBinder)
ksp(libs.hiltBinderCompiler)

testImplementation(project(localModules.commonTesting))
testImplementation(libs.jUnit)
testImplementation(libs.truth)
Expand All @@ -67,7 +59,4 @@ dependencies {
androidTestImplementation(libs.jUnitExt)
androidTestImplementation(libs.truth)
androidTestImplementation(libs.mockWebServer)

androidTestImplementation(libs.daggerHiltTesting)
kaptAndroidTest(libs.daggerHiltAndroidCompiler)
}
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ gradleVersions = { id = "com.github.ben-manes.versions", version.ref = "gradleVe
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detektPlugin" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlintPlugin" }
gamedgeAndroid = { id = "com.paulrybitskyi.gamedge.android" }
gamedgeDaggerHilt = { id = "com.paulrybitskyi.gamedge.dagger.hilt" }
gamedgeProtobuf = { id = "com.paulrybitskyi.gamedge.protobuf" }
gamedgeFeature = { id = "com.paulrybitskyi.gamedge.feature" }

Expand Down
13 changes: 1 addition & 12 deletions igdb-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ import com.paulrybitskyi.gamedge.extensions.stringField
plugins {
id(libs.plugins.androidLibrary.get().pluginId)
id(libs.plugins.gamedgeAndroid.get().pluginId)
id(libs.plugins.kotlinKapt.get().pluginId)
id(libs.plugins.gamedgeDaggerHilt.get().pluginId)

alias(libs.plugins.ksp)
alias(libs.plugins.daggerHilt)
alias(libs.plugins.kotlinxSerialization)
}

Expand Down Expand Up @@ -53,12 +51,6 @@ dependencies {

implementation(libs.kotlinResult)

implementation(libs.daggerHiltAndroid)
kapt(libs.daggerHiltAndroidCompiler)

implementation(libs.hiltBinder)
ksp(libs.hiltBinderCompiler)

testImplementation(project(localModules.commonTesting))
testImplementation(libs.jUnit)
testImplementation(libs.truth)
Expand All @@ -69,7 +61,4 @@ dependencies {
androidTestImplementation(libs.jUnitExt)
androidTestImplementation(libs.truth)
androidTestImplementation(libs.mockWebServer)

androidTestImplementation(libs.daggerHiltTesting)
kaptAndroidTest(libs.daggerHiltAndroidCompiler)
}