From b637cc2a3a1cf4282a9d2f17c5623641dd8cd410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A4=EC=84=9D=EA=B7=9C?= Date: Tue, 9 Jan 2024 23:54:54 +0900 Subject: [PATCH 1/8] feat: Add navigation compose dependency --- app/build.gradle.kts | 2 ++ gradle/libs.versions.toml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index b0bad337..1771c4a0 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -43,4 +43,6 @@ dependencies { androidTestImplementation(libs.androidx.test.ext.junit) androidTestImplementation(libs.androidx.espresso.core) androidTestImplementation(libs.androidx.compose.ui.test.junit4) + + implementation(libs.androidx.navigation.compose) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4a042924..0acc9fd2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,6 +11,7 @@ androidxComposeBom = "2023.10.01" androidxComposeCompiler = "1.5.1" kotlinJvm = "1.9.0" spotless = "6.23.3" +androidxNavigation = "2.7.6" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" } @@ -27,6 +28,7 @@ androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "u androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" } +androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "androidxNavigation" } # Dependencies of the included build-logic android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } From 39bf2767ad1c152bdc44d3efad73f5b58bdf361a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A4=EC=84=9D=EA=B7=9C?= Date: Wed, 10 Jan 2024 00:04:38 +0900 Subject: [PATCH 2/8] feat: Add ksp plugin --- build.gradle.kts | 2 ++ gradle/libs.versions.toml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 288a498a..9df5e471 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,6 +6,8 @@ plugins { alias(libs.plugins.kotlin.jvm).apply(false) alias(libs.plugins.spotless) + + alias(libs.plugins.ksp).apply(false) } subprojects { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0acc9fd2..9de5f7e6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,6 +12,7 @@ androidxComposeCompiler = "1.5.1" kotlinJvm = "1.9.0" spotless = "6.23.3" androidxNavigation = "2.7.6" +ksp = "1.9.22-1.0.16" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" } @@ -39,3 +40,4 @@ android-application = { id = "com.android.application", version.ref = "androidGr kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlinJvm" } spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } From ba0b99d7160e7fbf0fbd4fc2a173d0c266a95fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A4=EC=84=9D=EA=B7=9C?= Date: Wed, 10 Jan 2024 00:12:58 +0900 Subject: [PATCH 3/8] feat: Add hilt plugin and dependency --- build.gradle.kts | 1 + gradle/libs.versions.toml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 9df5e471..b046e5d9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,6 +8,7 @@ plugins { alias(libs.plugins.spotless) alias(libs.plugins.ksp).apply(false) + alias(libs.plugins.hilt).apply(false) } subprojects { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9de5f7e6..dca53ef7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,6 +13,7 @@ kotlinJvm = "1.9.0" spotless = "6.23.3" androidxNavigation = "2.7.6" ksp = "1.9.22-1.0.16" +hilt = "2.50" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" } @@ -30,6 +31,9 @@ androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui- androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" } androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "androidxNavigation" } +hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" } +hilt-compiler = { group = "com.google.dagger", name = "hilt-compiler", version.ref = "hilt" } +hilt-android-test = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "hilt" } # Dependencies of the included build-logic android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } @@ -41,3 +45,4 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlinJvm" } spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } From 8d088f3dca8937850dc5e06de9e01f2af972efb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A4=EC=84=9D=EA=B7=9C?= Date: Wed, 10 Jan 2024 02:22:36 +0900 Subject: [PATCH 4/8] refactor: Change package name and modify build-logic --- app/build.gradle.kts | 34 +++---- .../b1nd/dodam}/ExampleInstrumentedTest.kt | 2 +- .../com/b1nd/dodam}/MainActivity.kt | 4 +- .../com/b1nd/dodam}/theme/Color.kt | 2 +- .../com/b1nd/dodam}/theme/Theme.kt | 2 +- .../com/b1nd/dodam}/theme/Type.kt | 2 +- .../com/b1nd/dodam}/ExampleUnitTest.kt | 2 +- build-logic/convention/build.gradle.kts | 57 ++++++----- ...droidApplicationComposeConventionPlugin.kt | 19 ---- .../AndroidApplicationConventionPlugin.kt | 21 ---- .../AndroidLibraryComposeConventionPlugin.kt | 18 ---- .../java/AndroidLibraryConventionPlugin.kt | 22 ----- .../main/java/JvmLibraryConventionPlugin.kt | 15 --- .../smartschool/convention/AndroidCompose.kt | 71 ------------- .../smartschool/convention/KotlinAndroid.kt | 54 ---------- .../dodam/convention/AndroidFeaturePlugin.kt | 17 ++++ .../com/b1nd/dodam/dsl/AndroidGradleDsl.kt | 39 ++++++++ .../kotlin/com/b1nd/dodam/dsl/GradleDsl.kt | 34 +++++++ .../com/b1nd/dodam/dsl/KotlinGradleDsl.kt | 17 ++++ .../com/b1nd/dodam/dsl/VersionCatalogDsl.kt | 28 ++++++ .../primitive/AndroidApplicationPlugin.kt | 20 ++++ .../dodam/primitive/AndroidComposePlugin.kt | 53 ++++++++++ .../b1nd/dodam/primitive/AndroidHiltPlugin.kt | 33 +++++++ .../dodam/primitive/AndroidKotlinPlugin.kt | 41 ++++++++ .../com/b1nd/dodam/primitive/AndroidPlugin.kt | 20 ++++ build.gradle.kts | 6 +- gradle/libs.versions.toml | 99 +++++++++++++------ 27 files changed, 425 insertions(+), 307 deletions(-) rename app/src/androidTest/{java/kr/hs/dgsw/smartschool/dodamdodam => kotlin/com/b1nd/dodam}/ExampleInstrumentedTest.kt (94%) rename app/src/main/{java/kr/hs/dgsw/smartschool/dodamdodam => kotlin/com/b1nd/dodam}/MainActivity.kt (91%) rename app/src/main/{java/kr/hs/dgsw/smartschool/dodamdodam/ui => kotlin/com/b1nd/dodam}/theme/Color.kt (82%) rename app/src/main/{java/kr/hs/dgsw/smartschool/dodamdodam/ui => kotlin/com/b1nd/dodam}/theme/Theme.kt (97%) rename app/src/main/{java/kr/hs/dgsw/smartschool/dodamdodam/ui => kotlin/com/b1nd/dodam}/theme/Type.kt (94%) rename app/src/test/{java/kr/hs/dgsw/smartschool/dodamdodam => kotlin/com/b1nd/dodam}/ExampleUnitTest.kt (88%) delete mode 100644 build-logic/convention/src/main/java/AndroidApplicationComposeConventionPlugin.kt delete mode 100644 build-logic/convention/src/main/java/AndroidApplicationConventionPlugin.kt delete mode 100644 build-logic/convention/src/main/java/AndroidLibraryComposeConventionPlugin.kt delete mode 100644 build-logic/convention/src/main/java/AndroidLibraryConventionPlugin.kt delete mode 100644 build-logic/convention/src/main/java/JvmLibraryConventionPlugin.kt delete mode 100644 build-logic/convention/src/main/java/kr/hs/dgsw/smartschool/convention/AndroidCompose.kt delete mode 100644 build-logic/convention/src/main/java/kr/hs/dgsw/smartschool/convention/KotlinAndroid.kt create mode 100644 build-logic/convention/src/main/kotlin/com/b1nd/dodam/convention/AndroidFeaturePlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/AndroidGradleDsl.kt create mode 100644 build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/GradleDsl.kt create mode 100644 build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/KotlinGradleDsl.kt create mode 100644 build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/VersionCatalogDsl.kt create mode 100644 build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidApplicationPlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidComposePlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidHiltPlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidKotlinPlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidPlugin.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1771c4a0..c701b3d1 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,15 +1,17 @@ plugins { - id("dodamdodam.android.application.compose") - id("dodamdodam.android.application") + id("b1nd.dodam.primitive.android.application") + id("b1nd.dodam.primitive.android.kotlin") + id("b1nd.dodam.primitive.android.compose") + id("b1nd.dodam.primitive.android.hilt") } android { - namespace = "kr.hs.dgsw.smartschool.dodamdodam" + namespace = "com.b1nd.dodam" defaultConfig { - applicationId = "kr.hs.dgsw.smartschool.dodamdodam" - versionCode = 1 - versionName = "1.0.0" + applicationId = "com.b1nd.dodam" + versionCode = libs.versions.versionCode.get().toInt() + versionName = libs.versions.appVersion.get() testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { @@ -26,23 +28,11 @@ android { ) } } - - packaging { - resources { - excludes += "/META-INF/{AL2.0,LGPL2.1}" - } - } } dependencies { - - implementation(libs.androidx.core.ktx) - implementation(libs.androidx.lifecycle.runtime.ktx) - implementation(libs.androidx.activity.compose) - testImplementation(libs.junit4) - androidTestImplementation(libs.androidx.test.ext.junit) - androidTestImplementation(libs.androidx.espresso.core) - androidTestImplementation(libs.androidx.compose.ui.test.junit4) - - implementation(libs.androidx.navigation.compose) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.test.junit) + androidTestImplementation(libs.androidx.test.espresso) + androidTestImplementation(platform(libs.androidx.compose.bom)) } diff --git a/app/src/androidTest/java/kr/hs/dgsw/smartschool/dodamdodam/ExampleInstrumentedTest.kt b/app/src/androidTest/kotlin/com/b1nd/dodam/ExampleInstrumentedTest.kt similarity index 94% rename from app/src/androidTest/java/kr/hs/dgsw/smartschool/dodamdodam/ExampleInstrumentedTest.kt rename to app/src/androidTest/kotlin/com/b1nd/dodam/ExampleInstrumentedTest.kt index d43cf7a8..707335e8 100644 --- a/app/src/androidTest/java/kr/hs/dgsw/smartschool/dodamdodam/ExampleInstrumentedTest.kt +++ b/app/src/androidTest/kotlin/com/b1nd/dodam/ExampleInstrumentedTest.kt @@ -1,4 +1,4 @@ -package kr.hs.dgsw.smartschool.dodamdodam +package com.b1nd.dodam import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry diff --git a/app/src/main/java/kr/hs/dgsw/smartschool/dodamdodam/MainActivity.kt b/app/src/main/kotlin/com/b1nd/dodam/MainActivity.kt similarity index 91% rename from app/src/main/java/kr/hs/dgsw/smartschool/dodamdodam/MainActivity.kt rename to app/src/main/kotlin/com/b1nd/dodam/MainActivity.kt index d22a7557..b0b82b88 100644 --- a/app/src/main/java/kr/hs/dgsw/smartschool/dodamdodam/MainActivity.kt +++ b/app/src/main/kotlin/com/b1nd/dodam/MainActivity.kt @@ -1,4 +1,4 @@ -package kr.hs.dgsw.smartschool.dodamdodam +package com.b1nd.dodam import android.os.Bundle import androidx.activity.ComponentActivity @@ -10,7 +10,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview -import kr.hs.dgsw.smartschool.dodamdodam.ui.theme.DodamdodamandroidTheme +import com.b1nd.dodam.theme.DodamdodamandroidTheme class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { diff --git a/app/src/main/java/kr/hs/dgsw/smartschool/dodamdodam/ui/theme/Color.kt b/app/src/main/kotlin/com/b1nd/dodam/theme/Color.kt similarity index 82% rename from app/src/main/java/kr/hs/dgsw/smartschool/dodamdodam/ui/theme/Color.kt rename to app/src/main/kotlin/com/b1nd/dodam/theme/Color.kt index 5e5f0f8f..eed65288 100644 --- a/app/src/main/java/kr/hs/dgsw/smartschool/dodamdodam/ui/theme/Color.kt +++ b/app/src/main/kotlin/com/b1nd/dodam/theme/Color.kt @@ -1,4 +1,4 @@ -package kr.hs.dgsw.smartschool.dodamdodam.ui.theme +package com.b1nd.dodam.theme import androidx.compose.ui.graphics.Color diff --git a/app/src/main/java/kr/hs/dgsw/smartschool/dodamdodam/ui/theme/Theme.kt b/app/src/main/kotlin/com/b1nd/dodam/theme/Theme.kt similarity index 97% rename from app/src/main/java/kr/hs/dgsw/smartschool/dodamdodam/ui/theme/Theme.kt rename to app/src/main/kotlin/com/b1nd/dodam/theme/Theme.kt index 6d36fe63..352a90ca 100644 --- a/app/src/main/java/kr/hs/dgsw/smartschool/dodamdodam/ui/theme/Theme.kt +++ b/app/src/main/kotlin/com/b1nd/dodam/theme/Theme.kt @@ -1,4 +1,4 @@ -package kr.hs.dgsw.smartschool.dodamdodam.ui.theme +package com.b1nd.dodam.theme import android.app.Activity import android.os.Build diff --git a/app/src/main/java/kr/hs/dgsw/smartschool/dodamdodam/ui/theme/Type.kt b/app/src/main/kotlin/com/b1nd/dodam/theme/Type.kt similarity index 94% rename from app/src/main/java/kr/hs/dgsw/smartschool/dodamdodam/ui/theme/Type.kt rename to app/src/main/kotlin/com/b1nd/dodam/theme/Type.kt index aeb6d47a..44430b0b 100644 --- a/app/src/main/java/kr/hs/dgsw/smartschool/dodamdodam/ui/theme/Type.kt +++ b/app/src/main/kotlin/com/b1nd/dodam/theme/Type.kt @@ -1,4 +1,4 @@ -package kr.hs.dgsw.smartschool.dodamdodam.ui.theme +package com.b1nd.dodam.theme import androidx.compose.material3.Typography import androidx.compose.ui.text.TextStyle diff --git a/app/src/test/java/kr/hs/dgsw/smartschool/dodamdodam/ExampleUnitTest.kt b/app/src/test/kotlin/com/b1nd/dodam/ExampleUnitTest.kt similarity index 88% rename from app/src/test/java/kr/hs/dgsw/smartschool/dodamdodam/ExampleUnitTest.kt rename to app/src/test/kotlin/com/b1nd/dodam/ExampleUnitTest.kt index 3ed040d4..712d1ea8 100644 --- a/app/src/test/java/kr/hs/dgsw/smartschool/dodamdodam/ExampleUnitTest.kt +++ b/app/src/test/kotlin/com/b1nd/dodam/ExampleUnitTest.kt @@ -1,4 +1,4 @@ -package kr.hs.dgsw.smartschool.dodamdodam +package com.b1nd.dodam import org.junit.Assert.assertEquals import org.junit.Test diff --git a/build-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.kts index 20fa91c3..2b444f33 100644 --- a/build-logic/convention/build.gradle.kts +++ b/build-logic/convention/build.gradle.kts @@ -4,43 +4,54 @@ plugins { `kotlin-dsl` } +group = "com.b1nd.dodam.buildlogic" + +repositories { + google() + mavenCentral() + gradlePluginPortal() +} + +val compileKotlin: KotlinCompile by tasks +compileKotlin.kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString() + java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } -tasks.withType().configureEach { - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } -} - dependencies { - compileOnly(libs.android.gradlePlugin) - compileOnly(libs.kotlin.gradlePlugin) + implementation(libs.kotlin.gradle.plugin) + implementation(libs.android.gradle.plugin) } gradlePlugin { plugins { - register("androidApplicationCompose") { - id = "dodamdodam.android.application.compose" - implementationClass = "AndroidApplicationComposeConventionPlugin" - } + // primitives register("androidApplication") { - id = "dodamdodam.android.application" - implementationClass = "AndroidApplicationConventionPlugin" + id = "b1nd.dodam.primitive.android.application" + implementationClass = "com.b1nd.dodam.primitive.AndroidApplicationPlugin" + } + register("androidCompose") { + id = "b1nd.dodam.primitive.android.compose" + implementationClass = "com.b1nd.dodam.primitive.AndroidComposePlugin" + } + register("androidHilt") { + id = "b1nd.dodam.primitive.android.hilt" + implementationClass = "com.b1nd.dodam.primitive.AndroidHiltPlugin" } - register("androidLibraryCompose") { - id = "dodamdodam.android.library.compose" - implementationClass = "AndroidLibraryComposeConventionPlugin" + register("androidKotlin") { + id = "b1nd.dodam.primitive.android.kotlin" + implementationClass = "com.b1nd.dodam.primitive.AndroidKotlinPlugin" } - register("androidLibrary") { - id = "dodamdodam.android.library" - implementationClass = "AndroidLibraryConventionPlugin" + register("android") { + id = "b1nd.dodam.primitive.android" + implementationClass = "com.b1nd.dodam.primitive.AndroidPlugin" } - register("jvmLibrary") { - id = "dodamdodam.jvm.library" - implementationClass = "JvmLibraryConventionPlugin" + // convention + register("androidFeature") { + id = "b1nd.dodam.convention.android.feature" + implementationClass = "com.b1nd.dodam.convention.AndroidFeaturePlugin" } } } diff --git a/build-logic/convention/src/main/java/AndroidApplicationComposeConventionPlugin.kt b/build-logic/convention/src/main/java/AndroidApplicationComposeConventionPlugin.kt deleted file mode 100644 index 68e96deb..00000000 --- a/build-logic/convention/src/main/java/AndroidApplicationComposeConventionPlugin.kt +++ /dev/null @@ -1,19 +0,0 @@ -import com.android.build.api.dsl.ApplicationExtension -import kr.hs.dgsw.smartschool.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) { - with(pluginManager) { - apply("com.android.application") - } - val extension = extensions.getByType() - - configureAndroidCompose(extension) - } - } - -} \ No newline at end of file diff --git a/build-logic/convention/src/main/java/AndroidApplicationConventionPlugin.kt b/build-logic/convention/src/main/java/AndroidApplicationConventionPlugin.kt deleted file mode 100644 index 65b4fec7..00000000 --- a/build-logic/convention/src/main/java/AndroidApplicationConventionPlugin.kt +++ /dev/null @@ -1,21 +0,0 @@ -import com.android.build.api.dsl.ApplicationExtension -import kr.hs.dgsw.smartschool.convention.configureKotlinAndroid -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") - } - - extensions.configure { - configureKotlinAndroid(this) - defaultConfig.targetSdk = 34 - } - } - } -} \ No newline at end of file diff --git a/build-logic/convention/src/main/java/AndroidLibraryComposeConventionPlugin.kt b/build-logic/convention/src/main/java/AndroidLibraryComposeConventionPlugin.kt deleted file mode 100644 index 1cd3f86b..00000000 --- a/build-logic/convention/src/main/java/AndroidLibraryComposeConventionPlugin.kt +++ /dev/null @@ -1,18 +0,0 @@ -import com.android.build.gradle.LibraryExtension -import kr.hs.dgsw.smartschool.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) { - with(pluginManager) { - apply("com.android.library") - } - val extension = extensions.getByType() - configureAndroidCompose(extension) - - } - } -} \ No newline at end of file diff --git a/build-logic/convention/src/main/java/AndroidLibraryConventionPlugin.kt b/build-logic/convention/src/main/java/AndroidLibraryConventionPlugin.kt deleted file mode 100644 index e62d58a0..00000000 --- a/build-logic/convention/src/main/java/AndroidLibraryConventionPlugin.kt +++ /dev/null @@ -1,22 +0,0 @@ -import com.android.build.gradle.LibraryExtension -import kr.hs.dgsw.smartschool.convention.configureKotlinAndroid -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") - } - - extensions.configure { - configureKotlinAndroid(this) - defaultConfig.targetSdk = 34 - } - } - } - -} \ No newline at end of file diff --git a/build-logic/convention/src/main/java/JvmLibraryConventionPlugin.kt b/build-logic/convention/src/main/java/JvmLibraryConventionPlugin.kt deleted file mode 100644 index ed6d480e..00000000 --- a/build-logic/convention/src/main/java/JvmLibraryConventionPlugin.kt +++ /dev/null @@ -1,15 +0,0 @@ -import kr.hs.dgsw.smartschool.convention.configureKotlinJvm -import org.gradle.api.Plugin -import org.gradle.api.Project - -class JvmLibraryConventionPlugin : Plugin { - override fun apply(target: Project) { - with(target) { - with(pluginManager) { - apply("org.jetbrains.kotlin.jvm") - } - configureKotlinJvm() - } - } - -} \ No newline at end of file diff --git a/build-logic/convention/src/main/java/kr/hs/dgsw/smartschool/convention/AndroidCompose.kt b/build-logic/convention/src/main/java/kr/hs/dgsw/smartschool/convention/AndroidCompose.kt deleted file mode 100644 index 86507953..00000000 --- a/build-logic/convention/src/main/java/kr/hs/dgsw/smartschool/convention/AndroidCompose.kt +++ /dev/null @@ -1,71 +0,0 @@ -package kr.hs.dgsw.smartschool.convention - -import com.android.build.api.dsl.CommonExtension -import org.gradle.api.Project -import org.gradle.api.artifacts.VersionCatalogsExtension -import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.getByType -import org.gradle.kotlin.dsl.withType -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import java.io.File - - -internal fun Project.configureAndroidCompose( - commonExtension: CommonExtension<*, *, *, *, *>, -) { - val libs = extensions.getByType().named("libs") - - commonExtension.apply { - buildFeatures { - compose = true - } - - composeOptions { - kotlinCompilerExtensionVersion = libs.findVersion("androidxComposeCompiler").get().toString() - } - - dependencies { - val bom = libs.findLibrary("androidx-compose-bom").get() - add("implementation", platform(bom)) - add("androidTestImplementation", platform(bom)) - - add("implementation", libs.findLibrary("androidx.compose.ui").get()) - add("implementation", libs.findLibrary("androidx.compose.ui.graphics").get()) - add("implementation", libs.findLibrary("androidx.compose.ui.tooling.preview").get()) - add("implementation", libs.findLibrary("androidx.compose.material3").get()) - - add("debugImplementation", libs.findLibrary("androidx.compose.ui.tooling").get()) - add("debugImplementation", libs.findLibrary("androidx.compose.ui.test.manifest").get()) - } - } - - tasks.withType().configureEach { - kotlinOptions { - freeCompilerArgs = freeCompilerArgs + buildComposeMetricsParameters() - } - } -} - -private fun Project.buildComposeMetricsParameters(): List { - val metricParameters = mutableListOf() - val enableMetricsProvider = project.providers.gradleProperty("enableComposeCompilerMetrics") - val enableMetrics = (enableMetricsProvider.orNull == "true") - if (enableMetrics) { - val metricsFolder = File(project.buildDir, "compose-metrics") - metricParameters.add("-P") - metricParameters.add( - "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" + metricsFolder.absolutePath - ) - } - - val enableReportsProvider = project.providers.gradleProperty("enableComposeCompilerReports") - val enableReports = (enableReportsProvider.orNull == "true") - if (enableReports) { - val reportsFolder = File(project.buildDir, "compose-reports") - metricParameters.add("-P") - metricParameters.add( - "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" + reportsFolder.absolutePath - ) - } - return metricParameters.toList() -} diff --git a/build-logic/convention/src/main/java/kr/hs/dgsw/smartschool/convention/KotlinAndroid.kt b/build-logic/convention/src/main/java/kr/hs/dgsw/smartschool/convention/KotlinAndroid.kt deleted file mode 100644 index 23fe1e3e..00000000 --- a/build-logic/convention/src/main/java/kr/hs/dgsw/smartschool/convention/KotlinAndroid.kt +++ /dev/null @@ -1,54 +0,0 @@ -package kr.hs.dgsw.smartschool.convention - -import com.android.build.api.dsl.CommonExtension -import org.gradle.api.JavaVersion -import org.gradle.api.Project -import org.gradle.api.plugins.JavaPluginExtension -import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.provideDelegate -import org.gradle.kotlin.dsl.withType -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -internal fun Project.configureKotlinAndroid( - commonExtension: CommonExtension<*, *, *, *, *>, -) { - commonExtension.apply { - compileSdk = 34 - - defaultConfig { - minSdk = 26 - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - } - - configureKotlin() -} - -internal fun Project.configureKotlinJvm() { - extensions.configure { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - configureKotlin() -} - -private fun Project.configureKotlin() { - tasks.withType().configureEach { - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - - val warningsAsErrors: String? by project - allWarningsAsErrors = warningsAsErrors.toBoolean() - freeCompilerArgs = freeCompilerArgs + listOf( - "-opt-in=kotlin.RequiresOptIn", - "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", - "-opt-in=kotlinx.coroutines.FlowPreview", - ) - } - } -} diff --git a/build-logic/convention/src/main/kotlin/com/b1nd/dodam/convention/AndroidFeaturePlugin.kt b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/convention/AndroidFeaturePlugin.kt new file mode 100644 index 00000000..52835da8 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/convention/AndroidFeaturePlugin.kt @@ -0,0 +1,17 @@ +package com.b1nd.dodam.convention + +import org.gradle.api.Plugin +import org.gradle.api.Project + +class AndroidFeaturePlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("b1nd.dodamdodam.primitive.android") + apply("b1nd.dodamdodam.primitive.android.kotlin") + apply("b1nd.dodamdodam.primitive.android.compose") + apply("b1nd.dodamdodam.primitive.android.hilt") + } + } + } +} \ No newline at end of file diff --git a/build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/AndroidGradleDsl.kt b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/AndroidGradleDsl.kt new file mode 100644 index 00000000..f9a0c0c7 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/AndroidGradleDsl.kt @@ -0,0 +1,39 @@ +package com.b1nd.dodam.dsl + +import com.android.build.api.dsl.ApplicationExtension +import com.android.build.gradle.LibraryExtension +import com.android.build.gradle.TestedExtension +import org.gradle.api.JavaVersion +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure + +fun Project.androidApplication(action: ApplicationExtension.() -> Unit) { + extensions.configure(action) +} + +fun Project.androidLibrary(action: LibraryExtension.() -> Unit) { + extensions.configure(action) +} + +fun Project.android(action: TestedExtension.() -> Unit) { + extensions.configure(action) +} + +fun Project.setupAndroid() { + android { + namespace?.let { + this.namespace = it + } + compileSdkVersion(34) + + defaultConfig { + minSdk = 28 + targetSdk = 34 + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + } +} diff --git a/build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/GradleDsl.kt b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/GradleDsl.kt new file mode 100644 index 00000000..e16798fa --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/GradleDsl.kt @@ -0,0 +1,34 @@ +package com.b1nd.dodam.dsl + +import org.gradle.api.artifacts.MinimalExternalModuleDependency +import org.gradle.kotlin.dsl.DependencyHandlerScope + +fun DependencyHandlerScope.implementation( + artifact: MinimalExternalModuleDependency, +) { + add("implementation", artifact) +} + +fun DependencyHandlerScope.debugImplementation( + artifact: MinimalExternalModuleDependency, +) { + add("debugImplementation", artifact) +} + +fun DependencyHandlerScope.androidTestImplementation( + artifact: MinimalExternalModuleDependency, +) { + add("androidTestImplementation", artifact) +} + +fun DependencyHandlerScope.testImplementation( + artifact: MinimalExternalModuleDependency, +) { + add("testImplementation", artifact) +} + +fun DependencyHandlerScope.implementationPlatform( + artifact: MinimalExternalModuleDependency, +) { + add("implementation", platform(artifact)) +} diff --git a/build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/KotlinGradleDsl.kt b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/KotlinGradleDsl.kt new file mode 100644 index 00000000..644f853d --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/KotlinGradleDsl.kt @@ -0,0 +1,17 @@ +package com.b1nd.dodam.dsl + +import com.android.build.gradle.TestedExtension +import org.gradle.api.artifacts.MinimalExternalModuleDependency +import org.gradle.api.plugins.ExtensionAware +import org.gradle.kotlin.dsl.DependencyHandlerScope +import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions + +fun TestedExtension.kotlinOptions(block: KotlinJvmOptions.() -> Unit) { + (this as ExtensionAware).extensions.configure("kotlinOptions", block) +} + +fun DependencyHandlerScope.ksp( + artifact: MinimalExternalModuleDependency, +) { + add("ksp", artifact) +} diff --git a/build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/VersionCatalogDsl.kt b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/VersionCatalogDsl.kt new file mode 100644 index 00000000..9888c7e3 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/dsl/VersionCatalogDsl.kt @@ -0,0 +1,28 @@ +package com.b1nd.dodam.dsl + +import org.gradle.api.Project +import org.gradle.api.artifacts.ExternalModuleDependencyBundle +import org.gradle.api.artifacts.MinimalExternalModuleDependency +import org.gradle.api.artifacts.VersionCatalog +import org.gradle.api.artifacts.VersionCatalogsExtension +import org.gradle.kotlin.dsl.getByType +import org.gradle.plugin.use.PluginDependency + +internal val Project.libs: VersionCatalog + get() = extensions.getByType().named("libs") + +internal fun VersionCatalog.version(name: String): String { + return findVersion(name).get().requiredVersion +} + +internal fun VersionCatalog.library(name: String): MinimalExternalModuleDependency { + return findLibrary(name).get().get() +} + +internal fun VersionCatalog.plugin(name: String): PluginDependency { + return findPlugin(name).get().get() +} + +internal fun VersionCatalog.bundle(name: String): ExternalModuleDependencyBundle { + return findBundle(name).get().get() +} \ No newline at end of file diff --git a/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidApplicationPlugin.kt b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidApplicationPlugin.kt new file mode 100644 index 00000000..70648f95 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidApplicationPlugin.kt @@ -0,0 +1,20 @@ +package com.b1nd.dodam.primitive + +import com.b1nd.dodam.dsl.androidApplication +import com.b1nd.dodam.dsl.setupAndroid +import org.gradle.api.Plugin +import org.gradle.api.Project + +class AndroidApplicationPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.android.application") + } + + androidApplication { + setupAndroid() + } + } + } +} \ No newline at end of file diff --git a/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidComposePlugin.kt b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidComposePlugin.kt new file mode 100644 index 00000000..0565da3d --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidComposePlugin.kt @@ -0,0 +1,53 @@ +package com.b1nd.dodam.primitive + +import com.b1nd.dodam.dsl.android +import com.b1nd.dodam.dsl.debugImplementation +import com.b1nd.dodam.dsl.kotlinOptions +import com.b1nd.dodam.dsl.library +import com.b1nd.dodam.dsl.libs +import com.b1nd.dodam.dsl.version +import com.b1nd.dodam.dsl.implementation +import com.b1nd.dodam.dsl.implementationPlatform +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies + +class AndroidComposePlugin : Plugin { + override fun apply(target: Project) { + with(target) { + val projectPath = rootProject.file(".").absolutePath + android { + buildFeatures.compose = true + composeOptions { + kotlinCompilerExtensionVersion = libs.version("androidx-compose-compiler") + } + kotlinOptions { + freeCompilerArgs = freeCompilerArgs + listOf( + "-P", + "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=$projectPath/report/compose-metrics" + ) + freeCompilerArgs = freeCompilerArgs + listOf( + "-P", + "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=$projectPath/report/compose-reports" + ) + } + } + + dependencies { + implementation(libs.library("androidx-core")) + implementationPlatform(libs.library("androidx-compose-bom")) + implementation(libs.library("androidx-compose-activity")) + implementation(libs.library("androidx-compose-hilt-navigation")) + implementation(libs.library("androidx-compose-lifecycle")) + implementation(libs.library("androidx-compose-navigation")) + implementation(libs.library("androidx-compose-ui")) + implementation(libs.library("androidx-compose-ui-foundation")) + implementation(libs.library("androidx-compose-material3")) + implementation(libs.library("androidx-lifecycle-runtime")) + implementation(libs.library("androidx-compose-ui-tooling")) + debugImplementation(libs.library("androidx-compose-ui-test-manifest")) + } + } + } + +} \ No newline at end of file diff --git a/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidHiltPlugin.kt b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidHiltPlugin.kt new file mode 100644 index 00000000..dc11bfc6 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidHiltPlugin.kt @@ -0,0 +1,33 @@ +package com.b1nd.dodam.primitive + +import com.b1nd.dodam.dsl.android +import com.b1nd.dodam.dsl.implementation +import com.b1nd.dodam.dsl.ksp +import com.b1nd.dodam.dsl.library +import com.b1nd.dodam.dsl.libs +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies + +class AndroidHiltPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.google.dagger.hilt.android") + apply("com.google.devtools.ksp") + } + android { + packagingOptions { + resources { + excludes += "META-INF/gradle/incremental.annotation.processors" + } + } + } + dependencies { + implementation(libs.library("hilt")) + ksp(libs.library("hilt-compiler")) + } + } + } + +} \ No newline at end of file diff --git a/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidKotlinPlugin.kt b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidKotlinPlugin.kt new file mode 100644 index 00000000..7ac5164c --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidKotlinPlugin.kt @@ -0,0 +1,41 @@ +package com.b1nd.dodam.primitive + +import com.b1nd.dodam.dsl.android +import com.b1nd.dodam.dsl.implementation +import com.b1nd.dodam.dsl.kotlinOptions +import com.b1nd.dodam.dsl.library +import com.b1nd.dodam.dsl.libs +import org.gradle.api.JavaVersion +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +class AndroidKotlinPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("org.jetbrains.kotlin.android") + } + tasks.withType(KotlinCompile::class.java) { + kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString() + } + + android { + kotlinOptions { + freeCompilerArgs = freeCompilerArgs + listOf( + "-opt-in=kotlin.RequiresOptIn", + "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", + "-Xcontext-receivers" + ) + + jvmTarget = JavaVersion.VERSION_17.toString() + } + } + dependencies { + implementation(libs.library("kotlinx-coroutines-core")) + implementation(libs.library("kotlinx-collections-immutable")) + } + } + } +} \ No newline at end of file diff --git a/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidPlugin.kt b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidPlugin.kt new file mode 100644 index 00000000..22bb230f --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/b1nd/dodam/primitive/AndroidPlugin.kt @@ -0,0 +1,20 @@ +package com.b1nd.dodam.primitive + +import com.b1nd.dodam.dsl.androidLibrary +import com.b1nd.dodam.dsl.setupAndroid +import org.gradle.api.Plugin +import org.gradle.api.Project + +class AndroidPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.android.library") + } + + androidLibrary { + setupAndroid() + } + } + } +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index b046e5d9..9a3ce4c1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,11 +4,9 @@ plugins { alias(libs.plugins.android.application).apply(false) alias(libs.plugins.kotlin.android).apply(false) alias(libs.plugins.kotlin.jvm).apply(false) - - alias(libs.plugins.spotless) - alias(libs.plugins.ksp).apply(false) - alias(libs.plugins.hilt).apply(false) + alias(libs.plugins.dagger.hilt).apply(false) + alias(libs.plugins.spotless) } subprojects { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dca53ef7..7df43f2c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,48 +1,85 @@ [versions] -androidGradlePlugin = "8.2.0" -kotlin = "1.9.0" -androidxCore = "1.12.0" -junit4 = "4.13.2" -androidxTestExt = "1.1.5" -androidxEspressoCore = "3.5.1" -androidxLifecycleRuntime = "2.6.2" -androidxActivityCompose = "1.8.2" -androidxComposeBom = "2023.10.01" -androidxComposeCompiler = "1.5.1" -kotlinJvm = "1.9.0" +compileSdk = "34" +minSdk = "28" +targetSdk = "34" +appVersion = "1.0.0" +versionCode = "1" + +# kotlin +kotlin = "1.9.22" +kotlinx-coroutines = "1.7.3" +kotlinx-collections-immutable = "0.3.7" + +# android +androidx-activity-compose = "1.8.2" +androidx-compose-compiler = "1.5.7" +androidx-compose-bom = "2023.10.01" +androidx-core = "1.12.0" +androidx-lifecycle = "2.6.2" +androidx-navigation = "2.7.6" +androidx-hilt-navigation-compose = "1.1.0" + +# third party +dagger-hilt = "2.50" spotless = "6.23.3" -androidxNavigation = "2.7.6" +material = "1.11.0" + +# test +junit = "4.13.2" +androidx-test-ext-junit = "1.1.5" +androidx-test-espresso = "3.5.1" + +# gradle plugin +agp = "8.2.1" ksp = "1.9.22-1.0.16" -hilt = "2.50" [libraries] -androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" } -junit4 = { group = "junit", name = "junit", version.ref = "junit4" } -androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidxTestExt" } -androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidxEspressoCore" } -androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "androidxLifecycleRuntime" } -androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidxActivityCompose" } -androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" } +# kotlin +kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" } +kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } +kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" } +kotlinx-collections-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "kotlinx-collections-immutable" } + +# android +android-gradle-plugin = { group = "com.android.tools.build", name = "gradle", version.ref = "agp" } +androidx-compose-activity = { group = "androidx.activity", name = "activity-compose", version.ref = "androidx-activity-compose" } +androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidx-compose-bom" } +androidx-compose-hilt-navigation = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "androidx-hilt-navigation-compose" } +androidx-compose-navigation = { group = "androidx.navigation", name = "navigation-compose", version.ref = "androidx-navigation" } androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" } +androidx-compose-ui-foundation = { group = "androidx.compose.foundation", name = "foundation" } androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } +androidx-compose-lifecycle = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidx-lifecycle" } androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" } -androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "androidxNavigation" } -hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" } -hilt-compiler = { group = "com.google.dagger", name = "hilt-compiler", version.ref = "hilt" } -hilt-android-test = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "hilt" } +androidx-core = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core" } +androidx-lifecycle-runtime = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" } +androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" } +androidx-navigation = { group = "androidx.navigation", name = "navigation-ui-ktx", version.ref = "androidx-navigation" } + +# third party +hilt = { module = "com.google.dagger:hilt-android", version.ref = "dagger-hilt" } +hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "dagger-hilt" } +hilt-plugin = { group = "com.google.dagger", name = "hilt-android-gradle-plugin", version.ref = "dagger-hilt" } +material = { group = "com.google.android.material", name = "material", version.ref = "material" } -# Dependencies of the included build-logic -android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } -kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } +# test +junit = { group = "junit", name = "junit", version.ref = "junit" } +androidx-test-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-test-ext-junit" } +androidx-test-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-test-espresso" } [plugins] -android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } +android-application = { id = "com.android.application", version.ref = "agp" } +android-library = { id = "com.android.library", version.ref = "agp" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } -kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlinJvm" } -spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +dagger-hilt = { id = "com.google.dagger.hilt.android", version.ref = "dagger-hilt" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } -hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } +spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } + +[bundles] +compose-implementation = ["androidx-compose-ui", "androidx-compose-ui-foundation", "androidx-compose-ui-graphics", "androidx-compose-lifecycle", "androidx-compose-ui-tooling", "androidx-compose-ui-tooling-preview", "androidx-compose-material3"] From 17749514e61b5b510447e899cecdda4ca38b0e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A4=EC=84=9D=EA=B7=9C?= Date: Wed, 10 Jan 2024 03:06:37 +0900 Subject: [PATCH 5/8] refactor: Change the "app" module name to "dodam-student" --- dodam-student/.gitignore | 1 + {app => dodam-student}/build.gradle.kts | 5 +++-- {app => dodam-student}/proguard-rules.pro | 0 .../b1nd/dodam/student}/ExampleInstrumentedTest.kt | 2 +- {app => dodam-student}/src/main/AndroidManifest.xml | 2 +- .../main/res/drawable/ic_launcher_background.xml | 0 .../main/res/drawable/ic_launcher_foreground.xml | 0 .../src/main/res/mipmap-anydpi/ic_launcher.xml | 0 .../main/res/mipmap-anydpi/ic_launcher_round.xml | 0 .../src/main/res/mipmap-hdpi/ic_launcher.webp | Bin .../src/main/res/mipmap-hdpi/ic_launcher_round.webp | Bin .../src/main/res/mipmap-mdpi/ic_launcher.webp | Bin .../src/main/res/mipmap-mdpi/ic_launcher_round.webp | Bin .../src/main/res/mipmap-xhdpi/ic_launcher.webp | Bin .../main/res/mipmap-xhdpi/ic_launcher_round.webp | Bin .../src/main/res/mipmap-xxhdpi/ic_launcher.webp | Bin .../main/res/mipmap-xxhdpi/ic_launcher_round.webp | Bin .../src/main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin .../main/res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin .../src/main/res/xml/backup_rules.xml | 0 .../src/main/res/xml/data_extraction_rules.xml | 0 .../com/b1nd/dodam/student}/ExampleUnitTest.kt | 2 +- 22 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 dodam-student/.gitignore rename {app => dodam-student}/build.gradle.kts (87%) rename {app => dodam-student}/proguard-rules.pro (100%) rename {app/src/androidTest/kotlin/com/b1nd/dodam => dodam-student/src/androidTest/kotlin/com/b1nd/dodam/student}/ExampleInstrumentedTest.kt (95%) rename {app => dodam-student}/src/main/AndroidManifest.xml (95%) rename {app => dodam-student}/src/main/res/drawable/ic_launcher_background.xml (100%) rename {app => dodam-student}/src/main/res/drawable/ic_launcher_foreground.xml (100%) rename {app => dodam-student}/src/main/res/mipmap-anydpi/ic_launcher.xml (100%) rename {app => dodam-student}/src/main/res/mipmap-anydpi/ic_launcher_round.xml (100%) rename {app => dodam-student}/src/main/res/mipmap-hdpi/ic_launcher.webp (100%) rename {app => dodam-student}/src/main/res/mipmap-hdpi/ic_launcher_round.webp (100%) rename {app => dodam-student}/src/main/res/mipmap-mdpi/ic_launcher.webp (100%) rename {app => dodam-student}/src/main/res/mipmap-mdpi/ic_launcher_round.webp (100%) rename {app => dodam-student}/src/main/res/mipmap-xhdpi/ic_launcher.webp (100%) rename {app => dodam-student}/src/main/res/mipmap-xhdpi/ic_launcher_round.webp (100%) rename {app => dodam-student}/src/main/res/mipmap-xxhdpi/ic_launcher.webp (100%) rename {app => dodam-student}/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp (100%) rename {app => dodam-student}/src/main/res/mipmap-xxxhdpi/ic_launcher.webp (100%) rename {app => dodam-student}/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp (100%) rename {app => dodam-student}/src/main/res/xml/backup_rules.xml (100%) rename {app => dodam-student}/src/main/res/xml/data_extraction_rules.xml (100%) rename {app/src/test/kotlin/com/b1nd/dodam => dodam-student/src/test/kotlin/com/b1nd/dodam/student}/ExampleUnitTest.kt (91%) diff --git a/dodam-student/.gitignore b/dodam-student/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/dodam-student/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle.kts b/dodam-student/build.gradle.kts similarity index 87% rename from app/build.gradle.kts rename to dodam-student/build.gradle.kts index c701b3d1..8f5c3cab 100644 --- a/app/build.gradle.kts +++ b/dodam-student/build.gradle.kts @@ -6,10 +6,10 @@ plugins { } android { - namespace = "com.b1nd.dodam" + namespace = "com.b1nd.dodam.student" defaultConfig { - applicationId = "com.b1nd.dodam" + applicationId = "com.b1nd.dodam.student" versionCode = libs.versions.versionCode.get().toInt() versionName = libs.versions.appVersion.get() @@ -31,6 +31,7 @@ android { } dependencies { + implementation(project(":core:designsystem")) testImplementation(libs.junit) androidTestImplementation(libs.androidx.test.junit) androidTestImplementation(libs.androidx.test.espresso) diff --git a/app/proguard-rules.pro b/dodam-student/proguard-rules.pro similarity index 100% rename from app/proguard-rules.pro rename to dodam-student/proguard-rules.pro diff --git a/app/src/androidTest/kotlin/com/b1nd/dodam/ExampleInstrumentedTest.kt b/dodam-student/src/androidTest/kotlin/com/b1nd/dodam/student/ExampleInstrumentedTest.kt similarity index 95% rename from app/src/androidTest/kotlin/com/b1nd/dodam/ExampleInstrumentedTest.kt rename to dodam-student/src/androidTest/kotlin/com/b1nd/dodam/student/ExampleInstrumentedTest.kt index 707335e8..da9c7c4c 100644 --- a/app/src/androidTest/kotlin/com/b1nd/dodam/ExampleInstrumentedTest.kt +++ b/dodam-student/src/androidTest/kotlin/com/b1nd/dodam/student/ExampleInstrumentedTest.kt @@ -1,4 +1,4 @@ -package com.b1nd.dodam +package com.b1nd.dodam.student import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry diff --git a/app/src/main/AndroidManifest.xml b/dodam-student/src/main/AndroidManifest.xml similarity index 95% rename from app/src/main/AndroidManifest.xml rename to dodam-student/src/main/AndroidManifest.xml index 64fa7eea..31c50c85 100644 --- a/app/src/main/AndroidManifest.xml +++ b/dodam-student/src/main/AndroidManifest.xml @@ -13,7 +13,7 @@ android:theme="@style/Theme.Dodamdodamandroid" tools:targetApi="31"> diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/dodam-student/src/main/res/drawable/ic_launcher_background.xml similarity index 100% rename from app/src/main/res/drawable/ic_launcher_background.xml rename to dodam-student/src/main/res/drawable/ic_launcher_background.xml diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/dodam-student/src/main/res/drawable/ic_launcher_foreground.xml similarity index 100% rename from app/src/main/res/drawable/ic_launcher_foreground.xml rename to dodam-student/src/main/res/drawable/ic_launcher_foreground.xml diff --git a/app/src/main/res/mipmap-anydpi/ic_launcher.xml b/dodam-student/src/main/res/mipmap-anydpi/ic_launcher.xml similarity index 100% rename from app/src/main/res/mipmap-anydpi/ic_launcher.xml rename to dodam-student/src/main/res/mipmap-anydpi/ic_launcher.xml diff --git a/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml b/dodam-student/src/main/res/mipmap-anydpi/ic_launcher_round.xml similarity index 100% rename from app/src/main/res/mipmap-anydpi/ic_launcher_round.xml rename to dodam-student/src/main/res/mipmap-anydpi/ic_launcher_round.xml diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/dodam-student/src/main/res/mipmap-hdpi/ic_launcher.webp similarity index 100% rename from app/src/main/res/mipmap-hdpi/ic_launcher.webp rename to dodam-student/src/main/res/mipmap-hdpi/ic_launcher.webp diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/dodam-student/src/main/res/mipmap-hdpi/ic_launcher_round.webp similarity index 100% rename from app/src/main/res/mipmap-hdpi/ic_launcher_round.webp rename to dodam-student/src/main/res/mipmap-hdpi/ic_launcher_round.webp diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/dodam-student/src/main/res/mipmap-mdpi/ic_launcher.webp similarity index 100% rename from app/src/main/res/mipmap-mdpi/ic_launcher.webp rename to dodam-student/src/main/res/mipmap-mdpi/ic_launcher.webp diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/dodam-student/src/main/res/mipmap-mdpi/ic_launcher_round.webp similarity index 100% rename from app/src/main/res/mipmap-mdpi/ic_launcher_round.webp rename to dodam-student/src/main/res/mipmap-mdpi/ic_launcher_round.webp diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/dodam-student/src/main/res/mipmap-xhdpi/ic_launcher.webp similarity index 100% rename from app/src/main/res/mipmap-xhdpi/ic_launcher.webp rename to dodam-student/src/main/res/mipmap-xhdpi/ic_launcher.webp diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/dodam-student/src/main/res/mipmap-xhdpi/ic_launcher_round.webp similarity index 100% rename from app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp rename to dodam-student/src/main/res/mipmap-xhdpi/ic_launcher_round.webp diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/dodam-student/src/main/res/mipmap-xxhdpi/ic_launcher.webp similarity index 100% rename from app/src/main/res/mipmap-xxhdpi/ic_launcher.webp rename to dodam-student/src/main/res/mipmap-xxhdpi/ic_launcher.webp diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/dodam-student/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp similarity index 100% rename from app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp rename to dodam-student/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/dodam-student/src/main/res/mipmap-xxxhdpi/ic_launcher.webp similarity index 100% rename from app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp rename to dodam-student/src/main/res/mipmap-xxxhdpi/ic_launcher.webp diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/dodam-student/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp similarity index 100% rename from app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp rename to dodam-student/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp diff --git a/app/src/main/res/xml/backup_rules.xml b/dodam-student/src/main/res/xml/backup_rules.xml similarity index 100% rename from app/src/main/res/xml/backup_rules.xml rename to dodam-student/src/main/res/xml/backup_rules.xml diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/dodam-student/src/main/res/xml/data_extraction_rules.xml similarity index 100% rename from app/src/main/res/xml/data_extraction_rules.xml rename to dodam-student/src/main/res/xml/data_extraction_rules.xml diff --git a/app/src/test/kotlin/com/b1nd/dodam/ExampleUnitTest.kt b/dodam-student/src/test/kotlin/com/b1nd/dodam/student/ExampleUnitTest.kt similarity index 91% rename from app/src/test/kotlin/com/b1nd/dodam/ExampleUnitTest.kt rename to dodam-student/src/test/kotlin/com/b1nd/dodam/student/ExampleUnitTest.kt index 712d1ea8..9effe38f 100644 --- a/app/src/test/kotlin/com/b1nd/dodam/ExampleUnitTest.kt +++ b/dodam-student/src/test/kotlin/com/b1nd/dodam/student/ExampleUnitTest.kt @@ -1,4 +1,4 @@ -package com.b1nd.dodam +package com.b1nd.dodam.student import org.junit.Assert.assertEquals import org.junit.Test From f6ed56b60acd027f688baf878bdb171596e63e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A4=EC=84=9D=EA=B7=9C?= Date: Wed, 10 Jan 2024 03:10:17 +0900 Subject: [PATCH 6/8] refactor: Seperate theme files into `designsystem` module --- {app => core/designsystem}/.gitignore | 0 core/designsystem/build.gradle.kts | 12 ++++++++++++ .../java/com/b1nd/dodam/designsystem}/theme/Color.kt | 2 +- .../java/com/b1nd/dodam/designsystem}/theme/Theme.kt | 2 +- .../java/com/b1nd/dodam/designsystem}/theme/Type.kt | 2 +- .../src/main/res/values/colors.xml | 0 .../src/main/res/values/strings.xml | 0 .../src/main/res/values/themes.xml | 0 settings.gradle.kts | 5 ++++- 9 files changed, 19 insertions(+), 4 deletions(-) rename {app => core/designsystem}/.gitignore (100%) create mode 100644 core/designsystem/build.gradle.kts rename {app/src/main/kotlin/com/b1nd/dodam => core/designsystem/src/main/java/com/b1nd/dodam/designsystem}/theme/Color.kt (85%) rename {app/src/main/kotlin/com/b1nd/dodam => core/designsystem/src/main/java/com/b1nd/dodam/designsystem}/theme/Theme.kt (98%) rename {app/src/main/kotlin/com/b1nd/dodam => core/designsystem/src/main/java/com/b1nd/dodam/designsystem}/theme/Type.kt (95%) rename {app => dodam-student}/src/main/res/values/colors.xml (100%) rename {app => dodam-student}/src/main/res/values/strings.xml (100%) rename {app => dodam-student}/src/main/res/values/themes.xml (100%) diff --git a/app/.gitignore b/core/designsystem/.gitignore similarity index 100% rename from app/.gitignore rename to core/designsystem/.gitignore diff --git a/core/designsystem/build.gradle.kts b/core/designsystem/build.gradle.kts new file mode 100644 index 00000000..6273386d --- /dev/null +++ b/core/designsystem/build.gradle.kts @@ -0,0 +1,12 @@ +plugins { + id("b1nd.dodam.primitive.android") + id("b1nd.dodam.primitive.android.kotlin") + id("b1nd.dodam.primitive.android.compose") +} + +android { + namespace = "com.b1nd.dodam.designsystem" + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } +} diff --git a/app/src/main/kotlin/com/b1nd/dodam/theme/Color.kt b/core/designsystem/src/main/java/com/b1nd/dodam/designsystem/theme/Color.kt similarity index 85% rename from app/src/main/kotlin/com/b1nd/dodam/theme/Color.kt rename to core/designsystem/src/main/java/com/b1nd/dodam/designsystem/theme/Color.kt index eed65288..5cfe6cdf 100644 --- a/app/src/main/kotlin/com/b1nd/dodam/theme/Color.kt +++ b/core/designsystem/src/main/java/com/b1nd/dodam/designsystem/theme/Color.kt @@ -1,4 +1,4 @@ -package com.b1nd.dodam.theme +package com.b1nd.dodam.designsystem.theme import androidx.compose.ui.graphics.Color diff --git a/app/src/main/kotlin/com/b1nd/dodam/theme/Theme.kt b/core/designsystem/src/main/java/com/b1nd/dodam/designsystem/theme/Theme.kt similarity index 98% rename from app/src/main/kotlin/com/b1nd/dodam/theme/Theme.kt rename to core/designsystem/src/main/java/com/b1nd/dodam/designsystem/theme/Theme.kt index 352a90ca..e9859812 100644 --- a/app/src/main/kotlin/com/b1nd/dodam/theme/Theme.kt +++ b/core/designsystem/src/main/java/com/b1nd/dodam/designsystem/theme/Theme.kt @@ -1,4 +1,4 @@ -package com.b1nd.dodam.theme +package com.b1nd.dodam.designsystem.theme import android.app.Activity import android.os.Build diff --git a/app/src/main/kotlin/com/b1nd/dodam/theme/Type.kt b/core/designsystem/src/main/java/com/b1nd/dodam/designsystem/theme/Type.kt similarity index 95% rename from app/src/main/kotlin/com/b1nd/dodam/theme/Type.kt rename to core/designsystem/src/main/java/com/b1nd/dodam/designsystem/theme/Type.kt index 44430b0b..f5394257 100644 --- a/app/src/main/kotlin/com/b1nd/dodam/theme/Type.kt +++ b/core/designsystem/src/main/java/com/b1nd/dodam/designsystem/theme/Type.kt @@ -1,4 +1,4 @@ -package com.b1nd.dodam.theme +package com.b1nd.dodam.designsystem.theme import androidx.compose.material3.Typography import androidx.compose.ui.text.TextStyle diff --git a/app/src/main/res/values/colors.xml b/dodam-student/src/main/res/values/colors.xml similarity index 100% rename from app/src/main/res/values/colors.xml rename to dodam-student/src/main/res/values/colors.xml diff --git a/app/src/main/res/values/strings.xml b/dodam-student/src/main/res/values/strings.xml similarity index 100% rename from app/src/main/res/values/strings.xml rename to dodam-student/src/main/res/values/strings.xml diff --git a/app/src/main/res/values/themes.xml b/dodam-student/src/main/res/values/themes.xml similarity index 100% rename from app/src/main/res/values/themes.xml rename to dodam-student/src/main/res/values/themes.xml diff --git a/settings.gradle.kts b/settings.gradle.kts index 8e46970c..99a652c4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -15,4 +15,7 @@ dependencyResolutionManagement { } rootProject.name = "dodamdodam-android" -include(":app") +include( + ":dodam-student", + ":core:designsystem" +) From 7a160754b4b1b9e4afa320096b1e31860c6872e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A4=EC=84=9D=EA=B7=9C?= Date: Wed, 10 Jan 2024 03:18:12 +0900 Subject: [PATCH 7/8] feat: Create `NavHost` in `MainActvity` --- .../kotlin/com/b1nd/dodam/MainActivity.kt | 46 ------------------- .../kotlin/com/b1nd/dodam/student/DodamApp.kt | 19 ++++++++ .../b1nd/dodam/student/DodamApplication.kt | 7 +++ .../com/b1nd/dodam/student/MainActivity.kt | 31 +++++++++++++ 4 files changed, 57 insertions(+), 46 deletions(-) delete mode 100644 app/src/main/kotlin/com/b1nd/dodam/MainActivity.kt create mode 100644 dodam-student/src/main/kotlin/com/b1nd/dodam/student/DodamApp.kt create mode 100644 dodam-student/src/main/kotlin/com/b1nd/dodam/student/DodamApplication.kt create mode 100644 dodam-student/src/main/kotlin/com/b1nd/dodam/student/MainActivity.kt diff --git a/app/src/main/kotlin/com/b1nd/dodam/MainActivity.kt b/app/src/main/kotlin/com/b1nd/dodam/MainActivity.kt deleted file mode 100644 index b0b82b88..00000000 --- a/app/src/main/kotlin/com/b1nd/dodam/MainActivity.kt +++ /dev/null @@ -1,46 +0,0 @@ -package com.b1nd.dodam - -import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.Surface -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import com.b1nd.dodam.theme.DodamdodamandroidTheme - -class MainActivity : ComponentActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContent { - DodamdodamandroidTheme { - // A surface container using the 'background' color from the theme - Surface( - modifier = Modifier.fillMaxSize(), - color = MaterialTheme.colorScheme.background, - ) { - Greeting("Android") - } - } - } - } -} - -@Composable -fun Greeting(name: String, modifier: Modifier = Modifier) { - Text( - text = "Hello $name!", - modifier = modifier, - ) -} - -@Preview(showBackground = true) -@Composable -fun GreetingPreview() { - DodamdodamandroidTheme { - Greeting("Android") - } -} diff --git a/dodam-student/src/main/kotlin/com/b1nd/dodam/student/DodamApp.kt b/dodam-student/src/main/kotlin/com/b1nd/dodam/student/DodamApp.kt new file mode 100644 index 00000000..8adf86ed --- /dev/null +++ b/dodam-student/src/main/kotlin/com/b1nd/dodam/student/DodamApp.kt @@ -0,0 +1,19 @@ +package com.b1nd.dodam.student + +import androidx.compose.runtime.Composable +import androidx.navigation.NavHostController +import androidx.navigation.compose.NavHost +import androidx.navigation.compose.rememberNavController +import com.b1nd.dodam.designsystem.theme.DodamdodamandroidTheme + +@Composable +fun DodamApp(navController: NavHostController = rememberNavController()) { + DodamdodamandroidTheme { + NavHost( + navController = navController, + startDestination = "" // TODO : Set startDestination + ) { + // TODO : Add navigation composable + } + } +} \ No newline at end of file diff --git a/dodam-student/src/main/kotlin/com/b1nd/dodam/student/DodamApplication.kt b/dodam-student/src/main/kotlin/com/b1nd/dodam/student/DodamApplication.kt new file mode 100644 index 00000000..4a55196a --- /dev/null +++ b/dodam-student/src/main/kotlin/com/b1nd/dodam/student/DodamApplication.kt @@ -0,0 +1,7 @@ +package com.b1nd.dodam.student + +import android.app.Application +import dagger.hilt.android.HiltAndroidApp + +@HiltAndroidApp +class DodamApplication : Application() diff --git a/dodam-student/src/main/kotlin/com/b1nd/dodam/student/MainActivity.kt b/dodam-student/src/main/kotlin/com/b1nd/dodam/student/MainActivity.kt new file mode 100644 index 00000000..f24957f8 --- /dev/null +++ b/dodam-student/src/main/kotlin/com/b1nd/dodam/student/MainActivity.kt @@ -0,0 +1,31 @@ +package com.b1nd.dodam.student + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.SystemBarStyle +import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge +import androidx.compose.runtime.DisposableEffect +import androidx.compose.runtime.LaunchedEffect +import com.b1nd.dodam.designsystem.theme.DodamdodamandroidTheme +import dagger.hilt.android.AndroidEntryPoint + +@AndroidEntryPoint +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContent { + LaunchedEffect(Unit) { + enableEdgeToEdge( + statusBarStyle = SystemBarStyle.light( + android.graphics.Color.TRANSPARENT, + android.graphics.Color.TRANSPARENT + ) + ) + } + DodamdodamandroidTheme { + DodamApp() + } + } + } +} From 8fa91e6a6b68803f9a00898e46d7a6257095d2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A4=EC=84=9D=EA=B7=9C?= Date: Wed, 10 Jan 2024 03:34:19 +0900 Subject: [PATCH 8/8] style: Apply spotless format --- .gitignore | 4 ++++ dodam-student/src/main/AndroidManifest.xml | 3 ++- .../kotlin/com/b1nd/dodam/student/DodamApp.kt | 4 ++-- .../com/b1nd/dodam/student/MainActivity.kt | 23 +++++++++---------- gradle/libs.versions.toml | 2 +- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 61f3cbda..0cb78913 100644 --- a/.gitignore +++ b/.gitignore @@ -207,6 +207,10 @@ atlassian-ide-plugin.xml # Mongo Explorer plugin .idea/mongoSettings.xml +*.csv +*.json +*.txt + # Crashlytics plugin (for Android Studio and IntelliJ) com_crashlytics_export_strings.xml crashlytics.properties diff --git a/dodam-student/src/main/AndroidManifest.xml b/dodam-student/src/main/AndroidManifest.xml index 31c50c85..cb1df383 100644 --- a/dodam-student/src/main/AndroidManifest.xml +++ b/dodam-student/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ xmlns:tools="http://schemas.android.com/tools"> diff --git a/dodam-student/src/main/kotlin/com/b1nd/dodam/student/DodamApp.kt b/dodam-student/src/main/kotlin/com/b1nd/dodam/student/DodamApp.kt index 8adf86ed..530bfad3 100644 --- a/dodam-student/src/main/kotlin/com/b1nd/dodam/student/DodamApp.kt +++ b/dodam-student/src/main/kotlin/com/b1nd/dodam/student/DodamApp.kt @@ -11,9 +11,9 @@ fun DodamApp(navController: NavHostController = rememberNavController()) { DodamdodamandroidTheme { NavHost( navController = navController, - startDestination = "" // TODO : Set startDestination + startDestination = "", ) { // TODO : Add navigation composable } } -} \ No newline at end of file +} diff --git a/dodam-student/src/main/kotlin/com/b1nd/dodam/student/MainActivity.kt b/dodam-student/src/main/kotlin/com/b1nd/dodam/student/MainActivity.kt index f24957f8..771a539c 100644 --- a/dodam-student/src/main/kotlin/com/b1nd/dodam/student/MainActivity.kt +++ b/dodam-student/src/main/kotlin/com/b1nd/dodam/student/MainActivity.kt @@ -5,7 +5,6 @@ import androidx.activity.ComponentActivity import androidx.activity.SystemBarStyle import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge -import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import com.b1nd.dodam.designsystem.theme.DodamdodamandroidTheme import dagger.hilt.android.AndroidEntryPoint @@ -15,17 +14,17 @@ class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { - LaunchedEffect(Unit) { - enableEdgeToEdge( - statusBarStyle = SystemBarStyle.light( - android.graphics.Color.TRANSPARENT, - android.graphics.Color.TRANSPARENT - ) - ) - } - DodamdodamandroidTheme { - DodamApp() - } + LaunchedEffect(Unit) { + enableEdgeToEdge( + statusBarStyle = SystemBarStyle.light( + android.graphics.Color.TRANSPARENT, + android.graphics.Color.TRANSPARENT, + ), + ) + } + DodamdodamandroidTheme { + DodamApp() + } } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7df43f2c..7d0c7191 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ appVersion = "1.0.0" versionCode = "1" # kotlin -kotlin = "1.9.22" +kotlin = "1.9.21" kotlinx-coroutines = "1.7.3" kotlinx-collections-immutable = "0.3.7"