diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6e65117a..dbf6bc2b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -67,7 +67,8 @@ dependencies { implementation(project(":feature:home")) implementation(project(":domain")) implementation(project(":data")) - implementation(project(":core")) + implementation(project(":core:coroutine")) + implementation(project(":core:designsystem")) implementation(libs.core.ktx) implementation(libs.kotlin.android) diff --git a/app/src/main/java/com/mashup/dorabangs/MainActivity.kt b/app/src/main/java/com/mashup/dorabangs/MainActivity.kt index 9f71a0b7..c9fb99e6 100644 --- a/app/src/main/java/com/mashup/dorabangs/MainActivity.kt +++ b/app/src/main/java/com/mashup/dorabangs/MainActivity.kt @@ -3,7 +3,7 @@ package com.mashup.dorabangs import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent -import com.mashup.dorabangs.core.designsystem.DorabangsTheme +import com.mashup.dorabangs.core.designsystem.theme.DorabangsTheme import com.mashup.dorabangs.navigation.MainNavGraph import dagger.hilt.android.AndroidEntryPoint diff --git a/core/coroutine/.gitignore b/core/coroutine/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/core/coroutine/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/core/coroutine/build.gradle.kts b/core/coroutine/build.gradle.kts new file mode 100644 index 00000000..4a613474 --- /dev/null +++ b/core/coroutine/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + alias(libs.plugins.com.android.library) + alias(libs.plugins.org.jetbrains.kotlin.android) +} + +android { + namespace = "com.mashup.dorabangs.core.coroutine" + compileSdk = 34 + + defaultConfig { + minSdk = 24 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro", + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_18 + targetCompatibility = JavaVersion.VERSION_18 + } + kotlinOptions { + jvmTarget = "18" + } +} + +dependencies { + + implementation(libs.core.ktx) + implementation(libs.appcompat) + implementation(libs.material) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.test.ext.junit) + androidTestImplementation(libs.espresso.core) +} diff --git a/core/consumer-rules.pro b/core/coroutine/consumer-rules.pro similarity index 100% rename from core/consumer-rules.pro rename to core/coroutine/consumer-rules.pro diff --git a/core/proguard-rules.pro b/core/coroutine/proguard-rules.pro similarity index 100% rename from core/proguard-rules.pro rename to core/coroutine/proguard-rules.pro diff --git a/core/src/androidTest/java/com/mashup/dorabangs/core/ExampleInstrumentedTest.kt b/core/coroutine/src/androidTest/java/com/mashup/dorabangs/core/coroutine/ExampleInstrumentedTest.kt similarity index 81% rename from core/src/androidTest/java/com/mashup/dorabangs/core/ExampleInstrumentedTest.kt rename to core/coroutine/src/androidTest/java/com/mashup/dorabangs/core/coroutine/ExampleInstrumentedTest.kt index 408fe1b8..5cd06fbb 100644 --- a/core/src/androidTest/java/com/mashup/dorabangs/core/ExampleInstrumentedTest.kt +++ b/core/coroutine/src/androidTest/java/com/mashup/dorabangs/core/coroutine/ExampleInstrumentedTest.kt @@ -1,4 +1,4 @@ -package com.mashup.dorabangs.core +package com.mashup.dorabangs.core.coroutine import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry @@ -17,6 +17,6 @@ class ExampleInstrumentedTest { fun useAppContext() { // Context of the app under test. val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("com.mashup.dorabangs.core.test", appContext.packageName) + assertEquals("com.mashup.dorabangs.core.coroutine.test", appContext.packageName) } } diff --git a/core/src/main/AndroidManifest.xml b/core/coroutine/src/main/AndroidManifest.xml similarity index 100% rename from core/src/main/AndroidManifest.xml rename to core/coroutine/src/main/AndroidManifest.xml diff --git a/core/coroutine/src/main/java/com/mashup/dorabangs/core/coroutine/CoroutineExtensions.kt b/core/coroutine/src/main/java/com/mashup/dorabangs/core/coroutine/CoroutineExtensions.kt new file mode 100644 index 00000000..7af92de4 --- /dev/null +++ b/core/coroutine/src/main/java/com/mashup/dorabangs/core/coroutine/CoroutineExtensions.kt @@ -0,0 +1,26 @@ +package com.mashup.dorabangs.core.coroutine + +import android.util.Log +import kotlinx.coroutines.CoroutineExceptionHandler +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.launch + +private val coroutineExceptionHandler = + CoroutineExceptionHandler { _, throwable -> + // timber 넣을랬는뎅 물어보고 넣자~ + Log.e("Dorabangs", "dorabangs exception: ${throwable.message}", throwable) + when (throwable) { + is RuntimeException -> { + // 예시 공통 다이얼로그? + } + + else -> { + // TODO + } + } + } + +fun CoroutineScope.doraLaunch(block: suspend CoroutineScope.() -> Unit) = + launch(context = coroutineContext + coroutineExceptionHandler) { + block.invoke(this) + } diff --git a/core/src/test/java/com/mashup/dorabangs/core/ExampleUnitTest.kt b/core/coroutine/src/test/java/com/mashup/dorabangs/core/coroutine/ExampleUnitTest.kt similarity index 88% rename from core/src/test/java/com/mashup/dorabangs/core/ExampleUnitTest.kt rename to core/coroutine/src/test/java/com/mashup/dorabangs/core/coroutine/ExampleUnitTest.kt index c88a9bc1..82ba8053 100644 --- a/core/src/test/java/com/mashup/dorabangs/core/ExampleUnitTest.kt +++ b/core/coroutine/src/test/java/com/mashup/dorabangs/core/coroutine/ExampleUnitTest.kt @@ -1,4 +1,4 @@ -package com.mashup.dorabangs.core +package com.mashup.dorabangs.core.coroutine import org.junit.Assert.assertEquals import org.junit.Test diff --git a/core/designsystem/.gitignore b/core/designsystem/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/core/designsystem/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/core/build.gradle.kts b/core/designsystem/build.gradle.kts similarity index 92% rename from core/build.gradle.kts rename to core/designsystem/build.gradle.kts index b0f8dbbf..e82e0437 100644 --- a/core/build.gradle.kts +++ b/core/designsystem/build.gradle.kts @@ -1,11 +1,10 @@ -@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed plugins { alias(libs.plugins.com.android.library) alias(libs.plugins.org.jetbrains.kotlin.android) } android { - namespace = "com.mashup.dorabangs.core" + namespace = "com.mashup.dorabangs.core.designsystem" compileSdk = 34 defaultConfig { @@ -24,14 +23,12 @@ android { ) } } - buildFeatures { compose = true } composeOptions { kotlinCompilerExtensionVersion = "1.4.3" } - compileOptions { sourceCompatibility = JavaVersion.VERSION_18 targetCompatibility = JavaVersion.VERSION_18 diff --git a/core/designsystem/consumer-rules.pro b/core/designsystem/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/core/designsystem/proguard-rules.pro b/core/designsystem/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/core/designsystem/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/core/designsystem/src/androidTest/java/com/mashup/dorabangs/core/designsystem/ExampleInstrumentedTest.kt b/core/designsystem/src/androidTest/java/com/mashup/dorabangs/core/designsystem/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..4935feb3 --- /dev/null +++ b/core/designsystem/src/androidTest/java/com/mashup/dorabangs/core/designsystem/ExampleInstrumentedTest.kt @@ -0,0 +1,22 @@ +package com.mashup.dorabangs.core.designsystem + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.mashup.dorabangs.core.designsystem.test", appContext.packageName) + } +} diff --git a/core/designsystem/src/main/AndroidManifest.xml b/core/designsystem/src/main/AndroidManifest.xml new file mode 100644 index 00000000..a5918e68 --- /dev/null +++ b/core/designsystem/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/DorabangsTopAppBar.kt b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/DorabangsTopAppBar.kt new file mode 100644 index 00000000..8cd516cf --- /dev/null +++ b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/component/DorabangsTopAppBar.kt @@ -0,0 +1 @@ +package com.mashup.dorabangs.core.designsystem.component diff --git a/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/theme/Colors.kt b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/theme/Colors.kt new file mode 100644 index 00000000..fdb6890a --- /dev/null +++ b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/theme/Colors.kt @@ -0,0 +1 @@ +package com.mashup.dorabangs.core.designsystem.theme diff --git a/core/src/main/java/com/mashup/dorabangs/core/designsystem/DorabangsTheme.kt b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/theme/DorabansTheme.kt similarity index 80% rename from core/src/main/java/com/mashup/dorabangs/core/designsystem/DorabangsTheme.kt rename to core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/theme/DorabansTheme.kt index 21eebaa7..225b06f6 100644 --- a/core/src/main/java/com/mashup/dorabangs/core/designsystem/DorabangsTheme.kt +++ b/core/designsystem/src/main/java/com/mashup/dorabangs/core/designsystem/theme/DorabansTheme.kt @@ -1,4 +1,4 @@ -package com.mashup.dorabangs.core.designsystem +package com.mashup.dorabangs.core.designsystem.theme import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable diff --git a/core/designsystem/src/test/java/com/mashup/dorabangs/core/designsystem/ExampleUnitTest.kt b/core/designsystem/src/test/java/com/mashup/dorabangs/core/designsystem/ExampleUnitTest.kt new file mode 100644 index 00000000..4379059b --- /dev/null +++ b/core/designsystem/src/test/java/com/mashup/dorabangs/core/designsystem/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package com.mashup.dorabangs.core.designsystem + +import org.junit.Assert.assertEquals +import org.junit.Test + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} diff --git a/core/src/main/java/com/mashup/dorabangs/core/coroutine/CoroutineExtensions.kt b/core/src/main/java/com/mashup/dorabangs/core/coroutine/CoroutineExtensions.kt deleted file mode 100644 index c39e40cd..00000000 --- a/core/src/main/java/com/mashup/dorabangs/core/coroutine/CoroutineExtensions.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.mashup.dorabangs.core.coroutine - -import android.util.Log -import kotlinx.coroutines.CoroutineExceptionHandler -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.launch - -private val coroutineExceptionHandler = CoroutineExceptionHandler { _, throwable -> - // timber 넣을랬는뎅 물어보고 넣자~ - Log.e("Dorabangs", "dorabangs exception: ${throwable.message}", throwable) - when (throwable) { - is RuntimeException -> { - // 예시 공통 다이얼로그? - } - - else -> { - // TODO - } - } -} - -fun CoroutineScope.doraLaunch( - block: suspend CoroutineScope.() -> Unit, -) = launch(context = coroutineContext + coroutineExceptionHandler) { - block.invoke(this) -} diff --git a/feature/home/build.gradle.kts b/feature/home/build.gradle.kts index 0f3f81cc..f04ee509 100644 --- a/feature/home/build.gradle.kts +++ b/feature/home/build.gradle.kts @@ -44,7 +44,8 @@ android { dependencies { implementation(project(":domain")) - implementation(project(":core")) + implementation(project(":core:coroutine")) + implementation(project(":core:designsystem")) // Compose implementation(libs.ui) diff --git a/settings.gradle.kts b/settings.gradle.kts index 373c1880..277b9207 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -20,3 +20,6 @@ include(":domain") include(":feature") include(":core") include(":feature:home") +include(":core:mylibrary") +include(":core:coroutine") +include(":core:designsystem")