Skip to content

Chore/#16 hiltwith module#17

Merged
dmp100 merged 5 commits intodevelopfrom
chore/#16-HiltwithModule
May 13, 2025
Merged

Chore/#16 hiltwith module#17
dmp100 merged 5 commits intodevelopfrom
chore/#16-HiltwithModule

Conversation

@dmp100
Copy link
Contributor

@dmp100 dmp100 commented May 13, 2025

Related issue 🛠

Work Description ✏️

  • 클린 아키텍처 기반 멀티모듈 구조
    app, core, domain, data, feature 등의 모듈 구조화
    각 레이어별 역할 분리

  • Gradle 컨벤션 플러그인
    빌드 로직 재사용을 위한 플러그인 모듈화
    안드로이드 앱/라이브러리, JVM 라이브러리, Hilt, 네트워크 등 플러그인 구현
    버전 카탈로그를 통한 의존성 관리

Screenshot 📸

구현된 Gradle 컨벤션 플러그인 상세 정리

1. AndroidApplicationConventionPlugin

용도: 앱 모듈의 기본 설정을 담당합니다.

적용하는 플러그인:

  • com.android.application: 안드로이드 애플리케이션 빌드 플러그인
  • org.jetbrains.kotlin.android: 코틀린 안드로이드 플러그인
  • androidx.navigation.safeargs.kotlin: 네비게이션 Safe Args 플러그인

주요 설정:

  • compileSdk, minSdk, targetSdk 설정
  • applicationId, versionCode, versionName 설정
  • Java 버전 및 코틀린 JVM 타겟 설정
  • ViewBinding, DataBinding, BuildConfig 활성화

추가하는 의존성:

  • androidx.core:core-ktx
  • androidx.appcompat:appcompat
  • com.google.android.material:material
  • androidx.activity:activity
  • androidx.constraintlayout:constraintlayout
  • androidx.lifecycle:lifecycle-runtime-ktx
  • com.jakewharton.timber:timber
  • androidx.viewpager2:viewpager2
  • androidx.datastore:datastore-preferences
  • androidx.datastore:datastore-preferences-core

2. AndroidApplicationComposeConventionPlugin

용도: 앱 모듈의 Jetpack Compose 설정을 담당합니다.

적용하는 플러그인:

  • org.jetbrains.kotlin.plugin.compose: 코틀린 Compose 컴파일러 플러그인

주요 설정:

  • Compose 빌드 기능 활성화
  • Compose 컴파일러 버전 설정

추가하는 의존성:

  • androidx.compose:compose-bom
  • androidx.compose.ui:ui
  • androidx.compose.material3:material3
  • androidx.compose.ui:ui-tooling-preview
  • androidx.activity:activity-compose
  • androidx.compose.ui:ui-tooling (디버그용)

3. AndroidLibraryConventionPlugin

용도: 안드로이드 라이브러리 모듈의 기본 설정을 담당합니다.

적용하는 플러그인:

  • com.android.library: 안드로이드 라이브러리 빌드 플러그인
  • org.jetbrains.kotlin.android: 코틀린 안드로이드 플러그인

주요 설정:

  • compileSdk, minSdk 설정
  • testInstrumentationRunner 설정
  • Java 버전 및 코틀린 JVM 타겟 설정
  • ViewBinding, DataBinding 활성화
  • ProGuard 규칙 설정

추가하는 의존성:

  • androidx.core:core-ktx
  • androidx.appcompat:appcompat
  • com.google.android.material:material
  • junit:junit (테스트용)
  • androidx.test.ext:junit (안드로이드 테스트용)
  • androidx.test.espresso:espresso-core (UI 테스트용)

4. AndroidLibraryComposeConventionPlugin

용도: 안드로이드 라이브러리 모듈의 Jetpack Compose 설정을 담당합니다.

적용하는 플러그인:

  • org.jetbrains.kotlin.plugin.compose: 코틀린 Compose 컴파일러 플러그인

