From edf2de1524a97f25dc7aeebb87036aeafd610a02 Mon Sep 17 00:00:00 2001 From: hyeseon Date: Thu, 30 Jan 2025 15:39:26 +0900 Subject: [PATCH 1/9] [chore/#8] add plugin & library in version catalog --- gradle/libs.versions.toml | 258 +++++++++++++++++++++++++++++++++----- 1 file changed, 229 insertions(+), 29 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d911b8b..68aa5b5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,36 +1,236 @@ + [versions] -agp = "8.8.0" -kotlin = "1.9.0" -coreKtx = "1.15.0" -junit = "4.13.2" -junitVersion = "1.2.1" -espressoCore = "3.6.1" -lifecycleRuntimeKtx = "2.8.7" -activityCompose = "1.9.3" -composeBom = "2024.04.01" +# SDK Versions +compileSdk = "34" +minSdk = "28" +targetSdk = "34" +jdkVersion = "17" + +# App Versioning +versionName = "1.0.0" +versionCode = "1" + +# Android Plugin Versions +android-gradle-plugin = "8.5.0" +ksp = "2.0.0-1.0.22" -# third-party +# Formatting Plugin Versions ktlint = "12.1.0" +detekt = "1.23.6" -[libraries] -androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } -junit = { group = "junit", name = "junit", version.ref = "junit" } -androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } -androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } -androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" } -androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" } -androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } -androidx-ui = { group = "androidx.compose.ui", name = "ui" } -androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } -androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } -androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } -androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } -androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } -androidx-material3 = { group = "androidx.compose.material3", name = "material3" } +# Kotlin Versions +kotlin = "2.0.0" +kotlinx-coroutines = "1.8.1" +kotlinx-serialization-json = "1.7.1" +kotlinx-serialization-converter = "1.0.0" +kotlinx-datetime = "0.6.0" +kotlinx-collections = "0.3.7" + +# Test Libraries Versions +junit = "4.13.2" +mockito = "5.12.0" +robolectric = "4.12.2" +androidx-test-ext-junit = "1.2.1" +androidx-test-runner = "1.6.2" +androidx-test = "1.6.1" +espresso-core = "3.6.1" + +# AndroidX Libraries Versions +androidx-app-compat = "1.7.0" +androidx-core = "1.15.0" +androidx-lifecycle = "2.8.7" +androidx-navigation = "2.8.6" +androidx-constraint-layout = "2.2.0" +androidx-activity-ktx = "1.10.0" +androidx-fragment-ktx = "1.8.5" +androidx-recycler-view = "1.4.0" +androidx-splash-screen = "1.0.1" +androidx-datastore = "1.1.2" +androidx-paging = "3.3.5" +androidx-paging-compose = "3.3.5" +androidx-media3 = "1.5.1" +androidx-splashscreen = "1.0.1" +androix-room = "2.6.1" +androidx-hilt-navigation-compose = "1.2.0" + +# Google Libraries Versions +google-service = "4.4.2" +material = "1.12.0" +firebase-bom = "33.8.0" +crashlytics = "3.0.2" + +# Compose Versions +compose-compiler = "1.5.1" +compose-bom = "2025.01.01" +compose-material3 = "1.2.0-alpha07" +activity-compose = "1.8.2" +compose-stable-marker = "1.0.3" + +# Hilt Versions +hilt = "2.52" + +# Other Libraries Versions +javax = "1" +retrofit = "2.11.0" +retrofit-kotlinx-serialization-json = "1.0.0" +okhttp = "4.12.0" +orbit = "8.0.0" +timber = "5.0.1" +coil = "2.7.0" +lottie = "6.4.1" +jsoup = "1.17.2" +kakao-login = "2.19.0" +process-pheonix = "3.0.0" +preference = "1.2.1" +spotless = "6.21.0" [plugins] -android-application = { id = "com.android.application", version.ref = "agp" } -jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +# Gradle Plugins +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" } -detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.23.1" } -spotless = { id = "com.diffplug.spotless", version = "6.21.0" } +android-application = { id = "com.android.application", version.ref = "android-gradle-plugin" } +android-library = { id = "com.android.library", version.ref = "android-gradle-plugin" } +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" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } +spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } + +# Custom Plugins +daangn-gallery-application = { id = "daangn.gallery.android.application", version = "unspecified" } +daangn-gallery-android-application-compose = { id = "daangn.gallery.android.application.compose", version = "unspecified"} +daangn-gallery-android-library = { id = "daangn.gallery.android.library", version = "unspecified" } +daangn-gallery-android-compose-library = { id = "daangn.gallery.android.compose.library", version = "unspecified" } +daangn-gallery-android-hilt = { id = "daangn.gallery.android.hilt", version = "unspecified"} +daangn-gallery-java-library = { id = "daangn.gallery.java.library", version = "unspecified" } +daangn-gallery-feature = { id = "daangn.gallery.feature", version = "unspecified" } +daangn-gallery-data = { id = "daangn.gallery.data", version = "unspecified" } +daangn-gallery-plugin-android-test = { id = "daangn.gallery.plugin.android.test", version = "unspecified" } +daangn-gallery-plugin-test = { id = "daangn.gallery.plugin.test", version = "unspecified" } +daangn-gallery-plugin-build-config = { id = "daangn.gallery.plugin.build.config", version = "unspecified" } + +[libraries] +# Android Gradle Plugin +android-gradle-plugin = { group = "com.android.tools.build", name = "gradle", version.ref = "android-gradle-plugin" } +kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } +ksp-gradle-plugin = { group = "com.google.devtools.ksp", name = "com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" } + +# Kotlin Extensions and Libraries +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" } +kotlinx-collections = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "kotlinx-collections" } + +# Testing Libraries +junit = { group = "junit", name = "junit", version.ref = "junit" } +mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" } +robolectric = { group = "org.robolectric", name = "robolectric", version.ref = "robolectric"} +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" } + +# AndroidX Libraries +androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-app-compat" } +androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core" } +androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidx-constraint-layout" } +androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" } +androidx-lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" } +androidx-activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "androidx-activity-ktx" } +androidx-fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "androidx-fragment-ktx" } +androidx-recyclerview = { group = "androidx.recyclerview", name = "recyclerview", version.ref = "androidx-recycler-view" } +androidx-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "androidx-splash-screen" } +androidx-paging = { group = "androidx.paging", name = "paging-runtime", version.ref = "androidx-paging" } +androidx-paging-common = { group = "androidx.paging", name = "paging-common", version.ref = "androidx-paging" } +androidx-paging-compose = { group = "androidx.paging", name = "paging-compose", version.ref = "androidx-paging-compose" } +androidx-media3-exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "androidx-media3" } +androidx-media3-exoplayer-dash = { group = "androidx.media3", name = "media3-exoplayer-dash", version.ref = "androidx-media3" } +androidx-media3-ui = { group = "androidx.media3", name = "media3-ui", version.ref = "androidx-media3" } +navigation-fragment-ktx = { group = "androidx.navigation", name = "navigation-fragment-ktx", version.ref = "androidx-navigation" } +navigation-ui-ktx = { group = "androidx.navigation", name = "navigation-ui-ktx", version.ref = "androidx-navigation" } +androidx-datastore-core = { group = "androidx.datastore", name = "datastore", version.ref = "androidx-datastore" } +androidx-datastore-preferences = { group = "androidx.datastore", name = "datastore-preferences", version.ref = "androidx-datastore" } +androidx-room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "androix-room" } +androidx-room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "androix-room" } +androidx-room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "androix-room" } + +# Compose Libraries +compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" } +ui = { group = "androidx.compose.ui", name = "ui" } +ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } +ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } +ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } +ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } +ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } +ui-foundation = { group = "androidx.compose.foundation", name = "foundation" } +material3-compose = { group = "androidx.compose.material3", name = "material3" } +coil-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil" } +activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidx-activity-ktx" } +lifecycle-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidx-lifecycle" } +navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "androidx-navigation" } +hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "androidx-hilt-navigation-compose" } +compose-compiler-extension = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin" } + +# Hilt +hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" } +hilt-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" } +hilt-core = { group = "com.google.dagger", name = "hilt-core", version.ref = "hilt" } +hilt-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" } +javax-inject = {group = "javax.inject", name = "javax.inject", version.ref = "javax" } + +# Orbit +orbit-core = { group = "org.orbit-mvi", name = "orbit-core", version.ref = "orbit" } +orbit-compose = { group = "org.orbit-mvi", name = "orbit-compose", version.ref = "orbit" } +orbit-viewmodel = { group = "org.orbit-mvi", name = "orbit-viewmodel", version.ref = "orbit" } + +# Retrofit +okhttp-bom = { module = "com.squareup.okhttp3:okhttp-bom", version.ref = "okhttp" } +okhttp = { module = "com.squareup.okhttp3:okhttp" } +okhttp-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor" } +retrofit-kotlinx-serialization-converter = { group = "com.jakewharton.retrofit", name = "retrofit2-kotlinx-serialization-converter", version.ref = "kotlinx-serialization-converter" } +retrofit-core = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" } +retrofit-kotlin-serialization = { group = "com.jakewharton.retrofit", name = "retrofit2-kotlinx-serialization-converter", version.ref = "retrofit-kotlinx-serialization-json" } +okhttp-logging = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" } + +# Google Libraries +google-material = { group = "com.google.android.material", name = "material", version.ref = "material" } +crashlytics-plugin = { module = "com.google.firebase:firebase-crashlytics-gradle", version.ref = "crashlytics" } +firebase-bom = { group = "com.google.firebase", name = "firebase-bom", version.ref = "firebase-bom" } +firebase-messaging = { group = "com.google.firebase", name = "firebase-messaging-ktx" } +firebase-crashlytics = { group = "com.google.firebase", name = "firebase-crashlytics-ktx" } +firebase-analytics = { group = "com.google.firebase", name = "firebase-analytics-ktx" } +firebase-remoteConfig = { group = "com.google.firebase", name = "firebase-config-ktx" } +firebase-database = { group = "com.google.firebase", name = "firebase-database-ktx" } + +# Timber +timber = { group = "com.jakewharton.timber", name = "timber", version.ref = "timber" } + +# formatting +detekt-plugin-formatting = { group = "io.gitlab.arturbosch.detekt", name = "detekt-formatting", version.ref = "detekt" } +itlab-detekt-plugin-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-plugin-formatting", version.ref = "detekt" } + +# Miscellaneous Libraries +coil = { group = "io.coil-kt", name = "coil", version.ref = "coil" } +lottie = { group = "com.airbnb.android", name = "lottie", version.ref = "lottie" } +jsoup = { group = "org.jsoup", name = "jsoup", version.ref = "jsoup" } +kakao-login = { group = "com.kakao.sdk", name = "v2-user", version.ref = "kakao-login" } +process-phoenix = { module = "com.jakewharton:process-phoenix", version.ref = "process-pheonix" } + +[bundles] +firebase = ["firebase-analytics", "firebase-database", "firebase-messaging", "firebase-remoteConfig"] +androidx-lifecycle = ["androidx-lifecycle-runtime-ktx", "androidx-lifecycle-viewmodel-ktx"] +androidx-navigation = ["navigation-fragment-ktx", "navigation-ui-ktx"] +coroutine = ["kotlinx-coroutines-android", "kotlinx-coroutines-core"] +datastore = ["androidx-datastore-core", "androidx-datastore-preferences"] +compose = ["ui", "ui-graphics", "ui-tooling-preview", "material3-compose", "coil-compose", "ui-foundation", "activity-compose", "lifecycle-compose", "navigation-compose", "hilt-navigation-compose"] +compose-debug = ["ui-tooling", "ui-test-manifest"] +media3 = ["androidx-media3-exoplayer", "androidx-media3-exoplayer-dash", "androidx-media3-ui" ] + +orbit = ["orbit-core", "orbit-viewmodel", "orbit-compose"] From e431ecf3a4d417d782116543059959d8281a50f1 Mon Sep 17 00:00:00 2001 From: hyeseon Date: Thu, 30 Jan 2025 16:20:59 +0900 Subject: [PATCH 2/9] [feat/#8] implement build-logic module, custom convention plugin - android application - compose - android library - build config - hilt - java library - data, feature --- app/build.gradle.kts | 88 +------------------ build-logic/.gitignore | 1 + build-logic/convention/.gitignore | 1 + build-logic/convention/build.gradle.kts | 73 +++++++++++++++ .../src/main/java/AndroidApplicationPlugin.kt | 35 ++++++++ .../main/java/AndroidComposeLibraryPlugin.kt | 19 ++++ .../src/main/java/AndroidLibraryPlugin.kt | 29 ++++++ .../src/main/java/BuildConfigPlugin.kt | 15 ++++ .../src/main/java/JavaLibraryPlugin.kt | 35 ++++++++ .../src/main/java/MisikDataPlugin.kt | 13 +++ .../src/main/java/MisikFeaturePlugin.kt | 19 ++++ .../src/main/java/UnitTestPlugin.kt | 29 ++++++ .../misik/convention/AndroidCompose.kt | 34 +++++++ .../nexters/misik/convention/BuildConfig.kt | 23 +++++ .../com/nexters/misik/convention/Const.kt | 7 ++ .../nexters/misik/convention/HiltPlugin.kt | 26 ++++++ .../nexters/misik/convention/KotlinAndroid.kt | 55 ++++++++++++ .../misik/convention/KotlinCoroutine.kt | 18 ++++ .../DependencyHandlerScopeExtension.kt | 55 ++++++++++++ .../convention/extension/ProjectExtension.kt | 9 ++ .../extension/VersionCatalogExtension.kt | 25 ++++++ build-logic/settings.gradle.kts | 15 ++++ build.gradle.kts | 41 +++++---- gradle/libs.versions.toml | 23 ++--- settings.gradle.kts | 4 +- 25 files changed, 579 insertions(+), 113 deletions(-) create mode 100644 build-logic/.gitignore create mode 100644 build-logic/convention/.gitignore create mode 100644 build-logic/convention/build.gradle.kts create mode 100644 build-logic/convention/src/main/java/AndroidApplicationPlugin.kt create mode 100644 build-logic/convention/src/main/java/AndroidComposeLibraryPlugin.kt create mode 100644 build-logic/convention/src/main/java/AndroidLibraryPlugin.kt create mode 100644 build-logic/convention/src/main/java/BuildConfigPlugin.kt create mode 100644 build-logic/convention/src/main/java/JavaLibraryPlugin.kt create mode 100644 build-logic/convention/src/main/java/MisikDataPlugin.kt create mode 100644 build-logic/convention/src/main/java/MisikFeaturePlugin.kt create mode 100644 build-logic/convention/src/main/java/UnitTestPlugin.kt create mode 100644 build-logic/convention/src/main/java/com/nexters/misik/convention/AndroidCompose.kt create mode 100644 build-logic/convention/src/main/java/com/nexters/misik/convention/BuildConfig.kt create mode 100644 build-logic/convention/src/main/java/com/nexters/misik/convention/Const.kt create mode 100644 build-logic/convention/src/main/java/com/nexters/misik/convention/HiltPlugin.kt create mode 100644 build-logic/convention/src/main/java/com/nexters/misik/convention/KotlinAndroid.kt create mode 100644 build-logic/convention/src/main/java/com/nexters/misik/convention/KotlinCoroutine.kt create mode 100644 build-logic/convention/src/main/java/com/nexters/misik/convention/extension/DependencyHandlerScopeExtension.kt create mode 100644 build-logic/convention/src/main/java/com/nexters/misik/convention/extension/ProjectExtension.kt create mode 100644 build-logic/convention/src/main/java/com/nexters/misik/convention/extension/VersionCatalogExtension.kt create mode 100644 build-logic/settings.gradle.kts diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d31683b..bcba174 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,88 +1,8 @@ + plugins { + alias(libs.plugins.kotlin.android) alias(libs.plugins.android.application) - alias(libs.plugins.jetbrains.kotlin.android) - alias(libs.plugins.ktlint) - alias(libs.plugins.detekt) - alias(libs.plugins.spotless) -} - -val ktlintVersion = "0.50.0" - -android { - namespace = "com.nexters.misik" - compileSdk = 35 - - defaultConfig { - applicationId = "com.nexters.misik" - minSdk = 24 - targetSdk = 35 - versionCode = 1 - versionName = "1.0" - - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - vectorDrawables { - useSupportLibrary = true - } - } - - buildTypes { - release { - isMinifyEnabled = false - proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro", - ) - } - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = "17" - } - buildFeatures { - compose = true - } - composeOptions { - kotlinCompilerExtensionVersion = "1.5.1" - } - 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) - implementation(platform(libs.androidx.compose.bom)) - implementation(libs.androidx.ui) - implementation(libs.androidx.ui.graphics) - implementation(libs.androidx.ui.tooling.preview) - implementation(libs.androidx.material3) - testImplementation(libs.junit) - androidTestImplementation(libs.androidx.junit) - androidTestImplementation(libs.androidx.espresso.core) - androidTestImplementation(platform(libs.androidx.compose.bom)) - androidTestImplementation(libs.androidx.ui.test.junit4) - debugImplementation(libs.androidx.ui.tooling) - debugImplementation(libs.androidx.ui.test.manifest) -} - -detekt { - config.from("${projectDir}/config/detekt/detekt-config.yml") - buildUponDefaultConfig = true - debug = true -} + alias(libs.plugins.misik.application) + alias(libs.plugins.misik.android.hilt) -spotless { - kotlin { - target("**/*.kt") - targetExclude("**/build/**/*.kt") - ktlint(ktlintVersion) - } } diff --git a/build-logic/.gitignore b/build-logic/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/build-logic/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/build-logic/convention/.gitignore b/build-logic/convention/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/build-logic/convention/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/build-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.kts new file mode 100644 index 0000000..f06706c --- /dev/null +++ b/build-logic/convention/build.gradle.kts @@ -0,0 +1,73 @@ +plugins { + `kotlin-dsl` +} + +group = "com.nexters.misik.convention" + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +tasks.withType { + kotlinOptions { + jvmTarget = "17" + } +} + + +dependencies { + compileOnly(libs.android.gradle.plugin) + compileOnly(libs.kotlin.gradle.plugin) + compileOnly(libs.ksp.gradle.plugin) + compileOnly(libs.compose.compiler.extension) +} + +gradlePlugin { + plugins { + register("androidApplication") { + id = "misik.android.application" + implementationClass = "AndroidApplicationPlugin" + } + + register("misikFeature") { + id = "misik.feature" + implementationClass = "misikFeaturePlugin" + } + + register("misikData") { + id = "misik.data" + implementationClass = "misikDataPlugin" + } + + register("androidLibrary") { + id = "misik.android.library" + implementationClass = "AndroidLibraryPlugin" + } + + register("androidComposeLibrary") { + id = "misik.android.compose.library" + implementationClass = "AndroidComposeLibraryPlugin" + } + + register("androidHilt") { + id = "misik.android.hilt" + implementationClass = "HiltPlugin" + } + + register("javaLibrary") { + id = "misik.java.library" + implementationClass = "JavaLibraryPlugin" + } + + register("buildConfig") { + id = "misik.plugin.build.config" + implementationClass = "BuildConfigPlugin" + } + + register("androidTest") { + id = "misik.plugin.android.test" + implementationClass = "AndroidTestPlugin" + } + } +} diff --git a/build-logic/convention/src/main/java/AndroidApplicationPlugin.kt b/build-logic/convention/src/main/java/AndroidApplicationPlugin.kt new file mode 100644 index 0000000..3215553 --- /dev/null +++ b/build-logic/convention/src/main/java/AndroidApplicationPlugin.kt @@ -0,0 +1,35 @@ +import com.android.build.api.dsl.ApplicationExtension +import com.nexters.misik.convention.configureAndroidCompose +import com.nexters.misik.convention.configureKotlinAndroid +import com.nexters.misik.convention.extension.getLibrary +import com.nexters.misik.convention.extension.getVersion +import com.nexters.misik.convention.extension.implementation +import com.nexters.misik.convention.extension.libs +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.dependencies + +internal class AndroidApplicationPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.android.application") + } + + extensions.configure { + configureKotlinAndroid(this) + configureAndroidCompose(this) + with(defaultConfig) { + targetSdk = libs.getVersion("targetSdk").requiredVersion.toInt() + versionCode = libs.getVersion("versionCode").requiredVersion.toInt() + versionName = libs.getVersion("versionName").requiredVersion + } + } + + dependencies { + implementation(libs.getLibrary("timber")) + } + } + } +} diff --git a/build-logic/convention/src/main/java/AndroidComposeLibraryPlugin.kt b/build-logic/convention/src/main/java/AndroidComposeLibraryPlugin.kt new file mode 100644 index 0000000..50d90b4 --- /dev/null +++ b/build-logic/convention/src/main/java/AndroidComposeLibraryPlugin.kt @@ -0,0 +1,19 @@ +import com.android.build.gradle.LibraryExtension +import com.nexters.misik.convention.configureAndroidCompose +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure + +class AndroidComposeLibraryPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("misik.android.compose.library") + } + + extensions.configure { + configureAndroidCompose(this) + } + } + } +} diff --git a/build-logic/convention/src/main/java/AndroidLibraryPlugin.kt b/build-logic/convention/src/main/java/AndroidLibraryPlugin.kt new file mode 100644 index 0000000..6744184 --- /dev/null +++ b/build-logic/convention/src/main/java/AndroidLibraryPlugin.kt @@ -0,0 +1,29 @@ +import com.android.build.gradle.LibraryExtension +import com.nexters.misik.convention.configureKotlinAndroid +import com.nexters.misik.convention.configureKotlinCoroutine +import com.nexters.misik.convention.extension.getLibrary +import com.nexters.misik.convention.extension.implementation +import com.nexters.misik.convention.extension.libs +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.dependencies + +class AndroidLibraryPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.android.library") + } + + extensions.configure { + configureKotlinAndroid(this) + configureKotlinCoroutine(this) + } + + dependencies { + implementation(libs.getLibrary("timber")) + } + } + } +} diff --git a/build-logic/convention/src/main/java/BuildConfigPlugin.kt b/build-logic/convention/src/main/java/BuildConfigPlugin.kt new file mode 100644 index 0000000..0059d03 --- /dev/null +++ b/build-logic/convention/src/main/java/BuildConfigPlugin.kt @@ -0,0 +1,15 @@ +import com.android.build.gradle.LibraryExtension +import com.nexters.misik.convention.configureBuildConfig +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure + +class BuildConfigPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + extensions.configure { + configureBuildConfig(this) + } + } + } +} diff --git a/build-logic/convention/src/main/java/JavaLibraryPlugin.kt b/build-logic/convention/src/main/java/JavaLibraryPlugin.kt new file mode 100644 index 0000000..f32d402 --- /dev/null +++ b/build-logic/convention/src/main/java/JavaLibraryPlugin.kt @@ -0,0 +1,35 @@ +import com.nexters.misik.convention.Const +import com.nexters.misik.convention.extension.getLibrary +import com.nexters.misik.convention.extension.getVersion +import com.nexters.misik.convention.extension.implementation +import com.nexters.misik.convention.extension.libs +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.plugins.JavaPluginExtension +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.dependencies +import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension + +class JavaLibraryPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("java-library") + apply("org.jetbrains.kotlin.jvm") + } + + extensions.configure { + sourceCompatibility = Const.JAVA_VERSION + targetCompatibility = Const.JAVA_VERSION + } + + extensions.configure { + jvmToolchain(libs.getVersion("jdkVersion").requiredVersion.toInt()) + } + + dependencies { + implementation(libs.getLibrary("javax.inject")) + } + } + } +} diff --git a/build-logic/convention/src/main/java/MisikDataPlugin.kt b/build-logic/convention/src/main/java/MisikDataPlugin.kt new file mode 100644 index 0000000..7861037 --- /dev/null +++ b/build-logic/convention/src/main/java/MisikDataPlugin.kt @@ -0,0 +1,13 @@ +import org.gradle.api.Plugin +import org.gradle.api.Project + +class MisikDataPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("misik.android.library") + apply("misik.android.hilt") + } + } + } +} diff --git a/build-logic/convention/src/main/java/MisikFeaturePlugin.kt b/build-logic/convention/src/main/java/MisikFeaturePlugin.kt new file mode 100644 index 0000000..58731c1 --- /dev/null +++ b/build-logic/convention/src/main/java/MisikFeaturePlugin.kt @@ -0,0 +1,19 @@ +import com.nexters.misik.convention.extension.implementation +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies + +class MisikFeaturePlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("misik.android.compose.library") + apply("misik.android.hilt") + } + + dependencies { + + } + } + } +} diff --git a/build-logic/convention/src/main/java/UnitTestPlugin.kt b/build-logic/convention/src/main/java/UnitTestPlugin.kt new file mode 100644 index 0000000..73f6f9d --- /dev/null +++ b/build-logic/convention/src/main/java/UnitTestPlugin.kt @@ -0,0 +1,29 @@ +import com.android.build.api.dsl.LibraryExtension +import com.nexters.misik.convention.extension.getLibrary +import com.nexters.misik.convention.extension.libs +import com.nexters.misik.convention.extension.testImplementation +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.dependencies + +class UnitTestPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + dependencies { + testImplementation(libs.getLibrary("kotlinx.coroutines.test")) + testImplementation(libs.getLibrary("mockito")) + testImplementation(libs.getLibrary("junit")) + testImplementation(libs.getLibrary("robolectric")) + } + + extensions.configure { + testOptions { + unitTests { + isIncludeAndroidResources = true + } + } + } + } + } +} diff --git a/build-logic/convention/src/main/java/com/nexters/misik/convention/AndroidCompose.kt b/build-logic/convention/src/main/java/com/nexters/misik/convention/AndroidCompose.kt new file mode 100644 index 0000000..3fba674 --- /dev/null +++ b/build-logic/convention/src/main/java/com/nexters/misik/convention/AndroidCompose.kt @@ -0,0 +1,34 @@ +package com.nexters.misik.convention + +import com.android.build.api.dsl.CommonExtension +import com.nexters.misik.convention.extension.debugImplementation +import com.nexters.misik.convention.extension.getBundle +import com.nexters.misik.convention.extension.getLibrary +import com.nexters.misik.convention.extension.implementation +import com.nexters.misik.convention.extension.libs +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.getByType +import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension + +internal fun Project.configureAndroidCompose( + commonExtension: CommonExtension<*, *, *, *, *, *>, +) { + pluginManager.apply("org.jetbrains.kotlin.plugin.compose") + + commonExtension.apply { + buildFeatures { + compose = true + } + extensions.getByType().apply { + enableStrongSkippingMode.set(true) + includeSourceInformation.set(true) + } + dependencies { + implementation(platform(libs.getLibrary("compose.bom"))) + implementation(libs.getBundle("compose")) + debugImplementation(libs.getBundle("compose.debug")) + implementation(libs.getLibrary("kotlinx.collections")) + } + } +} diff --git a/build-logic/convention/src/main/java/com/nexters/misik/convention/BuildConfig.kt b/build-logic/convention/src/main/java/com/nexters/misik/convention/BuildConfig.kt new file mode 100644 index 0000000..974b0d9 --- /dev/null +++ b/build-logic/convention/src/main/java/com/nexters/misik/convention/BuildConfig.kt @@ -0,0 +1,23 @@ +package com.nexters.misik.convention + +import com.android.build.api.dsl.CommonExtension +import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties +import org.gradle.api.Project + +internal fun Project.configureBuildConfig( + commonExtension: CommonExtension<*, *, *, *, *, *>, +) { + commonExtension.apply { + defaultConfig { + buildConfigField( + "String", + "BASE_URL", + gradleLocalProperties(rootDir, providers).getProperty("base.url"), + ) + } + + buildFeatures { + buildConfig = true + } + } +} diff --git a/build-logic/convention/src/main/java/com/nexters/misik/convention/Const.kt b/build-logic/convention/src/main/java/com/nexters/misik/convention/Const.kt new file mode 100644 index 0000000..8440cf2 --- /dev/null +++ b/build-logic/convention/src/main/java/com/nexters/misik/convention/Const.kt @@ -0,0 +1,7 @@ +package com.nexters.misik.convention + +import org.gradle.api.JavaVersion + +object Const { + val JAVA_VERSION = JavaVersion.VERSION_17 +} diff --git a/build-logic/convention/src/main/java/com/nexters/misik/convention/HiltPlugin.kt b/build-logic/convention/src/main/java/com/nexters/misik/convention/HiltPlugin.kt new file mode 100644 index 0000000..0c13332 --- /dev/null +++ b/build-logic/convention/src/main/java/com/nexters/misik/convention/HiltPlugin.kt @@ -0,0 +1,26 @@ +import com.nexters.misik.convention.extension.getLibrary +import com.nexters.misik.convention.extension.implementation +import com.nexters.misik.convention.extension.ksp +import com.nexters.misik.convention.extension.kspTest +import com.nexters.misik.convention.extension.libs +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies + +class HiltPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.google.devtools.ksp") + apply("dagger.hilt.android.plugin") + } + + dependencies { + implementation(libs.getLibrary("hilt.android")) + ksp(libs.getLibrary("hilt.compiler")) + implementation(libs.getLibrary("hilt.testing")) + kspTest(libs.getLibrary("hilt.testing.compiler")) + } + } + } +} diff --git a/build-logic/convention/src/main/java/com/nexters/misik/convention/KotlinAndroid.kt b/build-logic/convention/src/main/java/com/nexters/misik/convention/KotlinAndroid.kt new file mode 100644 index 0000000..7b22956 --- /dev/null +++ b/build-logic/convention/src/main/java/com/nexters/misik/convention/KotlinAndroid.kt @@ -0,0 +1,55 @@ +package com.nexters.misik.convention + +import com.android.build.api.dsl.CommonExtension +import com.nexters.misik.convention.extension.getVersion +import com.nexters.misik.convention.extension.libs +import org.gradle.api.Project +import org.gradle.kotlin.dsl.getByType +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension + +internal fun Project.configureKotlinAndroid( + commonExtension: CommonExtension<*, *, *, *, *, *>, +) { + pluginManager.apply("org.jetbrains.kotlin.android") + + commonExtension.apply { + compileSdk = libs.getVersion("compileSdk").requiredVersion.toInt() + + defaultConfig { + minSdk = libs.getVersion("minSdk").requiredVersion.toInt() + + vectorDrawables.useSupportLibrary = true + } + + compileOptions { + sourceCompatibility = Const.JAVA_VERSION + targetCompatibility = Const.JAVA_VERSION + } + + extensions.getByType().configureCompilerOptions() + + buildTypes { + getByName("debug") { + proguardFiles( + getDefaultProguardFile("proguard-android.txt"), + "proguard-debug.pro", + ) + } + + getByName("release") { + isMinifyEnabled = true + proguardFiles( + getDefaultProguardFile("proguard-android.txt"), + "proguard-rules.pro", + ) + } + } + } +} + +fun KotlinAndroidProjectExtension.configureCompilerOptions() { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_17) + } +} diff --git a/build-logic/convention/src/main/java/com/nexters/misik/convention/KotlinCoroutine.kt b/build-logic/convention/src/main/java/com/nexters/misik/convention/KotlinCoroutine.kt new file mode 100644 index 0000000..fa931cf --- /dev/null +++ b/build-logic/convention/src/main/java/com/nexters/misik/convention/KotlinCoroutine.kt @@ -0,0 +1,18 @@ +package com.nexters.misik.convention + +import com.android.build.api.dsl.CommonExtension +import com.nexters.misik.convention.extension.getBundle +import com.nexters.misik.convention.extension.implementation +import com.nexters.misik.convention.extension.libs +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies + +internal fun Project.configureKotlinCoroutine( + commonExtension: CommonExtension<*, *, *, *, *, *>, +) { + commonExtension.apply { + dependencies { + implementation(libs.getBundle("coroutine")) + } + } +} diff --git a/build-logic/convention/src/main/java/com/nexters/misik/convention/extension/DependencyHandlerScopeExtension.kt b/build-logic/convention/src/main/java/com/nexters/misik/convention/extension/DependencyHandlerScopeExtension.kt new file mode 100644 index 0000000..7345756 --- /dev/null +++ b/build-logic/convention/src/main/java/com/nexters/misik/convention/extension/DependencyHandlerScopeExtension.kt @@ -0,0 +1,55 @@ +package com.nexters.misik.convention.extension + +import org.gradle.api.Project +import org.gradle.api.file.ConfigurableFileCollection +import org.gradle.api.file.ConfigurableFileTree +import org.gradle.api.provider.Provider +import org.gradle.kotlin.dsl.DependencyHandlerScope + +fun DependencyHandlerScope.implementation(project: Project) { + "implementation"(project) +} + +fun DependencyHandlerScope.implementation(provider: Provider<*>) { + "implementation"(provider) +} + +fun DependencyHandlerScope.implementation(fileTree: ConfigurableFileTree) { + "implementation"(fileTree) +} + +fun DependencyHandlerScope.implementation(fileCollection: ConfigurableFileCollection) { + "implementation"(fileCollection) +} + +fun DependencyHandlerScope.debugImplementation(provider: Provider<*>) { + "debugImplementation"(provider) +} + +fun DependencyHandlerScope.releaseImplementation(provider: Provider<*>) { + "releaseImplementation"(provider) +} + +fun DependencyHandlerScope.ksp(provider: Provider<*>) { + "ksp"(provider) +} + +fun DependencyHandlerScope.kspTest(provider: Provider<*>) { + "kspTest"(provider) +} + +fun DependencyHandlerScope.coreLibraryDesugaring(provider: Provider<*>) { + "coreLibraryDesugaring"(provider) +} + +fun DependencyHandlerScope.androidTestImplementation(provider: Provider<*>) { + "androidTestImplementation"(provider) +} + +fun DependencyHandlerScope.testImplementation(provider: Provider<*>) { + "testImplementation"(provider) +} + +fun DependencyHandlerScope.compileOnly(provider: Provider<*>) { + "compileOnly"(provider) +} diff --git a/build-logic/convention/src/main/java/com/nexters/misik/convention/extension/ProjectExtension.kt b/build-logic/convention/src/main/java/com/nexters/misik/convention/extension/ProjectExtension.kt new file mode 100644 index 0000000..71a7fa0 --- /dev/null +++ b/build-logic/convention/src/main/java/com/nexters/misik/convention/extension/ProjectExtension.kt @@ -0,0 +1,9 @@ +package com.nexters.misik.convention.extension + +import org.gradle.api.Project +import org.gradle.api.artifacts.VersionCatalog +import org.gradle.api.artifacts.VersionCatalogsExtension +import org.gradle.kotlin.dsl.getByType + +val Project.libs: VersionCatalog + get() = extensions.getByType().named("libs") diff --git a/build-logic/convention/src/main/java/com/nexters/misik/convention/extension/VersionCatalogExtension.kt b/build-logic/convention/src/main/java/com/nexters/misik/convention/extension/VersionCatalogExtension.kt new file mode 100644 index 0000000..ed4b4fa --- /dev/null +++ b/build-logic/convention/src/main/java/com/nexters/misik/convention/extension/VersionCatalogExtension.kt @@ -0,0 +1,25 @@ +package com.nexters.misik.convention.extension + +import org.gradle.api.artifacts.ExternalModuleDependencyBundle +import org.gradle.api.artifacts.MinimalExternalModuleDependency +import org.gradle.api.artifacts.VersionCatalog +import org.gradle.api.artifacts.VersionConstraint +import org.gradle.api.provider.Provider + +fun VersionCatalog.getBundle(bundleName: String): Provider { + return findBundle(bundleName).orElseThrow { + NoSuchElementException("Bundle with name $bundleName not found in the catalog") + } +} + +fun VersionCatalog.getLibrary(libraryName: String): Provider { + return findLibrary(libraryName).orElseThrow { + NoSuchElementException("Library with name $libraryName not found in the catalog") + } +} + +fun VersionCatalog.getVersion(versionName: String): VersionConstraint { + return findVersion(versionName).orElseThrow { + NoSuchElementException("Version with name $versionName not found in the catalog") + } +} diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts new file mode 100644 index 0000000..8ec7a03 --- /dev/null +++ b/build-logic/settings.gradle.kts @@ -0,0 +1,15 @@ +dependencyResolutionManagement { + repositories { + google() + mavenCentral() + } + versionCatalogs{ + create("libs"){ + // 작성한 버전 카탈로그 toml 파일을 가져와준다 + from(files("../gradle/libs.versions.toml")) + } + } +} + +rootProject.name = "build-logic" +include(":convention") \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 78c7ef6..1d638a3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,19 +1,26 @@ -buildscript { - repositories { - google { - content { - includeGroupByRegex("com\\.android.*") - includeGroupByRegex("com\\.google.*") - includeGroupByRegex("androidx.*") - } - } - mavenCentral() - } -} - -// Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { + alias(libs.plugins.ktlint) + alias(libs.plugins.spotless) alias(libs.plugins.android.application) apply false - alias(libs.plugins.jetbrains.kotlin.android) apply false - alias(libs.plugins.detekt) apply false -} \ No newline at end of file + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.jvm) apply false + alias(libs.plugins.kotlin.serialization) apply false + alias(libs.plugins.ksp) apply false + alias(libs.plugins.hilt) apply false + alias(libs.plugins.compose.compiler) apply false +} + +spotless { + kotlin { + target("**/*.kt") + ktlint("0.50.0").userData(mapOf("indent_size" to "4", "continuation_indent_size" to "4")) + } + kotlinGradle { + target("*.gradle.kts") + ktlint() + "userData" to mapOf( + "disabled_rules" to "no-wildcard-imports,import-ordering,trailing-comma", + ) + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 68aa5b5..ff4b03d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -102,17 +102,17 @@ compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = " spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } # Custom Plugins -daangn-gallery-application = { id = "daangn.gallery.android.application", version = "unspecified" } -daangn-gallery-android-application-compose = { id = "daangn.gallery.android.application.compose", version = "unspecified"} -daangn-gallery-android-library = { id = "daangn.gallery.android.library", version = "unspecified" } -daangn-gallery-android-compose-library = { id = "daangn.gallery.android.compose.library", version = "unspecified" } -daangn-gallery-android-hilt = { id = "daangn.gallery.android.hilt", version = "unspecified"} -daangn-gallery-java-library = { id = "daangn.gallery.java.library", version = "unspecified" } -daangn-gallery-feature = { id = "daangn.gallery.feature", version = "unspecified" } -daangn-gallery-data = { id = "daangn.gallery.data", version = "unspecified" } -daangn-gallery-plugin-android-test = { id = "daangn.gallery.plugin.android.test", version = "unspecified" } -daangn-gallery-plugin-test = { id = "daangn.gallery.plugin.test", version = "unspecified" } -daangn-gallery-plugin-build-config = { id = "daangn.gallery.plugin.build.config", version = "unspecified" } +misik-application = { id = "misik.android.application", version = "unspecified" } +misik-android-application-compose = { id = "misik.android.application.compose", version = "unspecified"} +misik-android-library = { id = "misik.android.library", version = "unspecified" } +misik-android-compose-library = { id = "misik.android.compose.library", version = "unspecified" } +misik-android-hilt = { id = "misik.android.hilt", version = "unspecified"} +misik-java-library = { id = "misik.java.library", version = "unspecified" } +misik-feature = { id = "misik.feature", version = "unspecified" } +misik-data = { id = "misik.data", version = "unspecified" } +misik-plugin-android-test = { id = "misik.plugin.android.test", version = "unspecified" } +misik-plugin-test = { id = "misik.plugin.test", version = "unspecified" } +misik-plugin-build-config = { id = "misik.plugin.build.config", version = "unspecified" } [libraries] # Android Gradle Plugin @@ -183,6 +183,7 @@ hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref hilt-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" } hilt-core = { group = "com.google.dagger", name = "hilt-core", version.ref = "hilt" } hilt-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" } +hilt-testing-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" } javax-inject = {group = "javax.inject", name = "javax.inject", version.ref = "javax" } # Orbit diff --git a/settings.gradle.kts b/settings.gradle.kts index 3614d37..ec8c489 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,4 +1,6 @@ +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") pluginManagement { + includeBuild("build-logic") repositories { google { content { @@ -11,6 +13,7 @@ pluginManagement { gradlePluginPortal() } } + dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { @@ -21,4 +24,3 @@ dependencyResolutionManagement { rootProject.name = "Misik-Android" include(":app") - \ No newline at end of file From 1b12ec5d1beaad72159830d3d92c231b0bf16efc Mon Sep 17 00:00:00 2001 From: hyeseon Date: Thu, 30 Jan 2025 16:28:41 +0900 Subject: [PATCH 3/9] [feat/#8] create data, domain, feature module --- build-logic/convention/build.gradle.kts | 4 ++-- data/.gitignore | 1 + data/build.gradle.kts | 15 +++++++++++++++ data/src/main/java/com/nexters/misik/data/data.kt | 4 ++++ domain/.gitignore | 1 + domain/build.gradle.kts | 15 +++++++++++++++ .../main/java/com/nexters/misik/domain/MyClass.kt | 4 ++++ feature/.gitignore | 1 + feature/webview/.gitignore | 1 + feature/webview/build.gradle.kts | 12 ++++++++++++ .../java/com/nexters/misik/webview/MyClass.kt | 4 ++++ settings.gradle.kts | 4 ++++ 12 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 data/.gitignore create mode 100644 data/build.gradle.kts create mode 100644 data/src/main/java/com/nexters/misik/data/data.kt create mode 100644 domain/.gitignore create mode 100644 domain/build.gradle.kts create mode 100644 domain/src/main/java/com/nexters/misik/domain/MyClass.kt create mode 100644 feature/.gitignore create mode 100644 feature/webview/.gitignore create mode 100644 feature/webview/build.gradle.kts create mode 100644 feature/webview/src/main/java/com/nexters/misik/webview/MyClass.kt diff --git a/build-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.kts index f06706c..7f1bc9d 100644 --- a/build-logic/convention/build.gradle.kts +++ b/build-logic/convention/build.gradle.kts @@ -32,12 +32,12 @@ gradlePlugin { register("misikFeature") { id = "misik.feature" - implementationClass = "misikFeaturePlugin" + implementationClass = "MisikFeaturePlugin" } register("misikData") { id = "misik.data" - implementationClass = "misikDataPlugin" + implementationClass = "MisikDataPlugin" } register("androidLibrary") { diff --git a/data/.gitignore b/data/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/data/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/data/build.gradle.kts b/data/build.gradle.kts new file mode 100644 index 0000000..d06d933 --- /dev/null +++ b/data/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + alias(libs.plugins.kotlin.android) + alias(libs.plugins.misik.android.library) + alias(libs.plugins.kotlin.serialization) + alias(libs.plugins.misik.android.hilt) +} + +android { + namespace = "com.nexters.misik.data" +} + +dependencies { + implementation(libs.timber) +} + diff --git a/data/src/main/java/com/nexters/misik/data/data.kt b/data/src/main/java/com/nexters/misik/data/data.kt new file mode 100644 index 0000000..2ae4cfc --- /dev/null +++ b/data/src/main/java/com/nexters/misik/data/data.kt @@ -0,0 +1,4 @@ +package com.nexters.misik.data + +class data { +} \ No newline at end of file diff --git a/domain/.gitignore b/domain/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/domain/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts new file mode 100644 index 0000000..159e6df --- /dev/null +++ b/domain/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + alias(libs.plugins.kotlin.android) + alias(libs.plugins.misik.android.library) + alias(libs.plugins.kotlin.serialization) + alias(libs.plugins.misik.android.hilt) +} + +android { + namespace = "com.nexters.misik.domain" +} + +dependencies { + implementation(libs.timber) +} + diff --git a/domain/src/main/java/com/nexters/misik/domain/MyClass.kt b/domain/src/main/java/com/nexters/misik/domain/MyClass.kt new file mode 100644 index 0000000..1f37ddd --- /dev/null +++ b/domain/src/main/java/com/nexters/misik/domain/MyClass.kt @@ -0,0 +1,4 @@ +package com.nexters.misik.domain + +class MyClass { +} \ No newline at end of file diff --git a/feature/.gitignore b/feature/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/feature/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/webview/.gitignore b/feature/webview/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/feature/webview/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/webview/build.gradle.kts b/feature/webview/build.gradle.kts new file mode 100644 index 0000000..1cb0f1a --- /dev/null +++ b/feature/webview/build.gradle.kts @@ -0,0 +1,12 @@ +plugins { + alias(libs.plugins.misik.android.library) + alias(libs.plugins.misik.feature) +} + +android { + namespace = "com.nexters.misik.feature.webview" +} + +dependencies { + implementation(projects.domain) +} diff --git a/feature/webview/src/main/java/com/nexters/misik/webview/MyClass.kt b/feature/webview/src/main/java/com/nexters/misik/webview/MyClass.kt new file mode 100644 index 0000000..937eeda --- /dev/null +++ b/feature/webview/src/main/java/com/nexters/misik/webview/MyClass.kt @@ -0,0 +1,4 @@ +package com.nexters.misik.webview + +class MyClass { +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index ec8c489..a62d809 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,3 +24,7 @@ dependencyResolutionManagement { rootProject.name = "Misik-Android" include(":app") +include(":data") +include(":domain") +include(":feature") +include(":feature:webview") From fbafc6ac375d6ecf20adc782ec6a6ff42298a76b Mon Sep 17 00:00:00 2001 From: hyeseon Date: Thu, 30 Jan 2025 16:35:38 +0900 Subject: [PATCH 4/9] [chore/#8] add internet permission --- app/src/main/AndroidManifest.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 48f2907..925bdbc 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,10 @@ + + Date: Thu, 30 Jan 2025 16:35:57 +0900 Subject: [PATCH 5/9] [feat/#8] implement MisikApplication for using hilt --- .../com/nexters/misik/MisikApplication.kt | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 app/src/main/java/com/nexters/misik/MisikApplication.kt diff --git a/app/src/main/java/com/nexters/misik/MisikApplication.kt b/app/src/main/java/com/nexters/misik/MisikApplication.kt new file mode 100644 index 0000000..f47c05f --- /dev/null +++ b/app/src/main/java/com/nexters/misik/MisikApplication.kt @@ -0,0 +1,21 @@ +package com.nexters.misik + +import android.app.Application +import androidx.multidex.BuildConfig +import dagger.hilt.android.HiltAndroidApp +import timber.log.Timber + +@HiltAndroidApp +class MisikApplication : Application() { + override fun onCreate() { + super.onCreate() + + initTimber() + } + + private fun initTimber() { + if (BuildConfig.DEBUG) { + Timber.plant(Timber.DebugTree()) + } + } +} From 25e8adbfea1d2667d041264e72e847ee3e23ab0d Mon Sep 17 00:00:00 2001 From: hyeseon Date: Thu, 30 Jan 2025 16:36:15 +0900 Subject: [PATCH 6/9] [chore/#8] set compileSdk, minSdk to 35 --- app/build.gradle.kts | 4 ++++ gradle/libs.versions.toml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index bcba174..7bbd037 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -6,3 +6,7 @@ plugins { alias(libs.plugins.misik.android.hilt) } + +android { + namespace = "com.nexters.misik" +} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ff4b03d..28254db 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,9 +1,9 @@ [versions] # SDK Versions -compileSdk = "34" +compileSdk = "35" minSdk = "28" -targetSdk = "34" +targetSdk = "35" jdkVersion = "17" # App Versioning From 8633b9a40d88472aac939f5b56a1fd3a4672ee61 Mon Sep 17 00:00:00 2001 From: hyeseon Date: Thu, 30 Jan 2025 23:13:49 +0900 Subject: [PATCH 7/9] [chore/#8] apply ktlint style --- .../nexters/misik/convention => }/HiltPlugin.kt | 0 .../convention/src/main/java/MisikFeaturePlugin.kt | 2 -- build.gradle.kts | 14 ++++++++++---- data/src/main/java/com/nexters/misik/data/data.kt | 4 ---- .../main/java/com/nexters/misik/domain/MyClass.kt | 4 ---- .../main/java/com/nexters/misik/webview/MyClass.kt | 3 +-- 6 files changed, 11 insertions(+), 16 deletions(-) rename build-logic/convention/src/main/java/{com/nexters/misik/convention => }/HiltPlugin.kt (100%) delete mode 100644 data/src/main/java/com/nexters/misik/data/data.kt delete mode 100644 domain/src/main/java/com/nexters/misik/domain/MyClass.kt diff --git a/build-logic/convention/src/main/java/com/nexters/misik/convention/HiltPlugin.kt b/build-logic/convention/src/main/java/HiltPlugin.kt similarity index 100% rename from build-logic/convention/src/main/java/com/nexters/misik/convention/HiltPlugin.kt rename to build-logic/convention/src/main/java/HiltPlugin.kt diff --git a/build-logic/convention/src/main/java/MisikFeaturePlugin.kt b/build-logic/convention/src/main/java/MisikFeaturePlugin.kt index 58731c1..79593d8 100644 --- a/build-logic/convention/src/main/java/MisikFeaturePlugin.kt +++ b/build-logic/convention/src/main/java/MisikFeaturePlugin.kt @@ -1,4 +1,3 @@ -import com.nexters.misik.convention.extension.implementation import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.dependencies @@ -12,7 +11,6 @@ class MisikFeaturePlugin : Plugin { } dependencies { - } } } diff --git a/build.gradle.kts b/build.gradle.kts index 1d638a3..d460168 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,13 +14,19 @@ plugins { spotless { kotlin { target("**/*.kt") - ktlint("0.50.0").userData(mapOf("indent_size" to "4", "continuation_indent_size" to "4")) + ktlint("0.50.0").userData( + mapOf( + "indent_size" to "4", + "continuation_indent_size" to "4", + ), + ) } kotlinGradle { target("*.gradle.kts") - ktlint() - "userData" to mapOf( - "disabled_rules" to "no-wildcard-imports,import-ordering,trailing-comma", + ktlint().userData( + mapOf( + "disabled_rules" to "no-wildcard-imports, import-ordering, trailing-comma", + ), ) } } diff --git a/data/src/main/java/com/nexters/misik/data/data.kt b/data/src/main/java/com/nexters/misik/data/data.kt deleted file mode 100644 index 2ae4cfc..0000000 --- a/data/src/main/java/com/nexters/misik/data/data.kt +++ /dev/null @@ -1,4 +0,0 @@ -package com.nexters.misik.data - -class data { -} \ No newline at end of file diff --git a/domain/src/main/java/com/nexters/misik/domain/MyClass.kt b/domain/src/main/java/com/nexters/misik/domain/MyClass.kt deleted file mode 100644 index 1f37ddd..0000000 --- a/domain/src/main/java/com/nexters/misik/domain/MyClass.kt +++ /dev/null @@ -1,4 +0,0 @@ -package com.nexters.misik.domain - -class MyClass { -} \ No newline at end of file diff --git a/feature/webview/src/main/java/com/nexters/misik/webview/MyClass.kt b/feature/webview/src/main/java/com/nexters/misik/webview/MyClass.kt index 937eeda..f7a6d57 100644 --- a/feature/webview/src/main/java/com/nexters/misik/webview/MyClass.kt +++ b/feature/webview/src/main/java/com/nexters/misik/webview/MyClass.kt @@ -1,4 +1,3 @@ package com.nexters.misik.webview -class MyClass { -} \ No newline at end of file +class MyClass From 0129f9666f32d5f5dca6f33f76cf2f76be7fe55d Mon Sep 17 00:00:00 2001 From: hyeseon Date: Thu, 30 Jan 2025 23:32:53 +0900 Subject: [PATCH 8/9] [add/#8] add detekt --- build.gradle.kts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index d460168..d9d7011 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ plugins { alias(libs.plugins.ktlint) alias(libs.plugins.spotless) + alias(libs.plugins.detekt) alias(libs.plugins.android.application) apply false alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.android.library) apply false @@ -30,3 +31,9 @@ spotless { ) } } + +detekt { + config.from("${projectDir}/config/detekt/detekt-config.yml") + buildUponDefaultConfig = true + debug = true +} From b11393144eda616c56ed93d54d33ad8dc0089690 Mon Sep 17 00:00:00 2001 From: hyeseon Date: Thu, 30 Jan 2025 23:33:58 +0900 Subject: [PATCH 9/9] [chore/#8] apply spotless style --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index d9d7011..6fd8cde 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -33,7 +33,7 @@ spotless { } detekt { - config.from("${projectDir}/config/detekt/detekt-config.yml") + config.from("$projectDir/config/detekt/detekt-config.yml") buildUponDefaultConfig = true debug = true }