From 897ea87c8d721f54fd2dce00aa03d2e09471091f Mon Sep 17 00:00:00 2001 From: DokySp Date: Tue, 13 Aug 2024 23:01:33 +0900 Subject: [PATCH 1/4] add rules and descriptions --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fcafc27..e8cca3c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # 같이네컷 -- Last updated: 2024-08-13 +- Last updated: 2024-09-22 ## Specification @@ -33,6 +33,7 @@ - Labels: 해당하는 라벨 추가 **반드시 하나의 라벨만 추가할 것** - Projects: 기입 X - Milestone: 기입 X +- Rebase로 merge **Squash 금지!!** ## Code Review Rules - PR 요청 후, slack에 리뷰 요청 @@ -40,9 +41,4 @@ ## Dependencies - 프로젝트 및 관련 버전은 libs.versions.toml 에서 관리 -- 기타 의존성은 사용한 모듈에서 관리 - -## TODO -- 기본적인 모듈 + Manifest 설정 추가 후 커밋 -- 모듈간 의존성 추가 커밋 -- 샘플코드 + Hilt 추가 후 커밋 +- 기타 의존성은 사용한 모듈에서 관리 \ No newline at end of file From c8e1c15b9a334ffafe6f29d6d7618bd1ba65bbd2 Mon Sep 17 00:00:00 2001 From: dokysp Date: Sun, 22 Sep 2024 03:59:49 +0900 Subject: [PATCH 2/4] initial project structure [#1] - add modules based on clean architecture of #17 - sample MainActivity and Logger included --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e8cca3c..dd43d93 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # 같이네컷 -- Last updated: 2024-09-22 +- Last updated: 2024-08-13 ## Specification From cf06ee6f18a29047cfe85e722ff6a6fc614bacc0 Mon Sep 17 00:00:00 2001 From: dokysp Date: Sun, 22 Sep 2024 18:09:17 +0900 Subject: [PATCH 3/4] add hilt for project [#1] --- README.md | 2 +- .../java/com/foke/together/MainApplication.kt | 2 ++ build.gradle.kts | 22 ++++++++++++++ gradle/libs.versions.toml | 30 ++++++++++++++++--- presenter/build.gradle.kts | 3 ++ .../foke/together/presenter/MainActivity.kt | 2 ++ 6 files changed, 56 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index dd43d93..e8cca3c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # 같이네컷 -- Last updated: 2024-08-13 +- Last updated: 2024-09-22 ## Specification diff --git a/app/src/main/java/com/foke/together/MainApplication.kt b/app/src/main/java/com/foke/together/MainApplication.kt index 0e108ba..aa1a37e 100644 --- a/app/src/main/java/com/foke/together/MainApplication.kt +++ b/app/src/main/java/com/foke/together/MainApplication.kt @@ -2,7 +2,9 @@ package com.foke.together import android.app.Application import com.foke.together.util.AppLog +import dagger.hilt.android.HiltAndroidApp +@HiltAndroidApp class MainApplication: Application() { override fun onCreate() { super.onCreate() diff --git a/build.gradle.kts b/build.gradle.kts index 8043919..b237866 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,6 +3,9 @@ plugins { alias(libs.plugins.android.application) apply false alias(libs.plugins.jetbrains.kotlin.android) apply false alias(libs.plugins.android.library) apply false + + alias(libs.plugins.hilt) apply false + alias(libs.plugins.kotlin.kapt) apply false } subprojects { @@ -78,4 +81,23 @@ subprojects { } } } + + plugins.withId("org.jetbrains.kotlin.android") { + apply(plugin = "kotlin-kapt") + apply(plugin = "dagger.hilt.android.plugin") + + dependencies { + add("implementation", libs.hilt) + add("kapt", libs.hilt.compiler) + } + + configure { + correctErrorTypes = true + } + } + + configurations.all { + // resolve error of import duplicated "annotations" with "org.jetbrains.annotations + exclude(group = "com.intellij", module = "annotations") + } } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9ce937c..f3f22a8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,6 +16,9 @@ agp = "8.5.2" kotlin = "1.9.20" coreKtx = "1.13.1" +# kapt ----------- +kotlin-kapt = "1.9.20" + # android -------- appcompat = "1.7.0" composeCompiler = "1.5.5" @@ -24,6 +27,11 @@ activityCompose = "1.9.2" composeBom = "2024.09.02" material = "1.12.0" +# hilt ----------- +hilt = "2.49" +androidx-hilt-compiler = "1.2.0" +androidx-hilt-navigation-compose = "1.2.0" + # test ----------- junit = "4.13.2" junitVersion = "1.2.1" @@ -32,11 +40,10 @@ espressoCore = "3.6.1" [libraries] +# core ----------- androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } -junit = { group = "junit", name = "junit", version.ref = "junit" } -androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } -androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } -androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } + +# android -------- material = { group = "com.google.android.material", name = "material", version.ref = "material" } androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" } androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" } @@ -49,10 +56,25 @@ androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-man androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } androidx-material3 = { group = "androidx.compose.material3", name = "material3" } +# test ----------- +junit = { group = "junit", name = "junit", version.ref = "junit" } +androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } +androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } +androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } + +# hilt ----------- +hilt = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" } +hilt-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" } +androidx-hilt-compiler = { group = "androidx.hilt", name = "hilt-compiler", version.ref = "androidx-hilt-compiler" } +androidx-hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "androidx-hilt-navigation-compose" } + [plugins] android-application = { id = "com.android.application", version.ref = "agp" } jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } android-library = { id = "com.android.library", version.ref = "agp" } +kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin-kapt"} +# hilt ----------- +hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt"} \ No newline at end of file diff --git a/presenter/build.gradle.kts b/presenter/build.gradle.kts index 3f253e7..44e935d 100644 --- a/presenter/build.gradle.kts +++ b/presenter/build.gradle.kts @@ -30,6 +30,9 @@ dependencies { implementation(libs.androidx.ui.graphics) implementation(libs.androidx.ui.tooling.preview) implementation(libs.androidx.material3) + implementation(libs.androidx.hilt.compiler) + implementation(libs.androidx.hilt.navigation.compose) + testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) diff --git a/presenter/src/main/java/com/foke/together/presenter/MainActivity.kt b/presenter/src/main/java/com/foke/together/presenter/MainActivity.kt index 947b504..7e4027f 100644 --- a/presenter/src/main/java/com/foke/together/presenter/MainActivity.kt +++ b/presenter/src/main/java/com/foke/together/presenter/MainActivity.kt @@ -12,7 +12,9 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import com.foke.together.presenter.ui.theme.FourCutTogetherTheme +import dagger.hilt.android.AndroidEntryPoint +@AndroidEntryPoint class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) From ebd2c3093641c93b4a0dd3bb263ee62fa4a68f88 Mon Sep 17 00:00:00 2001 From: dokysp Date: Sun, 22 Sep 2024 23:33:54 +0900 Subject: [PATCH 4/4] disable minifyEnabled and shrinkResources options for Hilt R8 error [#1] - TODO: need to resolve this and change options `true` --- build.gradle.kts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index b237866..316dfad 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -49,15 +49,20 @@ subprojects { getByName("debug") { isMinifyEnabled = false isShrinkResources = false - // TODO: signing + signingConfig = signingConfigs.getByName("debug") + } getByName("release") { - isMinifyEnabled = true - isShrinkResources = true + // TODO: need to resolve for Hilt R8 error and change to `true` + isMinifyEnabled = false + isShrinkResources = false + proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) + // TODO: change to release keystore + signingConfig = signingConfigs.getByName("debug") } } } @@ -77,6 +82,8 @@ subprojects { getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) + // TODO: change to release keystore + signingConfig = signingConfigs.getByName("debug") } } }