주요 설정:

  • Compose 빌드 기능 활성화
  • Compose 컴파일러 버전 설정

추가하는 의존성:

  • androidx.compose:compose-bom
  • androidx.compose.ui:ui
  • androidx.compose.material3:material3
  • androidx.compose.ui:ui-tooling-preview
  • androidx.compose.foundation:foundation
  • androidx.compose.ui:ui-tooling (디버그용)

5. JvmLibraryConventionPlugin

용도: JVM 라이브러리 모듈(안드로이드가 아닌 순수 코틀린/자바 모듈)의 설정을 담당합니다.

적용하는 플러그인:

  • java-library: 자바 라이브러리 빌드 플러그인
  • org.jetbrains.kotlin.jvm: 코틀린 JVM 플러그인

주요 설정:

  • Java 호환성 버전 설정 (sourceCompatibility, targetCompatibility)
  • 코틀린 JVM 타겟 설정

추가하는 의존성: 기본적으로는 의존성을 추가하지 않습니다.

6. FeatureConventionPlugin

용도: 기능 모듈을 위한 설정을 담당합니다. (각 기능 화면을 담당하는 모듈용)

적용하는 플러그인:

  • barrion.android.library: 안드로이드 라이브러리 컨벤션 플러그인
  • barrion.android.library.compose: 안드로이드 라이브러리 Compose 컨벤션 플러그인

주요 설정: AndroidLibraryConventionPlugin에서 상속받은 설정 사용

추가하는 의존성:

  • project(":core:common")
  • project(":core:ui")
  • project(":domain")
  • project(":data") (선택적)
  • androidx.navigation:navigation-fragment-ktx
  • androidx.navigation:navigation-ui-ktx
  • androidx.hilt:hilt-navigation-compose (선택적)

7. HiltConventionPlugin

용도: Dagger Hilt를 통한 의존성 주입 설정을 담당합니다.

적용하는 플러그인:

  • com.google.devtools.ksp: Kotlin Symbol Processing 플러그인
  • com.google.dagger.hilt.android: Dagger Hilt 안드로이드 플러그인
  • org.jetbrains.kotlin.kapt: 코틀린 Annotation Processing 플러그인

주요 설정: 없음

추가하는 의존성:

  • com.google.dagger:hilt-android
  • com.google.dagger:hilt-compiler (ksp)
  • com.google.dagger:hilt-android-compiler (ksp)

8. NetworkConventionPlugin

용도: 네트워크 통신 관련 설정을 담당합니다.

적용하는 플러그인:

  • org.jetbrains.kotlin.plugin.serialization: 코틀린 직렬화 플러그인

주요 설정: 없음

추가하는 의존성:

  • com.squareup.okhttp3:okhttp-bom
  • com.squareup.retrofit2:retrofit
  • com.squareup.retrofit2:converter-kotlinx-serialization
  • com.squareup.okhttp3:okhttp
  • com.squareup.okhttp3:logging-interceptor
  • org.jetbrains.kotlinx:kotlinx-serialization-json
  • org.jetbrains.kotlinx:kotlinx-coroutines-android

9. ImageLoadingConventionPlugin

용도: 이미지 로딩 라이브러리 설정을 담당합니다.

적용하는 플러그인: 없음

주요 설정: 없음

추가하는 의존성:

  • com.github.bumptech.glide:glide
  • com.github.bumptech.glide:compiler (ksp)
  • io.coil-kt:coil

멀티모듈 프로젝트 구조 트리

