From 0356cbe4af7e3f2b06626ec98f95aaec5f593e9d Mon Sep 17 00:00:00 2001 From: murjune Date: Wed, 15 Jan 2025 15:59:24 +0900 Subject: [PATCH] update version catalog & build-logic --- .gitignore | 1 + algorithm-practice/build.gradle.kts | 3 +- build-logic/convention/build.gradle.kts | 67 ++-- .../main/kotlin/AndroidApplicationPlugin.kt | 69 ++++ .../src/main/kotlin/AndroidFeaturePlugin.kt | 24 ++ .../src/main/kotlin/AndroidLibraryPlugin.kt | 50 +++ .../src/main/kotlin/ComposeLibraryPlugin.kt | 16 + .../practice/plugins => }/JvmLibraryPlugin.kt | 7 +- .../plugins => }/KotlinSerializationPlugin.kt | 5 +- .../practice/plugins => }/UnitTestPlugin.kt | 8 +- .../plugins/AndroidApplicationPlugin.kt | 36 -- .../practice/plugins/AndroidFeaturePlugin.kt | 24 -- .../practice/plugins/AndroidHiltPlugin.kt | 22 -- .../practice/plugins/AndroidLibraryPlugin.kt | 26 -- .../practice/plugins/AndroidTestPlugin.kt | 44 --- .../practice/plugins/ComposeConfigs.kt | 49 +++ .../murjune/practice/plugins/ComposePlugin.kt | 28 -- .../practice/plugins/ComposeTestPlugin.kt | 46 --- .../murjune/practice/plugins/KotlinConfigs.kt | 81 +++++ .../practice/plugins/KotlinModulePlugin.kt | 18 - .../plugins/{utils => }/ProjectExt.kt | 2 +- .../plugins/utils/AndroidCommonConfigs.kt | 22 -- .../practice/plugins/utils/KotlinConfigs.kt | 66 ---- build.gradle.kts | 30 +- compose-test/build.gradle.kts | 12 +- coroutine/build.gradle.kts | 3 +- design-pattern/build.gradle.kts | 3 +- gradle/libs.versions.toml | 317 ++++++++---------- kotlin-practice/build.gradle.kts | 3 +- settings.gradle.kts | 15 +- 30 files changed, 497 insertions(+), 600 deletions(-) create mode 100644 build-logic/convention/src/main/kotlin/AndroidApplicationPlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/AndroidFeaturePlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/AndroidLibraryPlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/ComposeLibraryPlugin.kt rename build-logic/convention/src/main/kotlin/{com/murjune/practice/plugins => }/JvmLibraryPlugin.kt (66%) rename build-logic/convention/src/main/kotlin/{com/murjune/practice/plugins => }/KotlinSerializationPlugin.kt (84%) rename build-logic/convention/src/main/kotlin/{com/murjune/practice/plugins => }/UnitTestPlugin.kt (64%) delete mode 100644 build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidApplicationPlugin.kt delete mode 100644 build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidFeaturePlugin.kt delete mode 100644 build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidHiltPlugin.kt delete mode 100644 build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidLibraryPlugin.kt delete mode 100644 build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidTestPlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ComposeConfigs.kt delete mode 100644 build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ComposePlugin.kt delete mode 100644 build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ComposeTestPlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/KotlinConfigs.kt delete mode 100644 build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/KotlinModulePlugin.kt rename build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/{utils => }/ProjectExt.kt (86%) delete mode 100644 build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/utils/AndroidCommonConfigs.kt delete mode 100644 build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/utils/KotlinConfigs.kt diff --git a/.gitignore b/.gitignore index 9c574f9..744356e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ build/ out/ !**/src/main/**/out/ !**/src/test/**/out/ +.kotlin ### Eclipse ### .apt_generated diff --git a/algorithm-practice/build.gradle.kts b/algorithm-practice/build.gradle.kts index 21ae447..47c0de9 100644 --- a/algorithm-practice/build.gradle.kts +++ b/algorithm-practice/build.gradle.kts @@ -1,5 +1,6 @@ plugins { - alias(libs.plugins.murjune.kotlin.module) + alias(libs.plugins.murjune.jvm.library) + alias(libs.plugins.murjune.unit.test) } group = "com.murjune.practice.algorithm" diff --git a/build-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.kts index 9af6763..8d9099a 100644 --- a/build-logic/convention/build.gradle.kts +++ b/build-logic/convention/build.gradle.kts @@ -1,70 +1,57 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + plugins { `kotlin-dsl` } group = "com.murjune.practice.buildlogic" -java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 +kotlin { + compilerOptions { + jvmTarget = JvmTarget.JVM_17 + } } dependencies { - compileOnly(libs.kotlin.gradleplugin) - compileOnly(libs.agp) + compileOnly(libs.android.gradlePlugin) + compileOnly(libs.kotlin.gradlePlugin) compileOnly(libs.ksp.gradlePlugin) + compileOnly(libs.room.gradlePlugin) + compileOnly(libs.compose.gradlePlugin) } gradlePlugin { plugins { create("android-application") { - id = "com.murjune.practice.application" + id = libs.plugins.murjune.android.application.get().pluginId implementationClass = - "com.murjune.practice.plugins.AndroidApplicationPlugin" - } - create("android-library") { - id = "com.murjune.practice.library" - implementationClass = "com.murjune.practice.plugins.AndroidLibraryPlugin" + "AndroidApplicationPlugin" } create("android-feature") { - id = "com.murjune.practice.feature" - implementationClass = "com.murjune.practice.plugins.AndroidFeaturePlugin" - } - create("android-hilt") { - id = "com.murjune.practice.hilt" - implementationClass = "com.murjune.practice.plugins.AndroidHiltPlugin" + id = libs.plugins.murjune.android.feature.get().pluginId + implementationClass = "AndroidFeaturePlugin" } - create("android-test") { - id = "com.murjune.practice.android.test" - implementationClass = "com.murjune.practice.plugins.AndroidTestPlugin" - } - create("compose") { - id = "com.murjune.practice.compose" - implementationClass = "com.murjune.practice.plugins.ComposePlugin" + create("android-library") { + id = libs.plugins.murjune.android.library.get().pluginId + implementationClass = "AndroidLibraryPlugin" } - create("compose-test") { - id = "com.murjune.practice.compose.test" - implementationClass = "com.murjune.practice.plugins.ComposeTestPlugin" + create("android-compose") { + id = libs.plugins.murjune.android.compose.get().pluginId + implementationClass = "ComposePlugin" } - create("kotlin-serialization") { - id = "com.murjune.practice.kotlinx_serialization" + create("kotlinx-serialization") { + id = libs.plugins.murjune.kotlinx.serialization.get().pluginId implementationClass = - "com.murjune.practice.plugins.KotlinSerializationPlugin" + "KotlinSerializationPlugin" } - - register("kotlin-module") { - id = "com.murjune.practice.kotlin.module" - implementationClass = "com.murjune.practice.plugins.KotlinModulePlugin" - } - create("unit-test") { - id = "com.murjune.practice.unit.test" - implementationClass = "com.murjune.practice.plugins.UnitTestPlugin" + id = libs.plugins.murjune.unit.test.get().pluginId + implementationClass = "UnitTestPlugin" } register("jvm-library") { - id = "com.murjune.practice.jvm.library" - implementationClass = "com.murjune.practice.plugins.JvmLibraryPlugin" + id = libs.plugins.murjune.jvm.library.get().pluginId + implementationClass = "JvmLibraryPlugin" } } } diff --git a/build-logic/convention/src/main/kotlin/AndroidApplicationPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidApplicationPlugin.kt new file mode 100644 index 0000000..159197b --- /dev/null +++ b/build-logic/convention/src/main/kotlin/AndroidApplicationPlugin.kt @@ -0,0 +1,69 @@ +import com.android.build.api.dsl.ApplicationExtension +import com.android.build.gradle.BaseExtension +import com.murjune.practice.plugins.configureAndroidCompose +import com.murjune.practice.plugins.configureKotlinAndroid +import com.murjune.practice.plugins.libs +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.getByType + +class AndroidApplicationPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + apply(plugin = "com.android.application") + apply(plugin = "org.jetbrains.kotlin.plugin.compose") + apply(plugin = "kotlin-android") + + extensions.getByType().apply { + buildFeatures.apply { + buildConfig = true + } + } + + extensions.configure { + configureKotlinAndroid(this) + configureAndroidCompose(this) + defaultConfig.targetSdk = + libs.findVersion("targetSdk").get().requiredVersion.toInt() + defaultConfig.testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + defaultConfig.testInstrumentationRunnerArguments["runnerBuilder"] = + "de.mannodermaus.junit5.AndroidJUnit5Builder" + + packaging { + resources.excludes.apply { + add("META-INF/**") + } + } + } + + dependencies { + "implementation"(libs.findLibrary("androidx.core.ktx").get()) + "implementation"(libs.findLibrary("androidx.activity.compose").get()) + "implementation"(libs.findLibrary("androidx.navigation.compose").get()) + "implementation"(libs.findLibrary("androidx.lifecycle.runtimeCompose").get()) + "implementation"(libs.findLibrary("androidx.lifecycle.viewModelCompose").get()) + "implementation"(libs.findLibrary("kotlinx.coroutines.android").get()) + "implementation"(libs.findLibrary("kotlinx.datetime").get()) + "implementation"(libs.findLibrary("timber").get()) + + "testImplementation"(libs.findLibrary("androidx.navigation.testing").get()) + "testImplementation"(libs.findBundle("unit.test").get()) + "testRuntimeOnly"(libs.findLibrary("junit5.vintage").get()) + + "androidTestImplementation"(libs.findBundle("androidx.android.test").get()) + "androidTestImplementation"(libs.findBundle("unit.test").get()) + "androidTestImplementation"(libs.findLibrary("junit5.android.test.core").get()) + "androidTestImplementation"( + libs.findLibrary("androidx.lifecycle.runtimeTesting").get() + ) + "androidTestImplementation"(libs.findLibrary("androidx.navigation.testing").get()) + "androidTestImplementation"(libs.findLibrary("androidx.test.core").get()) + "androidTestImplementation"(libs.findLibrary("androidx.test.espresso.core").get()) + "androidTestRuntimeOnly"(libs.findLibrary("junit5.android.test.runner").get()) + } + } + } +} diff --git a/build-logic/convention/src/main/kotlin/AndroidFeaturePlugin.kt b/build-logic/convention/src/main/kotlin/AndroidFeaturePlugin.kt new file mode 100644 index 0000000..cad0475 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/AndroidFeaturePlugin.kt @@ -0,0 +1,24 @@ +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.dependencies +import com.murjune.practice.plugins.libs + +class AndroidFeaturePlugin : Plugin { + override fun apply(target: Project) { + with(target) { + apply() + apply() + + dependencies { + "implementation"(libs.findLibrary("androidx.lifecycle.runtimeCompose").get()) + "implementation"(libs.findLibrary("androidx.lifecycle.viewModelCompose").get()) + "implementation"(libs.findLibrary("androidx.navigation.compose").get()) + "testImplementation"(libs.findLibrary("androidx.navigation.testing").get()) + "androidTestImplementation"( + libs.findLibrary("androidx.lifecycle.runtimeTesting").get(), + ) + } + } + } +} diff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryPlugin.kt new file mode 100644 index 0000000..e2c1608 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/AndroidLibraryPlugin.kt @@ -0,0 +1,50 @@ +import com.android.build.gradle.BaseExtension +import com.android.build.gradle.LibraryExtension +import com.murjune.practice.plugins.configureKotlinAndroid +import com.murjune.practice.plugins.libs +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.getByType + +class AndroidLibraryPlugin : Plugin { + override fun apply(target: Project) = + with(target) { + apply(plugin = "com.android.library") + apply(plugin = "kotlin-android") + + extensions.getByType().apply { + buildFeatures.apply { + buildConfig = true + } + } + + extensions.configure { + configureKotlinAndroid(this) + defaultConfig.targetSdk = + libs.findVersion("targetSdk").get().requiredVersion.toInt() + defaultConfig.testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + defaultConfig.testInstrumentationRunnerArguments["runnerBuilder"] = + "de.mannodermaus.junit5.AndroidJUnit5Builder" + + packaging { + resources.excludes.apply { + add("META-INF/**") + } + } + } + + dependencies { + "implementation"(libs.findLibrary("kotlinx.coroutines.android").get()) + "implementation"(libs.findLibrary("kotlinx.datetime").get()) + "testImplementation"(libs.findBundle("unit.test").get()) + "testRuntimeOnly"(libs.findLibrary("junit5.vintage").get()) + "androidTestImplementation"(libs.findBundle("androidx.android.test").get()) + "androidTestImplementation"(libs.findBundle("unit.test").get()) + "androidTestImplementation"(libs.findLibrary("junit5.android.test.core").get()) + "androidTestRuntimeOnly"(libs.findLibrary("junit5.android.test.runner").get()) + } + } +} diff --git a/build-logic/convention/src/main/kotlin/ComposeLibraryPlugin.kt b/build-logic/convention/src/main/kotlin/ComposeLibraryPlugin.kt new file mode 100644 index 0000000..5349749 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/ComposeLibraryPlugin.kt @@ -0,0 +1,16 @@ +import com.android.build.gradle.LibraryExtension +import com.murjune.practice.plugins.configureAndroidCompose +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.getByType + +class ComposeLibraryPlugin : Plugin { + override fun apply(target: Project) = with(target) { + apply(plugin = "com.android.library") + apply(plugin = "org.jetbrains.kotlin.plugin.compose") + + val extension = extensions.getByType() + configureAndroidCompose(extension) + } +} diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/JvmLibraryPlugin.kt b/build-logic/convention/src/main/kotlin/JvmLibraryPlugin.kt similarity index 66% rename from build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/JvmLibraryPlugin.kt rename to build-logic/convention/src/main/kotlin/JvmLibraryPlugin.kt index be30065..cae30bc 100644 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/JvmLibraryPlugin.kt +++ b/build-logic/convention/src/main/kotlin/JvmLibraryPlugin.kt @@ -1,12 +1,7 @@ -package com.murjune.practice.plugins - -import com.murjune.practice.plugins.utils.configureKotlinJvm +import com.murjune.practice.plugins.configureKotlinJvm import org.gradle.api.Plugin import org.gradle.api.Project -/** - * 순수 JVM 라이브러리를 위한 플러그인 - * */ class JvmLibraryPlugin : Plugin { override fun apply(target: Project) { with(target) { diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/KotlinSerializationPlugin.kt b/build-logic/convention/src/main/kotlin/KotlinSerializationPlugin.kt similarity index 84% rename from build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/KotlinSerializationPlugin.kt rename to build-logic/convention/src/main/kotlin/KotlinSerializationPlugin.kt index 0165e53..d1bd140 100644 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/KotlinSerializationPlugin.kt +++ b/build-logic/convention/src/main/kotlin/KotlinSerializationPlugin.kt @@ -1,7 +1,4 @@ -package com.murjune.practice.plugins - - -import com.murjune.practice.plugins.utils.libs +import com.murjune.practice.plugins.libs import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.dependencies diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/UnitTestPlugin.kt b/build-logic/convention/src/main/kotlin/UnitTestPlugin.kt similarity index 64% rename from build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/UnitTestPlugin.kt rename to build-logic/convention/src/main/kotlin/UnitTestPlugin.kt index 2608254..c367a65 100644 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/UnitTestPlugin.kt +++ b/build-logic/convention/src/main/kotlin/UnitTestPlugin.kt @@ -1,11 +1,8 @@ -package com.murjune.practice.plugins - -import com.murjune.practice.plugins.utils.libs +import com.murjune.practice.plugins.libs import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.tasks.testing.Test import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.kotlin import org.gradle.kotlin.dsl.withType class UnitTestPlugin : Plugin { @@ -17,8 +14,7 @@ class UnitTestPlugin : Plugin { } dependencies { - add("testImplementation", kotlin("test")) - add("testImplementation", libs.findBundle("unit-test").get()) + add("testImplementation", libs.findBundle("unit.test").get()) } } } diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidApplicationPlugin.kt b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidApplicationPlugin.kt deleted file mode 100644 index c379cef..0000000 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidApplicationPlugin.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.murjune.practice.plugins - -import com.android.build.api.dsl.ApplicationExtension -import com.murjune.practice.plugins.utils.configureAndroidCommonPlugin -import com.murjune.practice.plugins.utils.configureKotlinAndroid -import com.murjune.practice.plugins.utils.libs -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.kotlin - -class AndroidApplicationPlugin : Plugin { - override fun apply(target: Project) { - with(target) { - with(pluginManager) { - apply("com.android.application") - apply("kotlin-android") - } - configureAndroidCommonPlugin() - - extensions.configure { - configureKotlinAndroid(this) - defaultConfig.targetSdk = - libs.findVersion("targetSdk").get().requiredVersion.toInt() - } - dependencies { - add("implementation", libs.findLibrary("core.ktx").get()) - add("implementation", libs.findLibrary("appcompat").get()) - add("implementation", libs.findBundle("lifecycle").get()) - add("implementation", libs.findLibrary("material").get()) - add("testImplementation", kotlin("test")) - } - } - } -} diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidFeaturePlugin.kt b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidFeaturePlugin.kt deleted file mode 100644 index 3e27922..0000000 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidFeaturePlugin.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.murjune.practice.plugins - -import com.murjune.practice.plugins.utils.libs -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.kotlin - -class AndroidFeaturePlugin : Plugin { - override fun apply(target: Project) { - with(target) { - apply() - - dependencies { - add("implementation", libs.findLibrary("core.ktx").get()) - add("implementation", libs.findLibrary("appcompat").get()) - add("implementation", libs.findBundle("lifecycle").get()) - add("implementation", libs.findLibrary("material").get()) - add("testImplementation", kotlin("test")) - } - } - } -} diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidHiltPlugin.kt b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidHiltPlugin.kt deleted file mode 100644 index 9e5232b..0000000 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidHiltPlugin.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.murjune.practice.plugins - -import com.murjune.practice.plugins.utils.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(plugins) { - apply("com.google.devtools.ksp") - apply("dagger.hilt.android.plugin") - } - - dependencies { - add("implementation", libs.findLibrary("hilt.navigation.compose").get()) - add("implementation", libs.findLibrary("hilt.android").get()) - add("ksp", libs.findLibrary("hilt.compiler").get()) - } - } -} diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidLibraryPlugin.kt b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidLibraryPlugin.kt deleted file mode 100644 index 06ce0f3..0000000 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidLibraryPlugin.kt +++ /dev/null @@ -1,26 +0,0 @@ -package com.murjune.practice.plugins - -import com.android.build.gradle.LibraryExtension -import com.murjune.practice.plugins.utils.configureAndroidCommonPlugin -import com.murjune.practice.plugins.utils.configureKotlinAndroid -import com.murjune.practice.plugins.utils.libs -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.configure - -class AndroidLibraryPlugin : Plugin { - override fun apply(target: Project) = - with(target) { - with(pluginManager) { - apply("com.android.library") - apply("kotlin-android") - } - configureAndroidCommonPlugin() - - extensions.configure { - configureKotlinAndroid(this) - defaultConfig.targetSdk = - libs.findVersion("targetSdk").get().requiredVersion.toInt() - } - } -} diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidTestPlugin.kt b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidTestPlugin.kt deleted file mode 100644 index 52e8fd9..0000000 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/AndroidTestPlugin.kt +++ /dev/null @@ -1,44 +0,0 @@ -package com.murjune.practice.plugins - -import com.android.build.gradle.BaseExtension -import com.murjune.practice.plugins.utils.libs -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.getByType - -class AndroidTestPlugin : Plugin { - override fun apply(target: Project): Unit = with(target) { - with(pluginManager) { - apply() - apply("de.mannodermaus.android-junit5") - } - - extensions.getByType().apply { - defaultConfig { - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - testInstrumentationRunnerArguments["runnerBuilder"] = - "de.mannodermaus.junit5.AndroidJUnit5Builder" - } - - testOptions { - unitTests { - isIncludeAndroidResources = true - } - } - - packagingOptions { - resources.excludes.add("META-INF/LICENSE*") - } - } - - dependencies { - add("androidTestImplementation", libs.findBundle("unit-test").get()) - add("testImplementation", libs.findLibrary("robolectric").get()) - add("androidTestImplementation", libs.findLibrary("junit5-android-test-core").get()) - add("androidTestRuntimeOnly", libs.findLibrary("junit5-android-test-runner").get()) - add("androidTestImplementation", libs.findBundle("androidx-android-test").get()) - } - } -} diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ComposeConfigs.kt b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ComposeConfigs.kt new file mode 100644 index 0000000..8546df1 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ComposeConfigs.kt @@ -0,0 +1,49 @@ +package com.murjune.practice.plugins + +import com.android.build.api.dsl.CommonExtension +import org.gradle.api.Project +import org.gradle.kotlin.dsl.assign +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.dependencies +import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension + + +/** + * Configure Compose-specific options + */ +internal fun Project.configureAndroidCompose( + commonExtension: CommonExtension<*, *, *, *, *, *>, +) { + commonExtension.apply { + buildFeatures.apply { + compose = true + } + testOptions { + animationsDisabled = true + unitTests { + // For Robolectric + isIncludeAndroidResources = true + } + } + + dependencies { + val bom = libs.findLibrary("androidx.compose.bom").get() + "implementation"(platform(bom)) + "implementation"(libs.findBundle("compose").get()) + "implementation"(libs.findLibrary("coil.kt.compose").get()) + "testImplementation"(platform(bom)) + "testImplementation"(libs.findLibrary("robolectric").get()) + "testImplementation"(libs.findLibrary("androidx.compose.ui.test.junit4").get()) + "androidTestImplementation"(platform(bom)) + "androidTestImplementation"(libs.findLibrary("androidx.compose.ui.test.junit4").get()) + "debugImplementation"(libs.findLibrary("androidx.compose.ui.tooling").get()) + "debugImplementation"(libs.findLibrary("androidx.compose.ui.test.manifest").get()) + } + } + + extensions.configure { + includeSourceInformation = true +// stabilityConfigurationFiles +// .add(isolated.rootProject.projectDirectory.file("compose_compiler_config.conf")) + } +} diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ComposePlugin.kt b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ComposePlugin.kt deleted file mode 100644 index d183b2a..0000000 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ComposePlugin.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.murjune.practice.plugins - -import com.android.build.gradle.BaseExtension -import com.murjune.practice.plugins.utils.libs -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.getByType - -class ComposePlugin : Plugin { - override fun apply(target: Project) = - with(target) { - extensions.getByType().apply { - buildFeatures.apply { - compose = true - } - composeOptions { - kotlinCompilerExtensionVersion = - libs.findVersion("composeCompiler").get().toString() - } - } - - dependencies { - add("implementation", platform(libs.findLibrary("compose.bom").get())) - add("implementation", libs.findBundle("compose").get()) - } - } -} diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ComposeTestPlugin.kt b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ComposeTestPlugin.kt deleted file mode 100644 index d073d99..0000000 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ComposeTestPlugin.kt +++ /dev/null @@ -1,46 +0,0 @@ -package com.murjune.practice.plugins - -import com.android.build.gradle.BaseExtension -import com.murjune.practice.plugins.utils.libs -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.getByType - -class ComposeTestPlugin : Plugin { - override fun apply(target: Project): Unit = with(target) { - with(pluginManager) { - apply() - apply("de.mannodermaus.android-junit5") - } - - extensions.getByType().apply { - defaultConfig { - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - testInstrumentationRunnerArguments["runnerBuilder"] = - "de.mannodermaus.junit5.AndroidJUnit5Builder" - } - - testOptions { - unitTests { - isIncludeAndroidResources = true - } - } - - packagingOptions { - resources.excludes.add("META-INF/LICENSE*") - } - } - - dependencies { - add("testImplementation", libs.findLibrary("robolectric").get()) - add("androidTestImplementation", platform(libs.findLibrary("compose.bom").get())) - add("androidTestImplementation", libs.findLibrary("junit5-android-test-core").get()) - add("androidTestRuntimeOnly", libs.findLibrary("junit5-android-test-runner").get()) - add("androidTestImplementation", libs.findBundle("compose-test").get()) - add("debugImplementation", libs.findLibrary("ui-tooling").get()) - add("debugImplementation", libs.findLibrary("ui-test-manifest").get()) - } - } -} diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/KotlinConfigs.kt b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/KotlinConfigs.kt new file mode 100644 index 0000000..ece8b7d --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/KotlinConfigs.kt @@ -0,0 +1,81 @@ +package com.murjune.practice.plugins + + +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.assign +import org.gradle.kotlin.dsl.configure +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension +import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension +import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension + +/** + * Configure base Kotlin with Android options + */ +internal fun Project.configureKotlinAndroid( + commonExtension: CommonExtension<*, *, *, *, *, *>, +) { + commonExtension.apply { + compileSdk = libs.findVersion("compileSdk").get().requiredVersion.toInt() + + defaultConfig { + minSdk = libs.findVersion("minSdk").get().requiredVersion.toInt() + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + + } + } + + configureKotlin() +} + +/** + * Configure base Kotlin options for JVM (non-Android) + */ +internal fun Project.configureKotlinJvm() { + extensions.configure { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + configureKotlin() +} + +/** + * Configure base Kotlin options + */ +private inline fun Project.configureKotlin() = configure { + when (this) { + is KotlinAndroidProjectExtension -> compilerOptions + is KotlinJvmProjectExtension -> compilerOptions + else -> TODO("Unsupported project extension $this ${T::class}") + }.apply { + jvmTarget = JvmTarget.JVM_17 + freeCompilerArgs.add( + // Enable experimental coroutines APIs, including Flow (e. debounce) + "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", + ) + freeCompilerArgs.add( + /** + * data class 의 생성자 가시성과 copy 가시성을 일치시킴 + * + * Remove this args after Phase 3. + * https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-consistent-copy-visibility/#deprecation-timeline + * + * Deprecation timeline + * Phase 3. (Supposedly Kotlin 2.2 or Kotlin 2.3). + * The default changes. + * Unless ExposedCopyVisibility is used, the generated 'copy' method has the same visibility as the primary constructor. + * The binary signature changes. The error on the declaration is no longer reported. + * '-Xconsistent-data-class-copy-visibility' compiler flag and ConsistentCopyVisibility annotation are now unnecessary. + */ + "-Xconsistent-data-class-copy-visibility", + ) + } +} + diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/KotlinModulePlugin.kt b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/KotlinModulePlugin.kt deleted file mode 100644 index 793c01d..0000000 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/KotlinModulePlugin.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.murjune.practice.plugins - -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply - -/** - * 순수 JVM + JUnit5 + Assertj - * */ -class KotlinModulePlugin : Plugin { - override fun apply(target: Project) { - with(target) { - apply() - apply() - } - - } -} diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/utils/ProjectExt.kt b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ProjectExt.kt similarity index 86% rename from build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/utils/ProjectExt.kt rename to build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ProjectExt.kt index c409f62..8fe340d 100644 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/utils/ProjectExt.kt +++ b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/ProjectExt.kt @@ -1,4 +1,4 @@ -package com.murjune.practice.plugins.utils +package com.murjune.practice.plugins import org.gradle.api.Project import org.gradle.api.artifacts.VersionCatalog diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/utils/AndroidCommonConfigs.kt b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/utils/AndroidCommonConfigs.kt deleted file mode 100644 index 5ec6a71..0000000 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/utils/AndroidCommonConfigs.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.murjune.practice.plugins.utils - -import com.android.build.gradle.BaseExtension -import com.murjune.practice.plugins.AndroidHiltPlugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.getByType - -internal fun Project.configureAndroidCommonPlugin() { - apply() - - extensions.getByType().apply { - buildFeatures.apply { - buildConfig = true - } - } - - dependencies { - add("implementation", libs.findLibrary("timber").get()) - } -} diff --git a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/utils/KotlinConfigs.kt b/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/utils/KotlinConfigs.kt deleted file mode 100644 index 8997c53..0000000 --- a/build-logic/convention/src/main/kotlin/com/murjune/practice/plugins/utils/KotlinConfigs.kt +++ /dev/null @@ -1,66 +0,0 @@ -package com.murjune.practice.plugins.utils - -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.dependencies -import org.gradle.kotlin.dsl.withType -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - -/** - * Configure base Kotlin with Android options - */ -internal fun Project.configureKotlinAndroid( - commonExtension: CommonExtension<*, *, *, *, *>, -) { - commonExtension.apply { - compileSdk = libs.findVersion("compileSdk").get().requiredVersion.toInt() - - defaultConfig { - minSdk = libs.findVersion("minSdk").get().requiredVersion.toInt() - } - - compileOptions { -// isCoreLibraryDesugaringEnabled = true - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - } - - configureKotlin() - - dependencies { - add("implementation", libs.findLibrary("kotlin").get()) - add("implementation", libs.findLibrary("kotlin.coroutines.android").get()) - } -} - -/** - * Configure base Kotlin options for JVM (non-Android) - */ -internal fun Project.configureKotlinJvm() { - extensions.configure { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - configureKotlin() - - dependencies { - add("implementation", libs.findLibrary("kotlin").get()) - add("implementation", libs.findLibrary("kotlin.coroutines.core").get()) - } -} - -/** - * Configure base Kotlin options - */ -private fun Project.configureKotlin() { - tasks.withType().configureEach { - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } - } -} diff --git a/build.gradle.kts b/build.gradle.kts index eb2bc70..9339734 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,30 +1,18 @@ -buildscript { - repositories { - google() - mavenCentral() - gradlePluginPortal() - } - - dependencies { - classpath(libs.kotlin.gradleplugin) - classpath(libs.hilt.plugin) - classpath(libs.agp) - classpath(libs.ktlint) - } -} - +// Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { alias(libs.plugins.android.application) apply false alias(libs.plugins.android.library) apply false + alias(libs.plugins.android.junit5) apply false alias(libs.plugins.kotlin.android) apply false - alias(libs.plugins.kotlin.kapt) apply false - alias(libs.plugins.dagger.hilt) apply false + alias(libs.plugins.kotlin.compose) apply false + alias(libs.plugins.kotlin.serialization) apply false alias(libs.plugins.ksp) apply false - alias(libs.plugins.kotlinx.serialization) apply false - alias(libs.plugins.junit5) apply false + alias(libs.plugins.room) apply false + alias(libs.plugins.protobuf) apply false alias(libs.plugins.ktlint) apply false + alias(libs.plugins.module.graph) apply false } -subprojects { - apply(plugin = "org.jlleitschuh.gradle.ktlint") +allprojects { + apply(plugin = rootProject.libs.plugins.ktlint.get().pluginId) } diff --git a/compose-test/build.gradle.kts b/compose-test/build.gradle.kts index 853107b..08fd7f0 100644 --- a/compose-test/build.gradle.kts +++ b/compose-test/build.gradle.kts @@ -1,17 +1,11 @@ plugins { - alias(libs.plugins.murjune.application) - alias(libs.plugins.murjune.compose) - alias(libs.plugins.murjune.compose.test) - alias(libs.plugins.kotlin.android) + alias(libs.plugins.murjune.android.application) } android { namespace = "com.murjune.pratice.compose.study" - packaging { - resources { - excludes += "META-INF/**" - excludes += "win32-x86*/**" - } + defaultConfig { + applicationId = "com.murjune.pratice.compose.study" } } \ No newline at end of file diff --git a/coroutine/build.gradle.kts b/coroutine/build.gradle.kts index 8b2113d..f134888 100644 --- a/coroutine/build.gradle.kts +++ b/coroutine/build.gradle.kts @@ -1,5 +1,6 @@ plugins { - alias(libs.plugins.murjune.kotlin.module) + alias(libs.plugins.murjune.jvm.library) + alias(libs.plugins.murjune.unit.test) } group = "com.murjune.practice.coroutine" diff --git a/design-pattern/build.gradle.kts b/design-pattern/build.gradle.kts index 1cbd70d..6197da3 100644 --- a/design-pattern/build.gradle.kts +++ b/design-pattern/build.gradle.kts @@ -1,5 +1,6 @@ plugins { - alias(libs.plugins.murjune.kotlin.module) + alias(libs.plugins.murjune.jvm.library) + alias(libs.plugins.murjune.unit.test) } group = "com.murjune.practice.design.pattern" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cd62ef3..81fdf95 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,196 +1,171 @@ [versions] -compileSdk = "34" -minSdk = "28" -targetSdk = "34" -version = "1.0-SNAPSHOT" -versionCode = "10001" - -# Android -core-ktx = "1.13.1" -fragment = "1.8.1" -appcompat = "1.7.0" -activity = "1.9.0" -lifecycle = "2.8.3" -material = "1.12.0" -startup = "1.1.1" -room = "2.6.1" -constraintlayout = "2.1.4" -flexbox = "3.0.0" -dagger-hilt = "2.50" -dagger-hilt-navigation-compose = "1.0.0" -composeCompiler = "1.5.8" -compose-bom = "2024.01.00" +compileSdk = "35" +minSdk = "26" +targetSdk = "35" +versionCode = "1" +appVersion = "1.0.0" # kotlin -kotlin = "1.9.22" -kotlinx-serialization-json = "1.6.2" -kotlinx-datetime = "0.5.0" -kotlinx-coroutines = "1.7.3" - -# test -kotest = "5.8.0" -junit = "4.13.2" -junit5-plugin = "1.10.0.0" -junit5-jupiter = "5.10.2" -assertj = "3.25.3" -mockk = "1.13.9" -mock-webserver = "4.9.1" +kotlin = "2.1.0" +kotlinxCoroutines = "1.10.1" +kotlinxDatetime = "0.6.1" +kotlinxSerialization = "1.8.0" +ksp = "2.1.0-1.0.29" -# android test -robolectric = "4.11.1" -androidx-test-espresso = "3.5.1" -android-junit5-plugin = "1.10.0.0" -android-junit5-core = "1.4.0" -androidx-test = "1.6.1" -androidx-test-junit = "1.2.1" -androidx-test-fragment = "1.8.1" -android-test-esspreso-contrib = "3.6.1" -androidx-test-espresso-core = "3.6.1" -androidx-test-core = "1.6.1" -androidx-test-runner = "1.5.0" +# android +agp = "8.7.3" +activityCompose = "1.9.3" +androidxComposeFoundation = "1.8.0-alpha07" +androidxLifecycle = "2.8.7" +androidxNavigation = "2.8.5" +androidxCoreSplashscreen = "1.0.1" +androidxDataStore = "1.1.1" +androidxEspresso = "3.6.1" +androidxTestCore = "1.6.1" +androidxTestExt = "1.2.1" +androidxTestRules = "1.6.1" +androidxTestRunner = "1.6.2" +androidxUiAutomator = "2.3.0" +coreKtx = "1.15.0" +composeBom = "2024.12.01" +room = "2.6.1" +robolectric = "4.14.1" -# gradle -agp = "8.2.1" -ksp = "1.9.22-1.0.17" +# google +protobuf = "4.29.2" +protobufPlugin = "0.9.4" -# third party -okhttp = "4.12.0" -retrofit = "2.9.0" -timber = "5.0.1" -coil = "2.5.0" -lottie = "6.0.1" -kakao = "2.14.0" -splash-screen = "1.0.1" +# third-party +coil = "2.7.0" +moduleGraph = "2.7.1" +koin = "4.0.0" ktlint = "12.1.0" -javax-inject = "1" -junitVersion = "4.13.2" -runner = "1.0.2" -espressoCore = "3.0.2" -appcompatV7 = "28.0.0" -appcompatV7Version = "28.0.0" -design = "28.0.0" -supportAnnotations = "28.0.0" -constraintLayoutVersion = "2.0.4" -livedata = "1.1.1" -viewmodel = "1.1.1" +timber = "5.0.1" -[libraries] -agp = { module = "com.android.tools.build:gradle", version.ref = "agp" } +# test +androidJunit5Plugin = "1.10.0.0" +androidJunit5Core = "1.4.0" +mockk = "1.13.9" +truth = "1.4.4" +junit4 = "4.13.2" +junit5Jupiter = "5.10.2" +kotestRunnerJunit5 = "5.8.0" +assertj = "3.25.3" +[libraries] # kotlin -kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" } -kotlin-gradleplugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } -ksp-gradlePlugin = { group = "com.google.devtools.ksp", name = "com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" } -kotlin-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" } -kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinx-datetime" } - -# coroutines -kotlin-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" } -kotlin-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } - -# android -core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" } -lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycle" } -lifecycle = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle" } -appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } -material = { group = "com.google.android.material", name = "material", version.ref = "material" } -startup = { module = "androidx.startup:startup-runtime", version.ref = "startup" } -javax-inject = { group = "javax.inject", name = "javax.inject", version.ref = "javax-inject" } +kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinxDatetime" } +kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerialization" } +kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" } +kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinxCoroutines" } +kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" } +kotlinx-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" } + +# androidx +androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" } +androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } +androidx-core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "androidxCoreSplashscreen" } +androidx-compose-animation = { group = "androidx.compose.animation", name = "animation" } +androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } +androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version.ref = "androidxComposeFoundation" } +androidx-compose-foundation-layout = { group = "androidx.compose.foundation", name = "foundation-layout" } +androidx-compose-material-iconsExtended = { group = "androidx.compose.material", name = "material-icons-extended" } +androidx-compose-runtime = { group = "androidx.compose.runtime", name = "runtime" } +androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" } +androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } +androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } +androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } +androidx-test-uiautomator = { group = "androidx.test.uiautomator", name = "uiautomator", version.ref = "androidxUiAutomator" } +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-lifecycle-runtimeCompose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidxLifecycle" } +androidx-lifecycle-runtimeTesting = { group = "androidx.lifecycle", name = "lifecycle-runtime-testing", version.ref = "androidxLifecycle" } +androidx-lifecycle-viewModelCompose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "androidxLifecycle" } +androidx-material3 = { group = "androidx.compose.material3", name = "material3" } +androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "androidxNavigation" } +androidx-navigation-testing = { group = "androidx.navigation", name = "navigation-testing", version.ref = "androidxNavigation" } +androidx-dataStore = { group = "androidx.datastore", name = "datastore", version.ref = "androidxDataStore" } +androidx-dataStore-core = { group = "androidx.datastore", name = "datastore-core", version.ref = "androidxDataStore" } +androidx-room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room" } +androidx-room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room" } +androidx-room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" } +androidx-room-testing = { group = "androidx.room", name = "room-testing", version.ref = "room" } +androidx-test-core = { group = "androidx.test", name = "core", version.ref = "androidxTestCore" } +androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidxEspresso" } +androidx-test-ext = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "androidxTestExt" } +androidx-test-rules = { group = "androidx.test", name = "rules", version.ref = "androidxTestRules" } +androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = "androidxTestRunner" } +androidx-test-truth = { module = "androidx.test.ext:truth", version.ref = "androidxTestCore" } +robolectric = { group = "org.robolectric", name = "robolectric", version.ref = "robolectric" } + +# google +protobuf-kotlin-lite = { group = "com.google.protobuf", name = "protobuf-kotlin-lite", version.ref = "protobuf" } +protobuf-protoc = { group = "com.google.protobuf", name = "protoc", version.ref = "protobuf" } + +# third-party +coil-kt = { group = "io.coil-kt", name = "coil", version.ref = "coil" } +coil-kt-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil" } +koin-bom = { group = "io.insert-koin", name = "koin-bom", version.ref = "koin" } +koin-core = { group = "io.insert-koin", name = "koin-core" } +koin-test-junit5 = { group = "io.insert-koin", name = "test-junit5" } +koin-android = { group = "io.insert-koin", name = "koin-android" } +koin-androidx-compose = { group = "io.insert-koin", name = "koin-androidx-compose" } +koin-androidx-compose-navigation = { group = "io.insert-koin", name = "koin-androidx-compose-navigation" } +koin-android-test = { group = "io.insert-koin", name = "koin-android-test" } +timber = { group = "com.jakewharton.timber", name = "timber", version.ref = "timber" } -# dagger-hilt -hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "dagger-hilt" } -hilt-compiler = { module = "com.google.dagger:hilt-compiler", name = "hilt-compiler", version.ref = "dagger-hilt" } -hilt-plugin = { group = "com.google.dagger", name = "hilt-android-gradle-plugin", version.ref = "dagger-hilt" } -hilt-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "dagger-hilt" } -hilt-testing-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "dagger-hilt" } - -# compose -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 = "activity" } -hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "dagger-hilt-navigation-compose" } -lifecycle-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycle" } -compose-lottie = { group = "com.airbnb.android", name = "lottie-compose", version.ref = "lottie" } - -# unit test -kotest-junit5-runner = { group = "io.kotest", name = "kotest-runner-junit5", version.ref = "kotest" } +# test assertj = { group = "org.assertj", name = "assertj-core", version.ref = "assertj" } -kotlin-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } -junit5 = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit5-jupiter" } mockk = { module = "io.mockk:mockk", version.ref = "mockk" } -mockk-webserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" } - -# android test -androidx-test-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-test-junit" } -androidx-test-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-test-espresso" } -androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test-core" } -androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test-core" } -androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = "androidx-test" } -androidx-test-junit-ktx = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "androidx-test-junit" } -## android-junit5 -junit5-android-test-core = { module = "de.mannodermaus.junit5:android-test-core", version = "1.3.0" } -junit5-android-test-runner = { module = "de.mannodermaus.junit5:android-test-runner", version = "1.3.0" } -## robolectric -robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" } - -# third party -ktlint = { module = "org.jlleitschuh.gradle:ktlint-gradle", version.ref = "ktlint" } -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 = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } +junit5 = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit5Jupiter" } +junit5-android-test-core = { module = "de.mannodermaus.junit5:android-test-core", version.ref = "androidJunit5Core" } +junit5-android-test-runner = { module = "de.mannodermaus.junit5:android-test-runner", version.ref = "androidJunit5Core" } +junit5-vintage = { module = "org.junit.vintage:junit-vintage-engine", version.ref = "junit5Jupiter" } +kotest-runner-junit5 = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotestRunnerJunit5" } + +# Dependencies of the included build-logic +android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "agp" } +compose-gradlePlugin = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin" } +kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } +ksp-gradlePlugin = { group = "com.google.devtools.ksp", name = "com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" } +room-gradlePlugin = { group = "androidx.room", name = "room-gradle-plugin", version.ref = "room" } -timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } -coil-core = { module = "io.coil-kt:coil", version.ref = "coil" } -splash-screen = { module = "androidx.core:core-splashscreen", version.ref = "splash-screen" } -appcompat-v7 = { group = "com.android.support", name = "appcompat-v7", version.ref = "appcompatV7Version" } -design = { group = "com.android.support", name = "design", version.ref = "design" } -support-annotations = { group = "com.android.support", name = "support-annotations", version.ref = "supportAnnotations" } -constraint-layout = { group = "com.android.support.constraint", name = "constraint-layout", version.ref = "constraintLayoutVersion" } -livedata = { group = "android.arch.lifecycle", name = "livedata", version.ref = "livedata" } -viewmodel = { group = "android.arch.lifecycle", name = "viewmodel", version.ref = "viewmodel" } +[bundles] +compose = [ + "androidx-compose-animation", + "androidx-compose-foundation", + "androidx-compose-foundation-layout", + "androidx-compose-runtime", + "androidx-compose-ui", + "androidx-compose-ui-graphics", + "androidx-compose-ui-tooling-preview", + "androidx-compose-material-iconsExtended", + "androidx-material3", +] +unit-test = ["kotlinx-test", "kotlinx-coroutines-test", "junit5", "kotest-runner-junit5", "mockk"] +androidx-android-test = ["androidx-test-ext", "androidx-test-runner", "androidx-test-rules"] [plugins] -# android android-application = { id = "com.android.application", version.ref = "agp" } android-library = { id = "com.android.library", version.ref = "agp" } +android-junit5 = { id = "de.mannodermaus.android-junit5", version.ref = "androidJunit5Plugin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } -kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } -dagger-hilt = { id = "com.google.dagger.hilt.android", version.ref = "dagger-hilt" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +room = { id = "androidx.room", version.ref = "room" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } - -# jvm -kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } -junit5 = { id = "de.mannodermaus.android-junit5", version.ref = "junit5-plugin" } +module-graph = { id = "com.jraska.module.graph.assertion", version.ref = "moduleGraph" } +protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" } ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" } +kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } # Plugins defined by murjune -murjune-junit5 = { id = "com.murjune.practice.junit5", version = "unspecified" } -murjune-jvm-library = { id = "com.murjune.practice.jvm.library", version = "unspecified" } -murjune-kotlin-serialization = { id = "com.murjune.practice.kotlinx_serialization", version = "unspecified" } -murjune-kotlin-module = { id = "com.murjune.practice.kotlin.module", version = "unspecified" } +murjune-jvm-library = { id = "com.murjune.practice.jvm.library" } +murjune-kotlinx-serialization = { id = "com.murjune.practice.kotlinx_serialization" } # Plugins defined by Android -murjune-application = { id = "com.murjune.practice.application", version = "unspecified" } -murjune-android-library = { id = "com.murjune.practice.library", version = "unspecified" } -murjune-feature = { id = "com.murjune.practice.feature", version = "unspecified" } -murjune-hilt = { id = "com.murjune.practice.hilt", version = "unspecified" } -murjune-android-test = { id = "com.murjune.practice.android.test", version = "unspecified" } -murjune-unit-test = { id = "com.murjune.practice.unit.test", version = "unspecified" } -murjune-compose = { id = "com.murjune.practice.compose", version = "unspecified" } -murjune-compose-test = { id = "com.murjune.practice.compose.test", version = "unspecified" } -[bundles] -unit-test = ["junit5", "kotest-junit5-runner", "assertj", "mockk", "mockk-webserver", "kotlin-coroutines-test"] -lifecycle = ["lifecycle", "lifecycle-viewmodel"] -compose = ["ui", "ui-graphics", "ui-tooling", "ui-tooling-preview", "material3-compose", "coil-compose", "ui-foundation", "activity-compose", "lifecycle-compose"] -retrofit = ["retrofit"] -androidx-android-test = ["androidx-test-core", "androidx-test-espresso", "androidx-test-junit", "androidx-test-junit-ktx", "androidx-test-rules", "androidx-test-runner"] -compose-test = ["androidx-test-espresso", "androidx-test-junit-ktx", "androidx-test-junit", "ui-test-junit4"] \ No newline at end of file +murjune-android-application = { id = "com.murjune.practice.application" } +murjune-android-compose = { id = "com.murjune.practice.compose" } +murjune-android-feature = { id = "com.murjune.practice.feature" } +murjune-android-library = { id = "com.murjune.practice.library" } +murjune-unit-test = { id = "com.murjune.practice.unit.test" } diff --git a/kotlin-practice/build.gradle.kts b/kotlin-practice/build.gradle.kts index 2a3fea2..ff372e0 100644 --- a/kotlin-practice/build.gradle.kts +++ b/kotlin-practice/build.gradle.kts @@ -1,5 +1,6 @@ plugins { - alias(libs.plugins.murjune.kotlin.module) + alias(libs.plugins.murjune.jvm.library) + alias(libs.plugins.murjune.unit.test) } group = "com.murjune.practice.kotlin.practice" diff --git a/settings.gradle.kts b/settings.gradle.kts index 4c98f7b..9979b1f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,16 +1,19 @@ +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + pluginManagement { includeBuild("build-logic") repositories { - google() + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } mavenCentral() gradlePluginPortal() } } - -plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" -} - dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories {