-
Notifications
You must be signed in to change notification settings - Fork 1
멀티모듈 아키텍처 구조 설정 #5
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
Conversation
- Convention Plugin 기반 빌드 로직 구성 (build-logic) - Feature 레이어: login 모듈 - Domain 레이어: 비즈니스 로직 모듈 - Data 레이어: 데이터 소스 모듈 - Core 레이어: 공통 모듈 - ui: State/SideEffect 기반 UI 구조 - util: 유틸리티 - navigation: 네비게이션 - design-system: 디자인 시스템 - network: 네트워크 - TYPESAFE_PROJECT_ACCESSORS 활성화 - Ktlint 14.0.1 전역 적용 🤖 Generated with [Firebender](https://firebender.com) Co-Authored-By: Firebender <help@firebender.com>
dogmania
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다! 수정사항 다 반영되면 디코로 알려주세요!
| abstract class BuildLogicConventionPlugin(private val block: Project.() -> Unit) : Plugin<Project> { | ||
| final override fun apply(target: Project) { | ||
| with(target, block = block) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 이렇게 추상화해서 빼는 거 되게 좋을 거 같아요
| applyPlugins( | ||
| "twix.android.library", | ||
| "org.jetbrains.kotlin.plugin.serialization", | ||
| "twix.koin" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저희가 직접 구현한 컨벤션 플러그인을 적용할 때는 apply를 사용해서 넣는 게 나중에 플러그인 코드 수정할 때나 무슨 내용이 들어있는지 파악할 때 더 편할 거 같아요
예를 들어서
class DataConventionPlugin : BuildLogicConventionPlugin({
pluginManager.apply<AndroidLibraryConventionPlugin>()
applyPlugins("org.jetbrains.kotlin.plugin.serialization")
pluginManager.apply<KoinConventionPlugin>()
이런식으로 수정하게 되면 커스텀 플러그인 내부에 어떤 내용이 들어있는지 IDE 네비게이션으로 바로 들어가서 확인할 수 있고 문자열로 하드코딩하면서 발생하는 실수도 방지할 수 있을 거 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| applyPlugins( | ||
| "twix.android.library", | ||
| "twix.android.compose", | ||
| "twix.koin", | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기도 마찬가지로 apply + 클래스로 쓰는 게 유지보수할 때 더 편할 것 같습니다!
| fun DependencyHandlerScope.implementation(project: Project) { | ||
| "implementation"(project) | ||
| } | ||
|
|
||
| fun DependencyHandlerScope.implementation(provider: Provider<*>) { | ||
| "implementation"(provider) | ||
| } | ||
|
|
||
| fun DependencyHandlerScope.debugImplementation(provider: Provider<*>) { | ||
| "debugImplementation"(provider) | ||
| } | ||
|
|
||
| fun DependencyHandlerScope.androidTestImplementation(provider: Provider<*>) { | ||
| "androidTestImplementation"(provider) | ||
| } | ||
|
|
||
| fun DependencyHandlerScope.testImplementation(provider: Provider<*>) { | ||
| "testImplementation"(provider) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 함수로 뺄 생각은 못해봤는데 좋네요
| plugins { | ||
| alias(libs.plugins.twix.android.library) | ||
| } | ||
|
|
||
| android { | ||
| namespace = "com.twix.navigation" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네비게이션에서는 Compose를 사용해야 해서 Compose 플러그인 추가해주세요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리뷰 반영 커밋 : 6e59559
| class LoginActivity : ComponentActivity() { | ||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분은 저번에 얘기했던 네비게이션 구조 반영해서 수정해야 할 거 같아요. :app에 MainActivity를 단일 액티비티로 두고 진입점을 :app으로 통합하는 식으로 바꾸면 좋을 거 같아요 이 부분은 제가 작업해서 pr 올릴게요!
|
BaseViewModel 여부와 상관없이 |
| ) | ||
|
|
||
| dependencies { | ||
| implementation(libs.library("kotlinx-coroutines-core")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지금 AndroidLibraryConvention에 이미 이 의존성을 정의하고 있어서 중복되는 의존성이에요! 제거해주세요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리뷰 반영 커밋 : 6e59559
| extensions.configure<JavaPluginExtension> { | ||
| sourceCompatibility = JavaVersion.VERSION_17 | ||
| targetCompatibility = JavaVersion.VERSION_17 | ||
| } | ||
|
|
||
| extensions.configure<KotlinProjectExtension> { | ||
| jvmToolchain(libs.version("java").requiredVersion.toInt()) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지금 자바 버전을 하드코딩 + 버전 카탈로그에서 읽어오기가 섞여있는데 통일하면 좋을 거 같아요
class JvmLibraryConventionPlugin : BuildLogicConventionPlugin({
applyPlugins("org.jetbrains.kotlin.jvm")
val javaVersionInt = libs.version("java").requiredVersion.toInt()
val javaVersion = JavaVersion.toVersion(javaVersionInt)
extensions.configure<JavaPluginExtension> {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
extensions.configure<KotlinProjectExtension> {
jvmToolchain(javaVersionInt)
}
이런식으로 버전 카탈로그 기준으로 버전 통일 가능합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리뷰 반영 커밋 : 5323bd0
Data 모듈의 의존성을 DataConventionPlugin으로 이동하고, FeatureConventionPlugin의 플러그인 적용 방식을 개선하여 빌드 로직을 더욱 체계적으로 관리
| class AndroidComposeConventionPlugin : BuildLogicConventionPlugin({ | ||
| applyPlugins("org.jetbrains.kotlin.plugin.compose") | ||
|
|
||
| extensions.configure<LibraryExtension> { | ||
| configureCompose(this) | ||
| } | ||
|
|
||
| dependencies { | ||
| val bom = platform(libs.library("compose-bom")) | ||
| implementation(bom) | ||
| implementation(libs.bundle("compose")) | ||
| debugImplementation(libs.bundle("compose-debug")) | ||
| } | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MainActivity를 :app에 두려면 :app에서도 Compose를 사용해야 해요. 지금 플러그인 설정으로는 android.application을 적용하고 있는 ApplicatonConvention에는 이 컨벤션을 적용할 수가 없어서 다음과 같이 수정하면 좋을 거 같아요
class AndroidComposeConventionPlugin : BuildLogicConventionPlugin({
applyPlugins("org.jetbrains.kotlin.plugin.compose")
pluginManager.withPlugin("com.android.application") {
extensions.configure<ApplicationExtension> {
configureCompose(this)
}
}
pluginManager.withPlugin("com.android.library") {
extensions.configure<LibraryExtension> {
configureCompose(this)
}
}
withPlugin이 해당 플러그인이 있을 때 블록을 실행하는 거라 저렇게 하면 feature에는 android.application이 들어가지 않고 분기처리가 가능합니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app 모듈은 컴포즈 의존성 없이 만들고
앱 시작점을 LoginActivity로 하면 되는 줄 알고
app 모듈에 컴포즈 의존성을 제거했는데 app 모듈에서 하는게 맞았구나 ! 😓
리뷰 반영 커밋 : 71d95d2
이슈 번호
#1
리뷰/머지 희망 기한 (선택)
작업내용
멀티모듈 아키텍처 구조를 설정하고 Convention Plugin 기반 빌드 시스템을 구축했습니다.
왜 수정했는지?
무엇을 구현했는지?
build-logic (Convention Plugin)
Feature 레이어
Domain 레이어
Data 레이어
Core 레이어 (공통 모듈)
프로젝트 설정
결과물
프로젝트 구조
리뷰어에게 추가로 요구하는 사항 (선택)
StateHolder와SideEffectHolder를 제거할지 고민해봤어 !저 두개를 유지하면 만약 상태나 사이드 이펙트 둘 중 하나만 사용하는 ViewModel에서도
StateHolder와SideEffectHolder를 그대로 사용할 수 있어 중복 코드를 줄일 수 있을 것 같아서유지해도 괜찮지 않을까라고 생각하는데 현수 생각은 어때 ?
그럼 일단 어제 보여준 코드 기준으로
BaseViewModel은 이렇게 될 것 같아 !