2025-1Capstone/
├── app/                           # 앱 모듈 (애플리케이션 진입점)
│   ├── build.gradle.kts
│   └── src/
│       └── main/
│           ├── java/
│           │   └── com/
│           │       └── example/
│           │           └── barrion/
│           │               ├── BarrionApplication.kt
│           │               ├── MainActivity.kt
│           │               └── navigation/
│           │                   ├── AppDestinations.kt
│           │                   └── AppNavHost.kt
│           └── res/
│
├── build-logic/                   # 빌드 로직 모듈 (컨벤션 플러그인)
│   ├── convention/
│   │   ├── build.gradle.kts
│   │   └── src/
│   │       └── main/
│   │           └── java/
│   │               └── com/
│   │                   └── example/
│   │                       └── convention/
│   │                           ├── AndroidApplicationComposeConventionPlugin.kt
│   │                           ├── AndroidApplicationConventionPlugin.kt
│   │                           ├── AndroidCompose.kt
│   │                           ├── AndroidLibraryComposeConventionPlugin.kt
│   │                           ├── AndroidLibraryConventionPlugin.kt
│   │                           ├── Const.kt
│   │                           ├── FeatureConventionPlugin.kt
│   │                           ├── HiltConventionPlugin.kt
│   │                           ├── ImageLoadingConventionPlugin.kt
│   │                           ├── JvmLibraryConventionPlugin.kt
│   │                           ├── KotlinAndroid.kt
│   │                           └── NetworkConventionPlugin.kt
│   └── settings.gradle.kts
│
├── core/                          # 코어 모듈 (공통 기능)
│   ├── common/                    # 공통 유틸리티 및 기본 컴포넌트
│   │   ├── build.gradle.kts
│   │   └── src/
│   │       └── main/
│   │           └── java/
│   │               └── com/
│   │                   └── example/
│   │                       └── common/
│   │                           ├── mvi/
│   │                           │   ├── UiEffect.kt
│   │                           │   ├── UiIntent.kt
│   │                           │   └── UiState.kt
│   │                           └── util/
│   │                               └── ResultExt.kt
│   │
│   └── ui/                        # 공통 UI 컴포넌트
│       ├── build.gradle.kts
│       └── src/
│           └── main/
│               ├── AndroidManifest.xml
│               └── java/
│                   └── com/
│                       └── example/
│                           └── ui/
│                               └── components/
│                                   ├── ErrorView.kt
│                                   └── LoadingIndicator.kt
│
├── data/                          # 데이터 레이어
│   ├── build.gradle.kts
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           └── java/
│               └── com/
│                   └── example/
│                       └── data/
│                           ├── di/
│                           │   └── DataModule.kt
│                           ├── repository/
│                           │   └── MenuRepositoryImpl.kt
│                           └── source/
│                               └── local/
│                                   ├── MenuLocalDataSource.kt
│                                   └── SharedPrefsMenuLocalDataSource.kt
│
├── domain/                        # 도메인 레이어
│   ├── build.gradle.kts
│   └── src/
│       └── main/
│           └── java/
│               └── com/
│                   └── example/
│                       └── domain/
│                           ├── model/
│                           │   ├── MenuCategory.kt
│                           │   └── MenuItem.kt
│                           ├── repository/
│                           │   └── MenuRepository.kt
│                           └── usecase/
│                               └── menu/
│                                   ├── AddMenuCategoryUseCase.kt
│                                   ├── AddMenuItemUseCase.kt
│                                   ├── DeleteMenuCategoryUseCase.kt
│                                   ├── DeleteMenuItemUseCase.kt
│                                   ├── GetMenuCategoriesUseCase.kt
│                                   ├── GetMenuItemsByCategoryUseCase.kt
│                                   ├── GetMenuItemsUseCase.kt
│                                   ├── UpdateMenuCategoryUseCase.kt
│                                   └── UpdateMenuItemUseCase.kt
│
├── feature/                       # 기능 모듈
│   ├── auth/                      # 인증 기능
│   │   ├── build.gradle.kts
│   │   └── src/
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           └── java/
│   │               └── com/
│   │                   └── example/
│   │                       └── auth/
│   │
│   ├── menu/                      # 메뉴 관리 기능
│   │   ├── build.gradle.kts
│   │   └── src/
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           └── java/
│   │               └── com/
│   │                   └── example/
│   │                       └── menu/
│   │                           └── presentation/
│   │                               ├── MenuEffect.kt
│   │                               ├── MenuIntent.kt
│   │                               ├── MenuScreen.kt
│   │                               ├── MenuState.kt
│   │                               └── MenuViewModel.kt
│   │
│   ├── onboarding/                # 온보딩 기능
│   │   ├── build.gradle.kts
│   │   └── src/
│   │       └── main/...
│   │
│   ├── order/                     # 주문 관리 기능
│   │   ├── build.gradle.kts
│   │   └── src/
│   │       └── main/...
│   │
│   ├── sales/                     # 매출 관리 기능
│   │   ├── build.gradle.kts
│   │   └── src/
│   │       └── main/...
│   │
│   └── staff/                     # 직원 관리 기능
│       ├── build.gradle.kts
│       └── src/
│           └── main/...
│
├── gradle/
│   ├── libs.versions.toml         # 버전 카탈로그
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
│
├── build.gradle.kts               # 프로젝트 루트 빌드 스크립트
├── gradle.properties              # Gradle 속성 설정
├── gradlew                        # Gradle 래퍼 스크립트 (Unix)
├── gradlew.bat                    # Gradle 래퍼 스크립트 (Windows)
└── settings.gradle.kts            # 프로젝트 설정 스크립트

