diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ac3931360..d6cbafbad 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,46 +1,26 @@ +@file:Suppress("UnstableApiUsage") + import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties +@Suppress("DSL_SCOPE_VIOLATION") plugins { - id("com.android.application") - id("org.jetbrains.kotlin.android") - kotlin("kapt") - id("dagger.hilt.android.plugin") - id("com.google.android.gms.oss-licenses-plugin") + id("beep.android.application") + id("beep.android.hilt") + alias(libs.plugins.ksp) } android { namespace = "com.lighthouse.beep" - compileSdk = AppConfig.compileSdk - buildToolsVersion = AppConfig.buildToolsVersion defaultConfig { applicationId = "com.lighthouse.beep" - minSdk = AppConfig.minSdk - targetSdk = AppConfig.targetSdk - versionCode = AppConfig.versionCode - versionName = AppConfig.versionName - - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + versionCode = 1 + versionName = "1.0.0" buildConfigField("String", "kakaoSearchId", getApiKey("kakao_search_id")) manifestPlaceholders["naver_map_api_id"] = getApiKey("naver_map_api_id") } - buildTypes { - getByName("release") { - isMinifyEnabled = false - proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") - } - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - } - - kotlinOptions { - jvmTarget = AppConfig.jvmTarget - } buildFeatures { dataBinding = true } @@ -51,13 +31,39 @@ android { } dependencies { - implementation(project(":domain")) - implementation(project(":presentation")) - implementation(project(":data")) - implementation(platform(Libraries.FIREBASE_BOM)) - kapt(Kapt.APP_LIBRARIES) - implementation(Libraries.APP_LIBRARIES) - annotationProcessor(AnnotationProcessors.APP_LIBRARIES) + implementation(projects.domain) + implementation(projects.presentation) + implementation(projects.data) + + implementation(libs.androidX.hilt.work) + implementation(libs.androidX.work.runtime.ktx) + implementation(libs.androidX.room.ktx) + implementation(libs.androidX.room.runtime) + implementation(libs.androidX.datastore.preferences) + + implementation(libs.kotlin.coroutine.core) + implementation(libs.kotlin.coroutine.android) + + implementation(libs.squareup.retrofit2) + implementation(libs.squareup.retrofit2.converter.moshi) + implementation(libs.squareup.moshi.kotlin) + implementation(libs.squareup.moshi.adapters) + + implementation(platform(libs.firebase.bom)) + implementation(libs.firebase.auth.ktx) + + implementation(libs.gms.play.services.oss.licences) + + implementation(libs.timber) + + ksp(libs.androidX.room.compiler) + ksp(libs.glide.ksp) + + testImplementation(libs.junit4) +} + +kapt { + useBuildCache = true } fun getApiKey(propertyKey: String): String { diff --git a/app/src/main/java/com/lighthouse/BeepApplication.kt b/app/src/main/java/com/lighthouse/BeepApplication.kt index fd39f37bd..8cb7c7e3f 100644 --- a/app/src/main/java/com/lighthouse/BeepApplication.kt +++ b/app/src/main/java/com/lighthouse/BeepApplication.kt @@ -3,8 +3,9 @@ package com.lighthouse import android.app.Application import androidx.hilt.work.HiltWorkerFactory import androidx.work.Configuration -import com.lighthouse.beep.BuildConfig import com.lighthouse.presentation.background.BeepWorkManager +import com.lighthouse.utils.log.ComponentLogger +import com.lighthouse.utils.log.CustomTimberTree import dagger.hilt.android.HiltAndroidApp import timber.log.Timber import javax.inject.Inject @@ -12,15 +13,19 @@ import javax.inject.Inject @HiltAndroidApp class BeepApplication : Application(), Configuration.Provider { + @Inject + lateinit var componentLogger: ComponentLogger + + @Inject + lateinit var customTimberTree: CustomTimberTree + @Inject lateinit var workerFactory: HiltWorkerFactory override fun onCreate() { super.onCreate() - - if (BuildConfig.DEBUG) { - Timber.plant(CustomTimberTree()) - } + Timber.plant(customTimberTree) + componentLogger.initialize(this) BeepWorkManager(this) } @@ -30,9 +35,3 @@ class BeepApplication : Application(), Configuration.Provider { .setWorkerFactory(workerFactory) .build() } - -class CustomTimberTree : Timber.DebugTree() { - override fun createStackElementTag(element: StackTraceElement): String { - return "${element.className}:${element.lineNumber}#${element.methodName}" - } -} diff --git a/app/src/main/java/com/lighthouse/utils/log/ComponentLogger.kt b/app/src/main/java/com/lighthouse/utils/log/ComponentLogger.kt new file mode 100644 index 000000000..fad37a714 --- /dev/null +++ b/app/src/main/java/com/lighthouse/utils/log/ComponentLogger.kt @@ -0,0 +1,146 @@ +package com.lighthouse.utils.log + +import android.app.Activity +import android.app.Application +import android.content.Context +import android.os.Bundle +import android.view.View +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentActivity +import androidx.fragment.app.FragmentManager +import timber.log.Timber +import javax.inject.Inject + +private const val loggerTag = "Logger" + +private inline val T.javaClassName: String + get() = javaClass.name + +private fun Fragment.printLifecycle(lifecycleScope: String) { + Timber.tag(loggerTag).d("[Fragment] $lifecycleScope - $javaClassName(${hashCode()})") +} + +private fun Activity.printLifecycle(lifecycleScope: String) { + Timber.tag(loggerTag).d("[Activity] $lifecycleScope - $javaClassName(${hashCode()})") +} + +class ComponentLogger @Inject constructor() { + fun initialize(application: Application) { + application.registerActivityLifecycleCallbacks( + object : Application.ActivityLifecycleCallbacks { + override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) { + activity.printLifecycle("onCreate") + handleActivity(activity) + } + + override fun onActivityStarted(activity: Activity) { + activity.printLifecycle("onStart") + } + + override fun onActivityResumed(activity: Activity) { + activity.printLifecycle("onResume") + } + + override fun onActivityPaused(activity: Activity) { + activity.printLifecycle("onPause") + } + + override fun onActivityStopped(activity: Activity) { + activity.printLifecycle("onStop") + } + + override fun onActivitySaveInstanceState( + activity: Activity, + savedInstanceState: Bundle + ) { + activity.printLifecycle("onSaveInstance") + } + + override fun onActivityDestroyed(activity: Activity) { + activity.printLifecycle("onDestroy") + } + } + ) + } + + private fun handleActivity(activity: Activity) { + if (activity is FragmentActivity) { + activity.supportFragmentManager.registerFragmentLifecycleCallbacks( + object : FragmentManager.FragmentLifecycleCallbacks() { + override fun onFragmentAttached( + fm: FragmentManager, + f: Fragment, + context: Context + ) { + super.onFragmentAttached(fm, f, context) + f.printLifecycle("onAttach") + } + + override fun onFragmentCreated( + fm: FragmentManager, + f: Fragment, + savedInstanceState: Bundle? + ) { + super.onFragmentCreated(fm, f, savedInstanceState) + f.printLifecycle("onCreate") + } + + override fun onFragmentViewCreated( + fm: FragmentManager, + f: Fragment, + v: View, + savedInstanceState: Bundle? + ) { + super.onFragmentViewCreated(fm, f, v, savedInstanceState) + f.printLifecycle("onViewCreated") + } + + override fun onFragmentStarted(fm: FragmentManager, f: Fragment) { + super.onFragmentStarted(fm, f) + f.printLifecycle("onStart") + } + + override fun onFragmentResumed(fm: FragmentManager, f: Fragment) { + super.onFragmentResumed(fm, f) + f.printLifecycle("onResume") + } + + override fun onFragmentPaused(fm: FragmentManager, f: Fragment) { + super.onFragmentPaused(fm, f) + f.printLifecycle("onPause") + } + + override fun onFragmentStopped(fm: FragmentManager, f: Fragment) { + super.onFragmentStopped(fm, f) + f.printLifecycle("onStop") + } + + override fun onFragmentSaveInstanceState( + fm: FragmentManager, + f: Fragment, + outState: Bundle + ) { + super.onFragmentSaveInstanceState(fm, f, outState) + f.printLifecycle("onSaveInstance") + } + + override fun onFragmentViewDestroyed(fm: FragmentManager, f: Fragment) { + super.onFragmentViewDestroyed(fm, f) + f.printLifecycle("onViewDestroy") + } + + override fun onFragmentDestroyed(fm: FragmentManager, f: Fragment) { + super.onFragmentDestroyed(fm, f) + f.printLifecycle("onDestroy") + } + + override fun onFragmentDetached(fm: FragmentManager, f: Fragment) { + super.onFragmentDetached(fm, f) + f.printLifecycle("onDetach") + } + }, + true + ) + } + } +} diff --git a/app/src/main/java/com/lighthouse/utils/log/CustomTimberTree.kt b/app/src/main/java/com/lighthouse/utils/log/CustomTimberTree.kt new file mode 100644 index 000000000..56679a5b0 --- /dev/null +++ b/app/src/main/java/com/lighthouse/utils/log/CustomTimberTree.kt @@ -0,0 +1,10 @@ +package com.lighthouse.utils.log + +import timber.log.Timber +import javax.inject.Inject + +class CustomTimberTree @Inject constructor() : Timber.DebugTree() { + override fun createStackElementTag(element: StackTraceElement): String { + return "${element.className}:${element.lineNumber}#${element.methodName}" + } +} diff --git a/build-logic/.gitignore b/build-logic/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/build-logic/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/build-logic/convention/.gitignore b/build-logic/convention/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/build-logic/convention/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/build-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.kts new file mode 100644 index 000000000..6a99fd448 --- /dev/null +++ b/build-logic/convention/build.gradle.kts @@ -0,0 +1,45 @@ +plugins { + `kotlin-dsl` // enable the Kotlin-DSL +} + +group = "com.lighthouse.beep.buildlogic" + +java { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 +} + +dependencies { + compileOnly(libs.android.gradlePlugin) + compileOnly(libs.kotlin.gradlePlugin) + compileOnly(libs.hilt.gradlePlugin) +} + +gradlePlugin { + plugins { + register("androidApplication") { + id = "beep.android.application" + implementationClass = "AndroidApplicationConventionPlugin" + } + register("androidApplicationCompose") { + id = "beep.android.application.compose" + implementationClass = "AndroidApplicationComposeConventionPlugin" + } + register("androidLibrary") { + id = "beep.android.library" + implementationClass = "AndroidLibraryConventionPlugin" + } + register("androidLibraryCompose") { + id = "beep.android.library.compose" + implementationClass = "AndroidLibraryComposeConventionPlugin" + } + register("androidHilt") { + id = "beep.android.hilt" + implementationClass = "AndroidHiltConventionPlugin" + } + register("javaLibrary") { + id = "beep.java.library" + implementationClass = "JavaLibraryConventionPlugin" + } + } +} diff --git a/build-logic/convention/src/main/java/AndroidApplicationComposeConventionPlugin.kt b/build-logic/convention/src/main/java/AndroidApplicationComposeConventionPlugin.kt new file mode 100644 index 000000000..cf38f99af --- /dev/null +++ b/build-logic/convention/src/main/java/AndroidApplicationComposeConventionPlugin.kt @@ -0,0 +1,15 @@ +import com.android.build.gradle.internal.dsl.BaseAppModuleExtension +import com.lighthouse.convention.configureAndroidCompose +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.getByType + +class AndroidApplicationComposeConventionPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + pluginManager.apply("com.android.application") + val extension = extensions.getByType() + configureAndroidCompose(extension) + } + } +} diff --git a/build-logic/convention/src/main/java/AndroidApplicationConventionPlugin.kt b/build-logic/convention/src/main/java/AndroidApplicationConventionPlugin.kt new file mode 100644 index 000000000..755792075 --- /dev/null +++ b/build-logic/convention/src/main/java/AndroidApplicationConventionPlugin.kt @@ -0,0 +1,32 @@ +@file:Suppress("UnstableApiUsage") + +import com.android.build.gradle.internal.dsl.BaseAppModuleExtension +import com.lighthouse.convention.configureAndroid +import com.lighthouse.convention.configureKotlin +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure + +class AndroidApplicationConventionPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.android.application") + apply("org.jetbrains.kotlin.android") + } + + configureAndroid() + + extensions.configure { + configureKotlin(this) + + buildTypes { + release { + isMinifyEnabled = false + proguardFile("proguard-rules.pro") + } + } + } + } + } +} diff --git a/build-logic/convention/src/main/java/AndroidHiltConventionPlugin.kt b/build-logic/convention/src/main/java/AndroidHiltConventionPlugin.kt new file mode 100644 index 000000000..8140956d7 --- /dev/null +++ b/build-logic/convention/src/main/java/AndroidHiltConventionPlugin.kt @@ -0,0 +1,28 @@ +import com.lighthouse.convention.findVersionCatalog +import com.lighthouse.convention.implementation +import com.lighthouse.convention.kapt +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies + +class AndroidHiltConventionPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("kotlin-kapt") + apply("dagger.hilt.android.plugin") + } + + val libs = findVersionCatalog() + + dependencies { + implementation(libs.findLibrary("dagger-hilt-android")) + kapt(libs.findLibrary("dagger-hilt-android-compiler")) + } + + kapt { + correctErrorTypes = true + } + } + } +} diff --git a/build-logic/convention/src/main/java/AndroidLibraryComposeConventionPlugin.kt b/build-logic/convention/src/main/java/AndroidLibraryComposeConventionPlugin.kt new file mode 100644 index 000000000..3055b2f84 --- /dev/null +++ b/build-logic/convention/src/main/java/AndroidLibraryComposeConventionPlugin.kt @@ -0,0 +1,15 @@ +import com.android.build.gradle.LibraryExtension +import com.lighthouse.convention.configureAndroidCompose +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.getByType + +class AndroidLibraryComposeConventionPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + pluginManager.apply("com.android.library") + val extension = extensions.getByType() + configureAndroidCompose(extension) + } + } +} diff --git a/build-logic/convention/src/main/java/AndroidLibraryConventionPlugin.kt b/build-logic/convention/src/main/java/AndroidLibraryConventionPlugin.kt new file mode 100644 index 000000000..893a2cde7 --- /dev/null +++ b/build-logic/convention/src/main/java/AndroidLibraryConventionPlugin.kt @@ -0,0 +1,23 @@ +import com.android.build.gradle.LibraryExtension +import com.lighthouse.convention.configureAndroid +import com.lighthouse.convention.configureKotlin +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure + +class AndroidLibraryConventionPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.android.library") + apply("org.jetbrains.kotlin.android") + } + + configureAndroid() + + extensions.configure { + configureKotlin(this) + } + } + } +} diff --git a/build-logic/convention/src/main/java/JavaLibraryConventionPlugin.kt b/build-logic/convention/src/main/java/JavaLibraryConventionPlugin.kt new file mode 100644 index 000000000..cea022997 --- /dev/null +++ b/build-logic/convention/src/main/java/JavaLibraryConventionPlugin.kt @@ -0,0 +1,20 @@ +import com.lighthouse.convention.ProjectConfigurations +import com.lighthouse.convention.java +import org.gradle.api.Plugin +import org.gradle.api.Project + +class JavaLibraryConventionPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("java-library") + apply("org.jetbrains.kotlin.jvm") + } + + java { + sourceCompatibility = ProjectConfigurations.javaVer + targetCompatibility = ProjectConfigurations.javaVer + } + } + } +} diff --git a/build-logic/convention/src/main/java/com/lighthouse/convention/AndroidCompose.kt b/build-logic/convention/src/main/java/com/lighthouse/convention/AndroidCompose.kt new file mode 100644 index 000000000..bd510d837 --- /dev/null +++ b/build-logic/convention/src/main/java/com/lighthouse/convention/AndroidCompose.kt @@ -0,0 +1,28 @@ +@file:Suppress("UnstableApiUsage") // ktlint-disable filename + +package com.lighthouse.convention + +import com.android.build.api.dsl.CommonExtension +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies + +internal fun Project.configureAndroidCompose( + commonExtension: CommonExtension<*, *, *, *> +) { + val libs = findVersionCatalog() + + commonExtension.apply { + buildFeatures.compose = true + + composeOptions { + kotlinCompilerExtensionVersion = libs.findVersion("compose-compiler").get().toString() + } + } + + dependencies { + api(platform(libs.findLibrary("androidX-compose-bom").get())) + implementation(libs.findBundle("androidX-compose")) + implementation(libs.findBundle("androidX-compose-lifecycle")) + debugImplementation(libs.findBundle("androidX-compose-debug")) + } +} diff --git a/build-logic/convention/src/main/java/com/lighthouse/convention/DependencyHandlerExt.kt b/build-logic/convention/src/main/java/com/lighthouse/convention/DependencyHandlerExt.kt new file mode 100644 index 000000000..afffc6894 --- /dev/null +++ b/build-logic/convention/src/main/java/com/lighthouse/convention/DependencyHandlerExt.kt @@ -0,0 +1,22 @@ +package com.lighthouse.convention + +import org.gradle.api.artifacts.Dependency +import org.gradle.api.artifacts.dsl.DependencyHandler +import org.gradle.api.provider.Provider +import java.util.Optional + +internal fun DependencyHandler.implementation( + dependencyNotation: Optional> +): Dependency? = add("implementation", dependencyNotation.get()) + +internal fun DependencyHandler.debugImplementation( + dependencyNotation: Optional> +): Dependency? = add("debugImplementation", dependencyNotation.get()) + +internal fun DependencyHandler.kapt( + dependencyNotation: Optional> +): Dependency? = add("kapt", dependencyNotation.get()) + +internal fun DependencyHandler.api( + dependencyNotation: Provider +): Dependency? = add("api", dependencyNotation) diff --git a/build-logic/convention/src/main/java/com/lighthouse/convention/KotlinAndroid.kt b/build-logic/convention/src/main/java/com/lighthouse/convention/KotlinAndroid.kt new file mode 100644 index 000000000..3e5cc6a90 --- /dev/null +++ b/build-logic/convention/src/main/java/com/lighthouse/convention/KotlinAndroid.kt @@ -0,0 +1,63 @@ +@file:Suppress("RemoveRedundantBackticks") + +package com.lighthouse.convention + +import com.android.build.api.dsl.CommonExtension +import com.android.build.gradle.BaseExtension +import org.gradle.api.Action +import org.gradle.api.Project +import org.gradle.api.plugins.ExtensionAware +import org.gradle.api.plugins.JavaPluginExtension +import org.gradle.kotlin.dsl.configure +import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions +import org.jetbrains.kotlin.gradle.plugin.KaptExtension + +internal fun Project.configureAndroid() { + extensions.configure { + compileSdkVersion(ProjectConfigurations.compileSdk) + + defaultConfig { + minSdk = ProjectConfigurations.minSdk + targetSdk = ProjectConfigurations.targetSdk + + testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" + vectorDrawables.useSupportLibrary = true + } + + dataBinding.enable = true + + compileOptions { + sourceCompatibility = ProjectConfigurations.javaVer + targetCompatibility = ProjectConfigurations.javaVer + } + } +} + +internal fun Project.configureKotlin( + commonExtension: CommonExtension<*, *, *, *> +) { + commonExtension.kotlinOptions { + freeCompilerArgs = freeCompilerArgs + listOf( + "-Xjsr305=strict" + ) + jvmTarget = ProjectConfigurations.javaVer.toString() + } +} + +internal fun Project.`kapt`( + configure: Action +) { + (this as ExtensionAware).extensions.configure("kapt", configure) +} + +internal fun Project.`java`( + configure: Action +) { + (this as ExtensionAware).extensions.configure("java", configure) +} + +internal fun CommonExtension<*, *, *, *>.kotlinOptions( + block: KotlinJvmOptions.() -> Unit +) { + (this as ExtensionAware).extensions.configure("kotlinOptions", block) +} diff --git a/build-logic/convention/src/main/java/com/lighthouse/convention/ProjectConfigurations.kt b/build-logic/convention/src/main/java/com/lighthouse/convention/ProjectConfigurations.kt new file mode 100644 index 000000000..61ec5ff48 --- /dev/null +++ b/build-logic/convention/src/main/java/com/lighthouse/convention/ProjectConfigurations.kt @@ -0,0 +1,10 @@ +package com.lighthouse.convention + +import org.gradle.api.JavaVersion + +object ProjectConfigurations { + const val compileSdk = 33 + const val minSdk = 21 + const val targetSdk = 33 + val javaVer = JavaVersion.VERSION_11 +} diff --git a/build-logic/convention/src/main/java/com/lighthouse/convention/ProjectExt.kt b/build-logic/convention/src/main/java/com/lighthouse/convention/ProjectExt.kt new file mode 100644 index 000000000..809bc9bf9 --- /dev/null +++ b/build-logic/convention/src/main/java/com/lighthouse/convention/ProjectExt.kt @@ -0,0 +1,9 @@ +package com.lighthouse.convention + +import org.gradle.api.Project +import org.gradle.api.artifacts.VersionCatalog +import org.gradle.api.artifacts.VersionCatalogsExtension +import org.gradle.kotlin.dsl.getByType + +fun Project.findVersionCatalog(): VersionCatalog = + extensions.getByType().named("libs") diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts new file mode 100644 index 000000000..4b6892b78 --- /dev/null +++ b/build-logic/settings.gradle.kts @@ -0,0 +1,19 @@ +@file:Suppress("UnstableApiUsage") + +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + +dependencyResolutionManagement { + repositories { + google() + mavenCentral() + } + + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} + +rootProject.name = "build-logic" +include(":convention") diff --git a/build.gradle.kts b/build.gradle.kts index b19fd58e9..a1f241014 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,26 +1,35 @@ -plugins { - id("com.android.application") version "7.4.1" apply false - id("com.android.library") version "7.4.1" apply false - id("org.jetbrains.kotlin.android") version "1.8.0" apply false - id("org.jetbrains.kotlin.jvm") version "1.8.0" apply false - id("com.google.dagger.hilt.android") version "2.44" apply false -} - buildscript { dependencies { - classpath("com.android.tools.build:gradle:7.4.1") - classpath("com.google.gms:google-services:4.3.15") - classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.2") - classpath("com.google.android.gms:oss-licenses-plugin:0.10.6") + val libs = project.extensions.getByType().named("libs") + val kotlinVersion = libs.findVersion("kotlin").get() + val gmsVersion = libs.findVersion("gms-google-services").get() + val gmsOosVersion = libs.findVersion("gms-oss-licenses-plugin").get() + val crashlyticsVersion = libs.findVersion("firebase-crashlytics-gradle").get() + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") + classpath("com.google.gms:google-services:$gmsVersion") + classpath("com.google.android.gms:oss-licenses-plugin:$gmsOosVersion") + classpath("com.google.firebase:firebase-crashlytics-gradle:$crashlyticsVersion") } } -allprojects { - configurations.all { - resolutionStrategy.force("org.objenesis:objenesis:2.6") - } +@Suppress("DSL_SCOPE_VIOLATION") +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.jvm) apply false + alias(libs.plugins.hilt) apply false + alias(libs.plugins.kotlin.serialization) apply false } -tasks.register("clean", Delete::class) { +// +// allprojects { +// configurations.all { +// resolutionStrategy.force("org.objenesis:objenesis:2.6") +// } +// } +// + +task("clean", Delete::class) { delete(rootProject.buildDir) } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index 1a4f1f410..000000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,8 +0,0 @@ -plugins { - `kotlin-dsl` // enable the Kotlin-DSL -} - -repositories { - google() - mavenCentral() -} diff --git a/buildSrc/src/main/kotlin/AppConfig.kt b/buildSrc/src/main/kotlin/AppConfig.kt deleted file mode 100644 index da4e17a4a..000000000 --- a/buildSrc/src/main/kotlin/AppConfig.kt +++ /dev/null @@ -1,9 +0,0 @@ -object AppConfig { - const val compileSdk = 33 - const val targetSdk = 33 - const val minSdk = 23 - const val versionCode = 1 - const val versionName = "1.0.0" - const val buildToolsVersion = "30.0.3" - const val jvmTarget = "11" -} diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt deleted file mode 100644 index 81110ba8b..000000000 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ /dev/null @@ -1,375 +0,0 @@ -import org.gradle.api.artifacts.dsl.DependencyHandler - -object Versions { - const val APP_COMPAT = "1.5.1" - const val CORE = "1.9.0" - const val CORE_SPLASH = "1.0.0" - const val CONSTRAINT_LAYOUT = "2.1.4" - const val MATERIAL = "1.7.0" - const val VIEWMODEL_KTX = "2.5.1" - const val FRAGMENT_KTX = "1.5.4" - const val COROUTINE = "1.6.4" - - const val ROOM = "2.4.3" - const val PAGING_KTX = "3.1.1" - - const val RETROFIT = "2.9.0" - const val MOSHI = "1.14.0" - const val JSON = "1.3.3" - - const val ZXING = "3.5.1" - - const val FIREBASE_BOM = "31.0.2" - const val TEXT_RECOGNITION_KOREAN = "16.0.0-beta6" - const val PLAY_SERVICES_AUTH = "20.3.0" - - const val BIOMETRIC = "1.1.0" - - const val WORK_MANAGER = "2.7.1" - - const val HILT = "2.44" - const val INJECT = "1" - const val HILT_WORK = "1.0.0" - - const val NAVER_MAP = "3.16.0" - const val PLAY_SERVICES_LOCATION = "20.0.0" - - const val GLIDE = "4.14.2" - const val LANDSCAPIST_GLIDE = "2.1.0" - const val VIEW_PAGER2 = "2:1.0.0" - - const val JUNIT = "4.13.2" - const val ANDROID_JUNIT = "1.1.3" - const val ESPRESSO = "3.4.0" - const val JUNIT5 = "5.8.2" - const val MOCK = "1.12.0" - const val GOOGLE_TRUTH = "1.1.3" - const val COROUTINES_TEST = "1.6.0" - const val MOCK_TEST = "2.28.2" - const val TURBINE = "0.12.1" - - const val TIMBER = "4.7.1" - const val DATASTORE = "1.1.0-alpha01" - - const val APP_COMPAT_THEME = "0.25.1" // 컴포즈에서 AppTheme 을 사용 - const val KOTLIN_COMPILER_EXTENSION = "1.4.0" - const val COMPOSE_BOM = "2022.10.00" - const val COMPOSE_ACTIVITIES = "1.5.1" - const val COMPOSE_VIEWMODEL = "2.5.1" - const val COMPOSE_ACCOMPANIST = "0.28.0" - - const val SHIMMER = "0.5.0" - const val LOTTIE = "5.2.0" - - const val GLANCE = "1.0.0-alpha05" - - const val OSS = "17.0.0" -} - -object Libraries { - // androidX + KTX - private const val CORE = "androidx.core:core-ktx:${Versions.CORE}" - private const val CORE_SPLASH = "androidx.core:core-splashscreen:${Versions.CORE_SPLASH}" - private const val APP_COMPAT = "androidx.appcompat:appcompat:${Versions.APP_COMPAT}" - private const val CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout:${Versions.CONSTRAINT_LAYOUT}" - private const val MATERIAL = "com.google.android.material:material:${Versions.MATERIAL}" - private const val VIEWMODEL_KTX = "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.VIEWMODEL_KTX}" - private const val FRAGMENT_KTX = "androidx.fragment:fragment-ktx:${Versions.FRAGMENT_KTX}" - - private const val COROUTINE_CORE = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.COROUTINE}" - private const val COROUTINE_ANDROID = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.COROUTINE}" - - private const val ROOM_RUNTIME = "androidx.room:room-runtime:${Versions.ROOM}" - private const val ROOM_KTX = "androidx.room:room-ktx:${Versions.ROOM}" - private const val ROOM_COMMON = "androidx.room:room-common:${Versions.ROOM}" - - private const val ZXING = "com.google.zxing:core:${Versions.ZXING}" - - private const val RETROFIT = "com.squareup.retrofit2:retrofit:${Versions.RETROFIT}" - private const val MOSHI_KOTLIN = "com.squareup.moshi:moshi-kotlin:${Versions.MOSHI}" - private const val MOSHI_ADAPTERS = "com.squareup.moshi:moshi-adapters:${Versions.MOSHI}" - private const val CONVERTER_MOSHI = "com.squareup.retrofit2:converter-moshi:${Versions.RETROFIT}" - private const val JSON = "org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.JSON}" - - private const val PAGING_COMMON_KTX = "androidx.paging:paging-common-ktx:${Versions.PAGING_KTX}" - private const val PAGING_RUNTIME_KTX = "androidx.paging:paging-runtime:${Versions.PAGING_KTX}" - - const val FIREBASE_BOM = "com.google.firebase:firebase-bom:${Versions.FIREBASE_BOM}" - const val COMPOSE_BOM = "androidx.compose:compose-bom:${Versions.COMPOSE_BOM}" - - private const val PLAY_SERVICES_AUTH = "com.google.android.gms:play-services-auth:${Versions.PLAY_SERVICES_AUTH}" - private const val FIREBASE_AUTH_KTX = "com.google.firebase:firebase-auth-ktx" - private const val FIREBASE_FIRESTORE_KTX = "com.google.firebase:firebase-firestore-ktx" - private const val FIREBASE_STORAGE_KTX = "com.google.firebase:firebase-storage-ktx" - private const val FIREBASE_CRASHLYTICS_NDK = "com.google.firebase:firebase-crashlytics-ndk" - private const val FIREBASE_CRASHLYTICS_KTX = "com.google.firebase:firebase-crashlytics-ktx" - private const val FIREBASE_ANALYTICS_KTX = "com.google.firebase:firebase-analytics-ktx" - private const val TEXT_RECOGNITION_KOREAN = "com.google.mlkit:text-recognition-korean:${Versions.TEXT_RECOGNITION_KOREAN}" - - private const val BIOMETRIC = "androidx.biometric:biometric:${Versions.BIOMETRIC}" - - private const val WORK_MANAGER = "androidx.work:work-runtime-ktx:${Versions.WORK_MANAGER}" - - private const val HILT = "com.google.dagger:hilt-android:${Versions.HILT}" - private const val INJECT = "javax.inject:javax.inject:${Versions.INJECT}" - private const val HILT_WORK = "androidx.hilt:hilt-work:${Versions.HILT_WORK}" - - private const val NAVER_MAP = "com.naver.maps:map-sdk:${Versions.NAVER_MAP}" - private const val PLAY_SERVICES_LOCATION = - "com.google.android.gms:play-services-location:${Versions.PLAY_SERVICES_LOCATION}" - - private const val GLIDE = "com.github.bumptech.glide:glide:${Versions.GLIDE}" - private const val LANDSCAPIST_GLIDE = "com.github.skydoves:landscapist-glide:${Versions.LANDSCAPIST_GLIDE}" - - private const val VIEW_PAGER2 = "androidx.viewpager2:viewpager${Versions.VIEW_PAGER2}" - - private const val TIMBER = "com.jakewharton.timber:timber:${Versions.TIMBER}" - private const val DATASTORE_CORE = "androidx.datastore:datastore-preferences-core:${Versions.DATASTORE}" - private const val DATASTORE = "androidx.datastore:datastore-preferences:${Versions.DATASTORE}" - - private const val COMPOSE_APP_COMPAT_THEME = - "com.google.accompanist:accompanist-appcompat-theme:${Versions.APP_COMPAT_THEME}" - - private const val COMPOSE_MATERIAL = "androidx.compose.material:material" - private const val COMPOSE_PREVIEW = "androidx.compose.ui:ui-tooling-preview" - private const val COMPOSE_ICONS = "androidx.compose.material:material-icons-extended" - private const val COMPOSE_ACTIVITIES = "androidx.activity:activity-compose:${Versions.COMPOSE_ACTIVITIES}" - private const val COMPOSE_VIEWMODEL = "androidx.lifecycle:lifecycle-viewmodel-compose:${Versions.COMPOSE_VIEWMODEL}" - private const val COMPOSE_LIFECYCLE_RUNTIME = "androidx.lifecycle:lifecycle-runtime-compose:+" - private const val COMPOSE_ACCOMPANIST_FLOWLAYOUT = - "com.google.accompanist:accompanist-flowlayout:${Versions.COMPOSE_ACCOMPANIST}" - private const val COMPOSE_ACCOMPANIST_PLACEHOLDER = - "com.google.accompanist:accompanist-placeholder-material:${Versions.COMPOSE_ACCOMPANIST}" - - private const val SHIMMER = "com.facebook.shimmer:shimmer:${Versions.SHIMMER}" - private const val LOTTIE = "com.airbnb.android:lottie:${Versions.LOTTIE}" - - private const val GLANCE = "androidx.glance:glance-appwidget:${Versions.GLANCE}" - - private const val OSS_LICENSES = "com.google.android.gms:play-services-oss-licenses:${Versions.OSS}" - - val VIEW_LIBRARIES = arrayListOf( - CORE, - CORE_SPLASH, - APP_COMPAT, - CONSTRAINT_LAYOUT, - MATERIAL, - COROUTINE_CORE, - COROUTINE_ANDROID, - HILT, - HILT_WORK, - VIEWMODEL_KTX, - FRAGMENT_KTX, - PAGING_RUNTIME_KTX, - FIREBASE_AUTH_KTX, - FIREBASE_CRASHLYTICS_NDK, - FIREBASE_CRASHLYTICS_KTX, - FIREBASE_ANALYTICS_KTX, - PLAY_SERVICES_AUTH, - BIOMETRIC, - NAVER_MAP, - PLAY_SERVICES_LOCATION, - GLIDE, - LANDSCAPIST_GLIDE, - ZXING, - VIEW_PAGER2, - TIMBER, - COMPOSE_APP_COMPAT_THEME, - COMPOSE_MATERIAL, - COMPOSE_PREVIEW, - COMPOSE_ICONS, - COMPOSE_ACTIVITIES, - COMPOSE_VIEWMODEL, - COMPOSE_LIFECYCLE_RUNTIME, - COMPOSE_ACCOMPANIST_FLOWLAYOUT, - COMPOSE_LIFECYCLE_RUNTIME, - COMPOSE_ACCOMPANIST_PLACEHOLDER, - SHIMMER, - LOTTIE, - WORK_MANAGER, - GLANCE, - JSON, - OSS_LICENSES - ) - val DATA_LIBRARIES = arrayListOf( - ROOM_RUNTIME, - ROOM_KTX, - COROUTINE_CORE, - RETROFIT, - MOSHI_KOTLIN, - MOSHI_ADAPTERS, - CONVERTER_MOSHI, - HILT, - HILT_WORK, - FIREBASE_AUTH_KTX, - FIREBASE_FIRESTORE_KTX, - FIREBASE_STORAGE_KTX, - TEXT_RECOGNITION_KOREAN, - WORK_MANAGER, - TIMBER, - DATASTORE, - DATASTORE_CORE, - PLAY_SERVICES_LOCATION - ) - val DOMAIN_LIBRARIES = arrayListOf( - COROUTINE_CORE, - INJECT, - PAGING_COMMON_KTX, - ROOM_COMMON - ) - val APP_LIBRARIES = arrayListOf( - HILT, - HILT_WORK, - WORK_MANAGER, - RETROFIT, - MOSHI_KOTLIN, - MOSHI_ADAPTERS, - CONVERTER_MOSHI, - ROOM_RUNTIME, - ROOM_KTX, - TIMBER, - DATASTORE, - DATASTORE_CORE, - FIREBASE_AUTH_KTX, - OSS_LICENSES - ) -} - -object TestImpl { - private const val JUNIT4 = "junit:junit:${Versions.JUNIT}" - private const val PAGING_COMMON = "androidx.paging:paging-common:${Versions.PAGING_KTX}" - - private const val JUNIT_JUPITER_PARAMS = "org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT5}" - private const val JUNIT_JUPITER_ENGINE = "org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT5}" - private const val JUNIT_VINTAGE_ENGINE = "org.junit.vintage:junit-vintage-engine:${Versions.JUNIT5}" - private const val MOCK = "io.mockk:mockk:${Versions.MOCK}" - private const val GOOGLE_TRUTH = "com.google.truth:truth:${Versions.GOOGLE_TRUTH}" - private const val COROUTINES_TEST = "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.COROUTINES_TEST}" - private const val TEST_CORE = "androidx.test:core:1.5.0" - private const val ROBOLECTRIC = "org.robolectric:robolectric:4.9" - private const val TURBINE = "app.cash.turbine:turbine:${Versions.TURBINE}" - - val TEST_LIBRARIES = arrayListOf( - JUNIT4, - PAGING_COMMON, - JUNIT_JUPITER_PARAMS, - JUNIT_JUPITER_ENGINE, - JUNIT_VINTAGE_ENGINE, - MOCK, - GOOGLE_TRUTH, - COROUTINES_TEST, - ROBOLECTRIC, - TURBINE - ) - - val ANDROID_TEST_LIBRARIES = arrayListOf( - TEST_CORE - ) -} - -object AndroidTestImpl { - private const val ANDROID_JUNIT = "androidx.test.ext:junit:${Versions.ANDROID_JUNIT}" - private const val ESPRESSO = "androidx.test.espresso:espresso-core:${Versions.ESPRESSO}" - private const val MOCKITO_CORE = "org.mockito:mockito-core:${Versions.MOCK_TEST}" - private const val MOCKITO_ANDROID = "org.mockito:mockito-android:${Versions.MOCK_TEST}" - private const val WORK_MANAGER = "androidx.work:work-testing:${Versions.WORK_MANAGER}" - - val VIEW_LIBRARIES = arrayListOf( - ANDROID_JUNIT, - ESPRESSO, - WORK_MANAGER - ) - - val DATA_LIBRARIES = arrayListOf( - MOCKITO_CORE, - MOCKITO_ANDROID - ) -} - -object AnnotationProcessors { - private const val ROOM_COMPILER = "androidx.room:room-compiler:${Versions.ROOM}" - private const val GLIDE_COMPILER = "com.github.bumptech.glide:compiler:${Versions.GLIDE}" - - val VIEW_LIBRARIES = arrayListOf( - GLIDE_COMPILER - ) - - val DATA_LIBRARIES = arrayListOf( - ROOM_COMPILER - ) - - val APP_LIBRARIES = arrayListOf( - ROOM_COMPILER - ) -} - -object Kapt { - private const val HILT = "com.google.dagger:hilt-android-compiler:${Versions.HILT}" - private const val HILT_WORK = "androidx.hilt:hilt-compiler:${Versions.HILT_WORK}" - - private const val ROOM_COMPILER = "androidx.room:room-compiler:${Versions.ROOM}" - private const val MOSHI_KOTLIN_CODEGEN = "com.squareup.moshi:moshi-kotlin-codegen:${Versions.MOSHI}" - - val VIEW_LIBRARIES = arrayListOf( - HILT, - HILT_WORK - ) - - val DATA_LIBRARIES = arrayListOf( - ROOM_COMPILER, - MOSHI_KOTLIN_CODEGEN, - HILT, - HILT_WORK - ) - - val APP_LIBRARIES = arrayListOf( - HILT, - HILT_WORK, - ROOM_COMPILER, - MOSHI_KOTLIN_CODEGEN - ) -} - -object DebugImpl { - private const val COMPOSE_PREVIEW_DEBUG = "androidx.compose.ui:ui-tooling" - - val VIEW_LIBRARIES = arrayListOf( - COMPOSE_PREVIEW_DEBUG - ) -} - -fun DependencyHandler.kapt(list: List) { - list.forEach { dependency -> - add("kapt", dependency) - } -} - -fun DependencyHandler.implementation(list: List) { - list.forEach { dependency -> - add("implementation", dependency) - } -} - -fun DependencyHandler.androidTestImplementation(list: List) { - list.forEach { dependency -> - add("androidTestImplementation", dependency) - } -} - -fun DependencyHandler.annotationProcessor(list: List) { - list.forEach { dependency -> - add("annotationProcessor", dependency) - } -} - -fun DependencyHandler.testImplementation(list: List) { - list.forEach { dependency -> - add("testImplementation", dependency) - } -} - -fun DependencyHandler.debugImplementation(list: List) { - list.forEach { dependency -> - add("debugImplementation", dependency) - } -} diff --git a/data/build.gradle.kts b/data/build.gradle.kts index 013272afe..44357e13e 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -1,47 +1,55 @@ +@Suppress("DSL_SCOPE_VIOLATION") plugins { - id("com.android.library") - id("org.jetbrains.kotlin.android") - kotlin("kapt") + id("beep.android.library") + alias(libs.plugins.ksp) } android { namespace = "com.lighthouse.data" - compileSdk = AppConfig.compileSdk - - defaultConfig { - minSdk = AppConfig.minSdk - targetSdk = AppConfig.targetSdk - - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - getByName("release") { - isMinifyEnabled = false - proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") - } - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - } - - kotlinOptions { - jvmTarget = "1.8" - } } dependencies { - implementation(project(":domain")) - - implementation(platform(Libraries.FIREBASE_BOM)) - implementation(Libraries.DATA_LIBRARIES) - annotationProcessor(AnnotationProcessors.DATA_LIBRARIES) - kapt(Kapt.DATA_LIBRARIES) - implementation(TestImpl.TEST_LIBRARIES) - implementation(TestImpl.ANDROID_TEST_LIBRARIES) -} -kapt { - correctErrorTypes = true + implementation(projects.domain) + + implementation(libs.androidX.room.runtime) + implementation(libs.androidX.room.ktx) + implementation(libs.androidX.hilt.work) + implementation(libs.androidX.paging.runtime) + implementation(libs.androidX.work.runtime.ktx) + implementation(libs.androidX.datastore.preferences) + implementation(libs.androidX.core.ktx) + + implementation(libs.kotlin.coroutine.core) + + implementation(libs.squareup.retrofit2) + implementation(libs.squareup.retrofit2.converter.moshi) + implementation(libs.squareup.moshi.kotlin) + implementation(libs.squareup.moshi.adapters) + + implementation(platform(libs.firebase.bom)) + implementation(libs.firebase.auth.ktx) + implementation(libs.firebase.firestore.ktx) + implementation(libs.firebase.storage.ktx) + implementation(libs.mlkit.text.recognition.korean) + + implementation(libs.gms.play.services.location) + + implementation(libs.timber) + + ksp(libs.androidX.room.compiler) + ksp(libs.squareup.moshi.kotlin.codegen) + + testImplementation(libs.junit4) + testImplementation(libs.junit5.jupiter.params) + testImplementation(libs.junit5.jupiter.engine) + testImplementation(libs.junit5.vintage.engine) + testImplementation(libs.mockk) + testImplementation(libs.google.truth) + testImplementation(libs.kotlin.coroutine.test) + testImplementation(libs.robolectric) + testImplementation(libs.turbine) + + androidTestImplementation(libs.test.core) + androidTestImplementation(libs.mockito.core) + androidTestImplementation(libs.mockito.android) } diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts index 84133454d..62639fde3 100644 --- a/domain/build.gradle.kts +++ b/domain/build.gradle.kts @@ -1,18 +1,20 @@ plugins { - id("java-library") - id("org.jetbrains.kotlin.jvm") - kotlin("kapt") -} - -java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + id("beep.java.library") } dependencies { - implementation(Libraries.DOMAIN_LIBRARIES) - testImplementation(TestImpl.TEST_LIBRARIES) -} -kapt { - correctErrorTypes = true + implementation(libs.kotlin.coroutine.core) + implementation(libs.androidX.paging.common.ktx) + implementation(libs.androidX.room.common) + implementation(libs.javax.inject) + + testImplementation(libs.junit4) + testImplementation(libs.junit5.jupiter.params) + testImplementation(libs.junit5.jupiter.engine) + testImplementation(libs.junit5.vintage.engine) + testImplementation(libs.mockk) + testImplementation(libs.google.truth) + testImplementation(libs.kotlin.coroutine.test) + testImplementation(libs.robolectric) + testImplementation(libs.turbine) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..34d6ee9f3 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,163 @@ +[versions] +androidStudioGradlePlugin = "7.4.0" + +# AndroidX +lifecycle = "2.6.0-alpha04" +paging = "3.1.1" +room = "2.4.3" +hilt-work = "1.0.0" +work = "2.7.1" +compose-compiler = "1.4.0" + +# 3rd-party +## Accompanist +accompanist = "0.28.0" +## Dagger +dagger = "2.44" +## Kotlin +kotlin = "1.8.0" +kotlin-coroutine = "1.6.4" +ksp = "1.8.0-1.0.8" +## Squareup +retrofit = "2.9.0" +moshi = "1.14.0" +## Glide +glide = "4.14.2" +## gms +gms-google-services = "4.3.15" +gms-oss-licenses-plugin = "0.10.6" +## firebase +firebase-crashlytics-gradle = "2.9.2" + +# test +junit5 = "5.8.2" +coroutines-test = "1.6.0" + +# Android Test +mockito = "2.28.2" + +[libraries] +# AndroidX +androidX-appcompat = "androidx.appcompat:appcompat:1.5.1" +androidX-biometric = "androidx.biometric:biometric:1.1.0" +androidX-core-ktx = "androidx.core:core-ktx:1.9.0" +androidX-core-splashscreen = "androidx.core:core-splashscreen:1.0.0" +androidX-constraintlayout = "androidx.constraintlayout:constraintlayout:2.1.4" +androidX-compose-bom = "androidx.compose:compose-bom:2022.10.00" +androidX-compose-material = { module = "androidx.compose.material:material" } +androidX-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" } +androidX-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" } +androidX-compose-icons-extended = { module = "androidx.compose.material:material-icons-extended" } +androidX-compose-activity = "androidx.activity:activity-compose:1.5.1" +androidX-compose-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycle" } +androidX-compose-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "lifecycle" } +androidX-datastore-preferences = "androidx.datastore:datastore-preferences:1.1.0-alpha01" +androidX-fragment-ktx = "androidx.fragment:fragment-ktx:1.5.4" +androidX-glance-appwidget = "androidx.glance:glance-appwidget:1.0.0-alpha05" +androidX-hilt-work = { module = "androidx.hilt:hilt-work", version.ref = "hilt-work" } +androidX-hilt-compiler = { module = "androidx.hilt:hilt-compiler", version.ref = "hilt-work" } +androidX-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version = "lifecycle" } +androidX-paging-common-ktx = { module = "androidx.paging:paging-common-ktx", version.ref = "paging" } +androidX-paging-runtime = { module = "androidx.paging:paging-runtime", version.ref = "paging" } +androidX-room-common = { module = "androidx.room:room-common", version.ref = "room" } +androidX-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" } +androidX-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" } +androidX-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" } +androidX-viewpager2 = "androidx.viewpager2:viewpager2:1.0.0" +androidX-work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "work" } +androidX-work-testing = { module = "androidx.work:work-testing", version.ref = "work" } +# 3rd-party +## Accompanist +accompanist-appcompat-theme = { module = "com.google.accompanist:accompanist-appcompat-theme", version.ref = "accompanist" } +accompanist-flowlayout = { module = "com.google.accompanist:accompanist-flowlayout", version.ref = "accompanist" } +accompanist-placeholder-material = { module = "com.google.accompanist:accompanist-placeholder-material", version.ref = "accompanist" } +## Dagger +dagger-hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "dagger" } +dagger-hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "dagger" } +javax-inject = "javax.inject:javax.inject:1" +## kotlin +kotlin-coroutine-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutine" } +kotlin-coroutine-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlin-coroutine" } +kotlin-coroutine-test = "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0" +kotlin-serialization-json = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3" +## Material +material = "com.google.android.material:material:1.7.0" +## GMS (google mobile service) +gms-play-services-auth = "com.google.android.gms:play-services-auth:20.3.0" +gms-play-services-location = "com.google.android.gms:play-services-location:20.0.0" +gms-play-services-oss-licences = "com.google.android.gms:play-services-oss-licenses:17.0.0" +## Firebase +firebase-bom = "com.google.firebase:firebase-bom:31.0.2" +firebase-auth-ktx = { module = "com.google.firebase:firebase-auth-ktx" } +firebase-firestore-ktx = { module = "com.google.firebase:firebase-firestore-ktx" } +firebase-storage-ktx = { module = "com.google.firebase:firebase-storage-ktx" } +firebase-crashlytics-ndk = { module = "com.google.firebase:firebase-crashlytics-ndk" } +firebase-crashlytics-ktx = { module = "com.google.firebase:firebase-crashlytics-ktx" } +firebase-analytics-ktx = { module = "com.google.firebase:firebase-analytics-ktx" } +## MLKit +mlkit-text-recognition-korean = "com.google.mlkit:text-recognition-korean:16.0.0-beta6" +## Zxing +zxing-core = "com.google.zxing:core:3.5.1" +## Squareup +squareup-retrofit2 = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } +squareup-moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshi" } +squareup-moshi-kotlin-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" } +squareup-moshi-adapters = { module = "com.squareup.moshi:moshi-adapters", version.ref = "moshi" } +squareup-retrofit2-converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" } +## Naver Map +naver-map-sdk = "com.naver.maps:map-sdk:3.16.0" +## Glide +glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" } +glide-ksp = { module = "com.github.bumptech.glide:ksp", version.ref = "glide" } +landscapist-glide = "com.github.skydoves:landscapist-glide:2.1.0" +## Timber +timber = "com.jakewharton.timber:timber:4.7.1" +## Facebook +facebook-shimmer = "com.facebook.shimmer:shimmer:0.5.0" +## Airbnb +airbnb-lottie = "com.airbnb.android:lottie:5.2.0" + +# Test +junit4 = "junit:junit:4.13.2" +junit5-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit5" } +junit5-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit5" } +junit5-vintage-engine = { module = "org.junit.vintage:junit-vintage-engine", version.ref = "junit5" } +mockk = "io.mockk:mockk:1.12.0" +google-truth = "com.google.truth:truth:1.1.3" +test-core = "androidx.test:core:1.5.0" +robolectric = "org.robolectric:robolectric:4.9" +turbine = "app.cash.turbine:turbine:0.12.1" + +# Android Test +android-junit = "androidx.test.ext:junit:1.1.3" +espresso-core = "androidx.test.espresso:espresso-core:3.4.0" +mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" } +mockito-android = { module = "org.mockito:mockito-android", version.ref = "mockito" } + +android-gradlePlugin = { module = "com.android.tools.build:gradle", version.ref = "androidStudioGradlePlugin" } +kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +hilt-gradlePlugin = { group = "com.google.dagger", name = "hilt-android-gradle-plugin", version.ref = "dagger" } + +[bundles] +androidX-compose = [ + "androidX-compose-material", + "androidX-compose-icons-extended", + "androidX-compose-ui-tooling-preview", +] +androidX-compose-lifecycle = [ + "androidX-compose-lifecycle-viewmodel", + "androidX-compose-lifecycle-runtime" +] +androidX-compose-debug = [ + "androidX-compose-ui-tooling" +] + +[plugins] +android-application = { id = "com.android.application", version.ref = "androidStudioGradlePlugin" } +android-library = { id = "com.android.library", version.ref = "androidStudioGradlePlugin" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +hilt = { id = "com.google.dagger.hilt.android", version.ref = "dagger" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c74dec988..e3c5d931a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Nov 07 15:45:14 KST 2022 +#Sun Feb 05 00:10:25 KST 2023 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts index f2204c558..ffa59ff39 100644 --- a/presentation/build.gradle.kts +++ b/presentation/build.gradle.kts @@ -1,86 +1,84 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - +@Suppress("DSL_SCOPE_VIOLATION") plugins { - id("com.android.library") + id("beep.android.library") + id("beep.android.library.compose") + id("beep.android.hilt") id("kotlin-parcelize") - id("org.jetbrains.kotlin.android") - id("dagger.hilt.android.plugin") id("com.google.gms.google-services") id("com.google.firebase.crashlytics") - kotlin("kapt") - kotlin("plugin.serialization") version "1.5.0" + alias(libs.plugins.ksp) + alias(libs.plugins.kotlin.serialization) } android { namespace = "com.lighthouse.presentation" - compileSdk = AppConfig.compileSdk - - defaultConfig { - minSdk = AppConfig.minSdk - targetSdk = AppConfig.targetSdk - - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - testInstrumentationRunnerArguments["runnerBuilder"] = "de.mannodermaus.junit5.AndroidJUnit5Builder" - } - - buildTypes { - getByName("release") { - isMinifyEnabled = false - proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") - } - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - } - - kotlinOptions { - jvmTarget = AppConfig.jvmTarget - } - - buildFeatures { - dataBinding = true - compose = true - } - - composeOptions { - kotlinCompilerExtensionVersion = Versions.KOTLIN_COMPILER_EXTENSION - } - - testOptions { - unitTests { - isReturnDefaultValues = true - isIncludeAndroidResources = true - } - } } dependencies { - implementation(project(":domain")) - - implementation(platform(Libraries.FIREBASE_BOM)) - implementation(platform(Libraries.COMPOSE_BOM)) - implementation(Libraries.VIEW_LIBRARIES) - testImplementation(TestImpl.TEST_LIBRARIES) - kapt(Kapt.VIEW_LIBRARIES) - debugImplementation(DebugImpl.VIEW_LIBRARIES) - androidTestImplementation(AndroidTestImpl.VIEW_LIBRARIES) - annotationProcessor(AnnotationProcessors.VIEW_LIBRARIES) -} + implementation(projects.domain) -kapt { - correctErrorTypes = true -} + implementation(libs.androidX.core.ktx) + implementation(libs.androidX.core.splashscreen) + implementation(libs.androidX.appcompat) + implementation(libs.androidX.constraintlayout) + implementation(libs.androidX.hilt.work) + implementation(libs.androidX.lifecycle.viewmodel.ktx) + implementation(libs.androidX.fragment.ktx) + implementation(libs.androidX.paging.runtime) + implementation(libs.androidX.biometric) + implementation(libs.androidX.viewpager2) + implementation(libs.androidX.work.runtime.ktx) + implementation(libs.androidX.glance.appwidget) + + implementation(libs.kotlin.coroutine.core) + implementation(libs.kotlin.coroutine.android) + implementation(libs.kotlin.serialization.json) + + implementation(libs.material) + + implementation(libs.accompanist.appcompat.theme) + implementation(libs.accompanist.flowlayout) + implementation(libs.accompanist.placeholder.material) + + implementation(platform(libs.firebase.bom)) + implementation(libs.firebase.auth.ktx) + implementation(libs.firebase.crashlytics.ndk) + implementation(libs.firebase.crashlytics.ktx) + implementation(libs.firebase.analytics.ktx) + + implementation(libs.gms.play.services.auth) + implementation(libs.gms.play.services.location) + implementation(libs.gms.play.services.oss.licences) + + implementation(libs.glide) + implementation(libs.landscapist.glide) -tasks.withType { - kotlinOptions { - freeCompilerArgs = listOf("-Xjsr305=strict") - jvmTarget = "1.8" - } + implementation(libs.naver.map.sdk) + + implementation(libs.zxing.core) + + implementation(libs.timber) + + implementation(libs.facebook.shimmer) + + implementation(libs.airbnb.lottie) + + ksp(libs.glide.ksp) + + testImplementation(libs.junit4) + testImplementation(libs.junit5.jupiter.params) + testImplementation(libs.junit5.jupiter.engine) + testImplementation(libs.junit5.vintage.engine) + testImplementation(libs.mockk) + testImplementation(libs.google.truth) + testImplementation(libs.kotlin.coroutine.test) + testImplementation(libs.robolectric) + testImplementation(libs.turbine) + + androidTestImplementation(libs.test.core) } // JUnit5 -tasks.withType { - useJUnitPlatform() -} +// tasks.withType { +// useJUnitPlatform() +// } diff --git a/settings.gradle.kts b/settings.gradle.kts index 159d2fdb2..b690fcea5 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,8 +1,11 @@ +@file:Suppress("UnstableApiUsage") + pluginManagement { + includeBuild("build-logic") repositories { - gradlePluginPortal() google() mavenCentral() + gradlePluginPortal() } } @@ -16,4 +19,16 @@ dependencyResolutionManagement { } rootProject.name = "BEEP" -include("app", "data", "presentation", "domain") +fun includeProject(moduleName: String, rootFolderName: String = "") { + settings.include(moduleName) + + if (rootFolderName.isNotEmpty()) { + project(moduleName).projectDir = + File(rootDir, "$rootFolderName/${moduleName.substring(startIndex = 1)}") + } +} + +includeProject(":app") +includeProject(":data") +includeProject(":presentation") +includeProject(":domain")