Skip to content

Commit

Permalink
Add Retrofit plugin (#445)
Browse files Browse the repository at this point in the history
* Add Retrofit plugin

* Change import of serializaition converter factory

* Remove redundant
  • Loading branch information
l2hyunwoo authored Mar 22, 2024
1 parent db8ba51 commit ac9683a
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ dependencies {
// Third Party
implementation(libs.dot.indicator)
implementation(libs.coil.core)
implementation(libs.bundles.retrofit)
implementation(libs.kakao.login)
implementation(libs.zxing.android.embedded)

Expand Down
4 changes: 4 additions & 0 deletions build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,9 @@ gradlePlugin {
id = "com.teampophory.pophory.compose"
implementationClass = "com.teampophory.pophory.plugin.ComposePlugin"
}
create("retrofit") {
id = "com.teampophory.pophory.retrofit"
implementationClass = "com.teampophory.pophory.plugin.RetrofitPlugin"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal fun Project.configureAndroidCommonPlugin() {

apply<AndroidKotlinPlugin>()
apply<KotlinSerializationPlugin>()
apply<RetrofitPlugin>()
with(plugins) {
apply("kotlin-parcelize")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.teampophory.pophory.plugin

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

class RetrofitPlugin : Plugin<Project> {
override fun apply(target: Project) = with(target) {
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")

dependencies {
"implementation"(platform(libs.findLibrary("retrofit-bom").get()))
"implementation"(libs.findLibrary("retrofit").get())
"implementation"(libs.findLibrary("retrofit-kotlin-serialization-converter").get())
"implementation"(libs.findLibrary("retrofit-response-type-keeper").get())
}
}
}
1 change: 0 additions & 1 deletion core/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ android {

dependencies {
implementation(libs.fragment.ktx)
implementation(libs.retrofit)
}
1 change: 0 additions & 1 deletion core/network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ android {
dependencies {
implementation(projects.core.common)
implementation(libs.security)
implementation(libs.bundles.retrofit)
implementation(platform(libs.okhttp.bom))
implementation(libs.okhttp.logging.interceptor)
implementation(libs.kakao.login)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.teampophory.pophory.network.di

import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
import com.teampophory.pophory.common.qualifier.Auth
import com.teampophory.pophory.common.qualifier.Log
import com.teampophory.pophory.common.qualifier.Secured
Expand All @@ -22,6 +21,7 @@ import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Converter
import retrofit2.Retrofit
import retrofit2.converter.kotlinx.serialization.asConverterFactory
import java.util.concurrent.TimeUnit
import javax.inject.Singleton

Expand Down
1 change: 0 additions & 1 deletion data/ad/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ dependencies {
implementation(projects.core.common)
implementation(projects.core.network)
implementation(libs.security)
implementation(libs.bundles.retrofit)
implementation(libs.sentry)
}
1 change: 0 additions & 1 deletion data/auth/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies {
implementation(projects.core.common)
implementation(projects.core.network)
implementation(libs.security)
implementation(libs.bundles.retrofit)
implementation(libs.process.phoenix)
implementation(libs.sentry)
}
1 change: 0 additions & 1 deletion data/share/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ dependencies {
implementation(projects.domain.share)
implementation(projects.core.common)
implementation(projects.core.network)
implementation(libs.bundles.retrofit)
}
1 change: 0 additions & 1 deletion feature/share/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ dependencies {

// Third Party
implementation(libs.coil.core)
implementation(libs.retrofit)
}
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ versionCode = "10200"
# kotlin
kotlin = "1.9.23"
kotlinx-serialization-json = "1.6.3"
kotlinx-serialization-converter = "1.0.0"
kotlinx-coroutines = "1.8.0"
kotlinx-datetime = "0.5.0"

Expand Down Expand Up @@ -67,7 +66,7 @@ kspplugin = "1.9.23-1.0.19"
flipper = "0.250.0"
soloader = "0.11.0"
okhttp = "4.12.0"
retrofit = "2.9.0"
retrofit = "2.10.0"
timber = "5.0.1"
coil = "2.6.0"
lottie = "6.0.1"
Expand Down Expand Up @@ -179,8 +178,10 @@ okhttp-bom = { module = "com.squareup.okhttp3:okhttp-bom", version.ref = "okhttp
okhttp = { module = "com.squareup.okhttp3:okhttp" }
okhttp-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor" }

retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
retrofit-kotlin-serialization-converter = { group = "com.jakewharton.retrofit", name = "retrofit2-kotlinx-serialization-converter", version.ref = "kotlinx-serialization-converter" }
retrofit-bom = { module = "com.squareup.retrofit2:retrofit-bom", version.ref = "retrofit" }
retrofit = { module = "com.squareup.retrofit2:retrofit" }
retrofit-kotlin-serialization-converter = { group = "com.squareup.retrofit2", name = "converter-kotlinx-serialization" }
retrofit-response-type-keeper = { module = "com.squareup.retrofit2:response-type-keeper" }

timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" }

Expand Down Expand Up @@ -220,6 +221,5 @@ firebase = ["firebase-analytics", "firebase-crashlytics", "firebase-dynamiclink"
flipper = ["flipper", "soloader", "flipper-network"]
lifecycle = ["lifecycle", "lifecycle-viewmodel", "lifecycle-livedata"]
compose = ["ui", "ui-graphics", "ui-tooling", "ui-tooling-preview", "material3-compose", "coil-compose", "ui-foundation", "activity-compose", "lifecycle-compose", "navigation-compose"]
retrofit = ["retrofit", "retrofit-kotlin-serialization-converter"]
junit5 = ["junit5", "junit5-engine", "junit5-params", "junit5-vintage", "junit5-android-test-core", "junit5-android-test-runner"]
androidx-android-test = ["androidx-test-core", "androidx-test-espresso", "androidx-test-espresso-intents", "androidx-test-junit", "androidx-test-junit-ktx", "androidx-test-rules", "androidx-test-runner", "androidx-test-truth"]

0 comments on commit ac9683a

Please sign in to comment.