이 구조는 클린 아키텍처 원칙을 따르며, 레이어별로 모듈이 분리되어 있습니다:

  1. Presentation Layer: app + feature 모듈들
  2. Domain Layer: domain 모듈
  3. Data Layer: data 모듈
  4. Core: 공통 기능을 담당하는 core 모듈들

또한 빌드 로직이 build-logic/convention 모듈로 분리되어 있어, 모든 모듈에서 일관된 빌드 설정을 사용할 수 있습니다.

Uncompleted Tasks 😅

  • MVI 아키텍처 컴포넌트 구현
  • 공통 MVI 기반 클래스 구현
  • 실제 기능 모듈에 MVI 패턴 적용

To Reviewers 📢

dmp100 added 5 commits March 11, 2025 12:42
1. 레이어 분리 (클린 아키텍처)
클린 아키텍처의 주요 레이어가 모두 존재합니다:

Domain Layer (독립적인 비즈니스 로직)

domain 모듈

Data Layer (데이터 소스 및 저장소)

data 모듈

Presentation Layer (UI 및 뷰모델)

presentation 모듈
각 기능별 모듈들 (feature/*)

2. 모듈 구조 (멀티모듈)
모듈 구조도 잘 구성되어 있습니다:

앱 모듈

앱의 진입점 (MainActivity, Application 클래스 등)

코어 모듈

core/common - 공통 유틸리티 및 기능
core/ui - UI 공통 요소

기능 모듈

feature/auth - 인증 기능
feature/menu - 메뉴 관리
feature/onboarding - 온보딩 플로우
feature/order - 주문 관리
feature/sales - 매출 관리
feature/staff - 직원 관리
기본 플러그인 적용:

com.android.application - 안드로이드 애플리케이션 빌드
org.jetbrains.kotlin.android - 코틀린 안드로이드 지원
org.jetbrains.kotlin.kapt - 코틀린 애노테이션 프로세싱
androidx.navigation.safeargs.kotlin - 네비게이션 안전 인자

공통 의존성:

기본 안드로이드 라이브러리: androidx-core-ktx, androidx-appcompat, material
데이터 스토리지: androidx-datastore-preferences
로깅: timber
네비게이션: navigation 번들
비동기 처리: kotlinx-coroutines
직렬화: kotlinx-serialization-json
네트워킹: retrofit, okhttp 관련 번들

안드로이드 기본 설정:

compileSdk, minSdk, targetSdk 기본값 설정
기본 테스트 인스트루먼테이션 러너 설정
@dmp100 dmp100 merged commit 81195d0 into develop May 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CHORE] Hilt + 모듈 구조 설정

1 participant