Skip to content

Commit

Permalink
Merge pull request #24 from ddyeon/feature/core-module
Browse files Browse the repository at this point in the history
core모듈 재세팅 했슴당
  • Loading branch information
fbghgus123 authored Jun 18, 2024
2 parents 15b27a3 + 3b3ce98 commit 2b4c7d3
Show file tree
Hide file tree
Showing 23 changed files with 149 additions and 37 deletions.
3 changes: 2 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/mashup/dorabangs/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions core/coroutine/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
43 changes: 43 additions & 0 deletions core/coroutine/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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)
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mashup.dorabangs.core
package com.mashup.dorabangs.core.coroutine

import org.junit.Assert.assertEquals
import org.junit.Test
Expand Down
1 change: 1 addition & 0 deletions core/designsystem/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
5 changes: 1 addition & 4 deletions core/build.gradle.kts → core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -24,14 +23,12 @@ android {
)
}
}

buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.3"
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_18
targetCompatibility = JavaVersion.VERSION_18
Expand Down
Empty file.
21 changes: 21 additions & 0 deletions core/designsystem/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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)
}
}
4 changes: 4 additions & 0 deletions core/designsystem/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package com.mashup.dorabangs.core.designsystem.component
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package com.mashup.dorabangs.core.designsystem.theme
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
}

This file was deleted.

3 changes: 2 additions & 1 deletion feature/home/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ android {

dependencies {
implementation(project(":domain"))
implementation(project(":core"))
implementation(project(":core:coroutine"))
implementation(project(":core:designsystem"))

// Compose
implementation(libs.ui)
Expand Down
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ include(":domain")
include(":feature")
include(":core")
include(":feature:home")
include(":core:mylibrary")
include(":core:coroutine")
include(":core:designsystem")

0 comments on commit 2b4c7d3

Please sign in to comment.