Skip to content

Commit

Permalink
[feat] #4 test setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Sangwook123 committed Apr 14, 2024
1 parent ab862b8 commit aa5a5b9
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 19 deletions.
9 changes: 3 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
alias(libs.plugins.sopt.android.application)
alias(libs.plugins.sopt.android.test)
alias(libs.plugins.sopt.android.hilt)
}

Expand All @@ -25,15 +26,11 @@ android {
}

dependencies {
implementation(projects.core.ui)
implementation(projects.core.model)
implementation(projects.core.designsystem)
implementation(projects.core.datastore)
implementation(projects.core.database)
implementation(projects.core.common)
implementation(projects.core.data)
implementation(projects.core.domain)

implementation(projects.feature.main)
implementation(projects.feature.home)
implementation(projects.feature.search)
implementation(projects.feature.mypage)
}
19 changes: 7 additions & 12 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,19 @@
tools:targetApi="31">
<activity
android:name="org.sopt.main.login.LoginActivity"
android:exported="true"
android:screenOrientation="portrait" >

</activity>
<activity
android:name="org.sopt.main.signup.SignupActivity"
android:exported="true" >

</activity>
<activity
android:name="org.sopt.main.main.MainActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>
<activity
android:name="org.sopt.main.signup.SignupActivity"
android:exported="false" />
<activity
android:name="org.sopt.main.main.MainActivity"
android:exported="false" />
</application>

</manifest>
10 changes: 10 additions & 0 deletions build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,15 @@ gradlePlugin {
id = "sopt.plugin.data"
implementationClass = "DataPlugin"
}

register("AndroidTest") {
id = "sopt.android.test"
implementationClass = "AndroidTestPlugin"
}

register("UnitTest") {
id = "sopt.plugin.test"
implementationClass = "UnitTestPlugin"
}
}
}
16 changes: 16 additions & 0 deletions build-logic/convention/src/main/java/AndroidTestPlugin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import org.sopt.convention.libs

class AndroidTestPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target){
dependencies {
"androidTestImplementation"(libs.findLibrary("androidx.test.runner").get())
"debugImplementation"(libs.findLibrary("androidx.test.core").get())
"androidTestImplementation"(libs.findLibrary("kotlinx.coroutines.test").get())
}
}
}
}
16 changes: 16 additions & 0 deletions build-logic/convention/src/main/java/UnitTestPlugin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import org.sopt.convention.libs

class UnitTestPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target){
dependencies {
"testImplementation"(libs.findLibrary("kotlinx.coroutines.test").get())
"testImplementation"(libs.findLibrary("mockito").get())
"testImplementation"(libs.findLibrary("junit").get())
}
}
}
}
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.android.test) apply false
}

buildscript {
Expand Down
12 changes: 11 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
android-gradle-plugin = "8.3.1"
core-ktx = "1.12.0"
junit = "4.13.2"
mockito = "3.3.3"
androidx-test-ext-junit = "1.1.5"
androidx-test-runner = "1.5.2"
androidx-test = "1.5.0"
espresso-core = "3.5.1"
appcompat = "1.6.1"
material = "1.11.0"
Expand Down Expand Up @@ -65,14 +68,17 @@ hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
google-service = { id = "com.google.gms.google-services", version.ref = "google-service" }
navigation-safeargs = { id = "androidx.navigation.safeargs.kotlin", version.ref = "androidx-navigation" }
android-test = { id = "com.android.test", version.ref = "android-gradle-plugin" }

sopt-android-application = { id = "sopt.android.application", version = "unspecified" }
sopt-android-library = { id = "sopt.android.library", version = "unspecified" }
sopt-android-hilt = { id = "sopt.android.hilt", version = "unspecified"}
sopt-android-hilt = { id = "sopt.android.hilt", version = "unspecified" }
sopt-java-library = { id = "sopt.java.library", version = "unspecified" }
sopt-android-test = { id = "sopt.android.test", version = "unspecified" }
sopt-plugin-feature = { id = "sopt.plugin.feature", version = "unspecified" }
sopt-plugin-room = { id = "sopt.plugin.room", version = "unspecified" }
sopt-plugin-data = { id = "sopt.plugin.data", version = "unspecified" }
sopt-plugin-test = { id = "sopt.plugin.test", version = "unspecified" }

[libraries]
# Dependencies of the included build-logic
Expand All @@ -81,7 +87,10 @@ kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-p
ksp-gradle-plugin = { group = "com.google.devtools.ksp", name = "com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" }
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-ext-junit" }
androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = "androidx-test-runner" }
androidx-test-core = { group = "androidx.test", name = "core", version.ref = "androidx-test" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso-core" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
Expand All @@ -100,6 +109,7 @@ orbit-viewmodel = { group = "org.orbit-mvi", name = "orbit-viewmodel", version.r
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" }
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinx-datetime" }

retrofit-core = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" }
Expand Down

0 comments on commit aa5a5b9

Please sign in to comment.