-
Notifications
You must be signed in to change notification settings - Fork 0
build-logic 추가 #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
build-logic 추가 #39
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d67d590
feat: build-logic 컨벤션 플러그인 모듈 추가
chanho0908 1fe1a81
refactor: build-logic primitive 플러그인 구조 추가
chanho0908 14c3295
fix: ComposeExtension 오류 및 deprecated 경고 수정
chanho0908 3682307
fix: Compose deprecated API 제거
chanho0908 5c5d553
refactor: DroidMorningFeaturePlugin 개선 및 JVM 버전 통일
chanho0908 7ac471f
refactor: build-logic 패키지 구조 개선 및 확장 함수 정리
chanho0908 fcd8b93
docs: build-logic의 README.md 삭제
chanho0908 fc5f68c
refactor: build-logic 구조 개선 및 리팩토링
chanho0908 92e0444
refactor: KMP 플러그인/자바 타겟 설정 정리
chanho0908 cfced08
fix: compose debugImplementation 구성 가드 추가
chanho0908 2cf2dfb
chore: compose compiler 플러그인 정의 정리
chanho0908 24764a3
chore: 주석제거
chanho0908 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
|
||
| plugins { | ||
| `kotlin-dsl` | ||
| } | ||
|
|
||
| group = "com.peto.droidmorning.buildlogic" | ||
|
|
||
| val javaVersion = JavaVersion.toVersion(libs.versions.java.get()) | ||
|
|
||
| java { | ||
| sourceCompatibility = javaVersion | ||
| targetCompatibility = javaVersion | ||
| } | ||
|
|
||
| kotlin { | ||
| compilerOptions { | ||
| jvmTarget = JvmTarget.fromTarget(libs.versions.java.get()) | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| compileOnly(libs.android.gradle.plugin) | ||
| compileOnly(libs.kotlin.gradle.plugin) | ||
| compileOnly(libs.compose.gradle.plugin) | ||
| } | ||
|
|
||
| gradlePlugin { | ||
| plugins { | ||
| register("kmpPrimitive") { | ||
| id = "droidmorning.kmp" | ||
| implementationClass = "com.peto.droidmorning.KotlinMultiPlatformPlugin" | ||
| } | ||
| register("kmpAndroid") { | ||
| id = "droidmorning.kmp.android" | ||
| implementationClass = "com.peto.droidmorning.KotlinMultiPlatformAndroidPlugin" | ||
| } | ||
| register("kmpIos") { | ||
| id = "droidmorning.kmp.ios" | ||
| implementationClass = "com.peto.droidmorning.KotlinMultiPlatformiOSPlugin" | ||
| } | ||
| register("androidLibrary") { | ||
| id = "droidmorning.android.library" | ||
| implementationClass = "com.peto.droidmorning.AndroidLibraryConventionPlugin" | ||
| } | ||
| register("kotlinMultiplatform") { | ||
| id = "droidmorning.kotlin.multiplatform" | ||
| implementationClass = "com.peto.droidmorning.KotlinMultiplatformConventionPlugin" | ||
| } | ||
| register("composeMultiplatform") { | ||
| id = "droidmorning.compose.multiplatform" | ||
| implementationClass = "com.peto.droidmorning.ComposeMultiplatformConventionPlugin" | ||
| } | ||
| register("droidmorningFeature") { | ||
| id = "droidmorning.feature" | ||
| implementationClass = "com.peto.droidmorning.DroidMorningFeaturePlugin" | ||
| } | ||
| } | ||
| } |
37 changes: 37 additions & 0 deletions
37
...-logic/convention/src/main/kotlin/com/peto/droidmorning/AndroidLibraryConventionPlugin.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package com.peto.droidmorning | ||
|
|
||
| import com.android.build.gradle.LibraryExtension | ||
| import com.peto.droidmorning.extentions.javaVersion | ||
| import com.peto.droidmorning.extentions.libs | ||
| import com.peto.droidmorning.extentions.plugin | ||
| import com.peto.droidmorning.extentions.version | ||
| import org.gradle.api.Plugin | ||
| import org.gradle.api.Project | ||
| import org.gradle.kotlin.dsl.configure | ||
|
|
||
| class AndroidLibraryConventionPlugin : Plugin<Project> { | ||
| override fun apply(target: Project) { | ||
| with(target) { | ||
| with(pluginManager) { | ||
| apply(libs.plugin("android-library").pluginId) | ||
| } | ||
|
|
||
| extensions.configure<LibraryExtension> { | ||
| compileSdk = libs.version("compileSdk").toInt() | ||
|
|
||
| defaultConfig { | ||
| minSdk = libs.version("minSdk").toInt() | ||
| } | ||
|
|
||
| compileOptions { | ||
| sourceCompatibility = libs.javaVersion("java") | ||
| targetCompatibility = libs.javaVersion("java") | ||
| } | ||
|
|
||
| buildFeatures { | ||
| buildConfig = true | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
.../convention/src/main/kotlin/com/peto/droidmorning/ComposeMultiplatformConventionPlugin.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package com.peto.droidmorning | ||
|
|
||
| import com.peto.droidmorning.extentions.composeMultiplatformDependencies | ||
| import com.peto.droidmorning.extentions.libs | ||
| import com.peto.droidmorning.extentions.plugin | ||
| import org.gradle.api.Plugin | ||
| import org.gradle.api.Project | ||
|
|
||
| class ComposeMultiplatformConventionPlugin : Plugin<Project> { | ||
| override fun apply(target: Project) = with(target) { | ||
| with(pluginManager) { | ||
| apply(libs.plugin("compose-multiplatform").pluginId) | ||
| apply(libs.plugin("kotlin-compose").pluginId) | ||
| } | ||
|
|
||
| composeMultiplatformDependencies() | ||
| } | ||
| } |
53 changes: 53 additions & 0 deletions
53
build-logic/convention/src/main/kotlin/com/peto/droidmorning/DroidMorningFeaturePlugin.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| package com.peto.droidmorning | ||
|
|
||
| import com.peto.droidmorning.extentions.bundle | ||
| import com.peto.droidmorning.extentions.composeMultiplatformDependencies | ||
| import com.peto.droidmorning.extentions.library | ||
| import com.peto.droidmorning.extentions.libs | ||
| import com.peto.droidmorning.extentions.plugin | ||
| import org.gradle.api.Plugin | ||
| import org.gradle.api.Project | ||
| import org.gradle.kotlin.dsl.apply | ||
| import org.gradle.kotlin.dsl.configure | ||
| import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
|
|
||
| class DroidMorningFeaturePlugin : Plugin<Project> { | ||
| override fun apply(target: Project) = with(target) { | ||
| with(pluginManager) { | ||
| apply(libs.plugin("android-library").pluginId) | ||
| apply(libs.plugin("kotlin-serialization").pluginId) | ||
| } | ||
|
|
||
| apply<KotlinMultiPlatformPlugin>() | ||
| apply<KotlinMultiPlatformAndroidPlugin>() | ||
| apply<KotlinMultiPlatformiOSPlugin>() | ||
|
|
||
| apply<ComposeMultiplatformConventionPlugin>() | ||
|
|
||
| extensions.configure<KotlinMultiplatformExtension> { | ||
| sourceSets.apply { | ||
| commonMain { | ||
| dependencies { | ||
| implementation(libs.library("androidx-navigation-compose")) | ||
| implementation(libs.library("androidx-lifecycle-viewmodel-compose")) | ||
| implementation(libs.library("androidx-lifecycle-runtime-compose")) | ||
|
|
||
| implementation(libs.bundle("koin")) | ||
|
|
||
| implementation(libs.library("kotlinx-coroutines-core")) | ||
| implementation(libs.library("kotlinx-serialization-json")) | ||
| implementation(libs.library("kotlinx-collections-immutable")) | ||
| implementation(libs.library("napier")) | ||
| } | ||
| } | ||
| commonTest { | ||
| dependencies { | ||
| implementation(libs.library("kotlin-test")) | ||
| implementation(libs.library("koin-test")) | ||
| implementation(libs.library("kotlinx-coroutines-test")) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
53 changes: 53 additions & 0 deletions
53
...ogic/convention/src/main/kotlin/com/peto/droidmorning/KotlinMultiPlatformAndroidPlugin.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| package com.peto.droidmorning | ||
|
|
||
| import com.peto.droidmorning.extentions.androidExtension | ||
| import com.peto.droidmorning.extentions.javaVersion | ||
| import com.peto.droidmorning.extentions.jvmTarget | ||
| import com.peto.droidmorning.extentions.libs | ||
| import com.peto.droidmorning.extentions.version | ||
| import org.gradle.api.Plugin | ||
| import org.gradle.api.Project | ||
| import org.gradle.kotlin.dsl.configure | ||
| import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
|
|
||
| class KotlinMultiPlatformAndroidPlugin : Plugin<Project> { | ||
| override fun apply(target: Project): Unit = with(target) { | ||
| androidExtension.apply { | ||
| compileSdk = libs.version("compileSdk").toInt() | ||
|
|
||
| extensions.configure<KotlinMultiplatformExtension> { | ||
| androidTarget { | ||
| compilerOptions.jvmTarget.set(libs.jvmTarget("java")) | ||
| } | ||
| } | ||
|
|
||
| defaultConfig { | ||
| minSdk = libs.version("minSdk").toInt() | ||
| } | ||
|
|
||
| compileOptions { | ||
| sourceCompatibility = libs.javaVersion("java") | ||
| targetCompatibility = libs.javaVersion("java") | ||
| } | ||
|
|
||
| packaging { | ||
| resources { | ||
| excludes += "/META-INF/{AL2.0,LGPL2.1}" | ||
| } | ||
| } | ||
|
|
||
| sourceSets { | ||
| getByName("main") { | ||
| assets.srcDirs("src/androidMain/assets") | ||
| java.srcDirs("src/androidMain/kotlin") | ||
| res.srcDirs("src/androidMain/res") | ||
| } | ||
| getByName("test") { | ||
| assets.srcDirs("src/androidUnitTest/assets") | ||
| java.srcDirs("src/androidUnitTest/kotlin") | ||
| res.srcDirs("src/androidUnitTest/res") | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
33 changes: 33 additions & 0 deletions
33
build-logic/convention/src/main/kotlin/com/peto/droidmorning/KotlinMultiPlatformPlugin.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package com.peto.droidmorning | ||
|
|
||
| import com.peto.droidmorning.extentions.jvmTarget | ||
| import com.peto.droidmorning.extentions.libs | ||
| import org.gradle.api.Plugin | ||
| import org.gradle.api.Project | ||
| import org.gradle.kotlin.dsl.configure | ||
| import org.gradle.kotlin.dsl.withType | ||
| import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
| import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
| import org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink | ||
|
|
||
| class KotlinMultiPlatformPlugin : Plugin<Project> { | ||
| override fun apply(target: Project) = with(target) { | ||
| extensions.configure<KotlinMultiplatformExtension> { | ||
| compilerOptions { | ||
| freeCompilerArgs.add("-Xexpect-actual-classes") | ||
| } | ||
|
|
||
| applyDefaultHierarchyTemplate() | ||
| } | ||
|
|
||
| tasks.withType<KotlinCompile>().configureEach { | ||
| compilerOptions { | ||
| jvmTarget.set(libs.jvmTarget("java")) | ||
| } | ||
| } | ||
|
|
||
| tasks.withType<KotlinNativeLink>().configureEach { | ||
| notCompatibleWithConfigurationCache("Configuration cache not supported for a system property read at configuration time") | ||
| } | ||
| } | ||
| } |
29 changes: 29 additions & 0 deletions
29
build-logic/convention/src/main/kotlin/com/peto/droidmorning/KotlinMultiPlatformiOSPlugin.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package com.peto.droidmorning | ||
|
|
||
| import org.gradle.api.Plugin | ||
| import org.gradle.api.Project | ||
| import org.gradle.kotlin.dsl.configure | ||
| import org.gradle.kotlin.dsl.get | ||
| import org.gradle.kotlin.dsl.withType | ||
| import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
| import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget | ||
|
|
||
| class KotlinMultiPlatformiOSPlugin : Plugin<Project> { | ||
| override fun apply(target: Project) = with(target) { | ||
| extensions.configure<KotlinMultiplatformExtension> { | ||
| iosArm64() | ||
| iosX64() | ||
| iosSimulatorArm64() | ||
|
|
||
| targets.withType<KotlinNativeTarget> { | ||
| compilations["main"].compilerOptions.configure { | ||
| freeCompilerArgs.add("-Xexport-kdoc") | ||
| } | ||
| binaries.framework { | ||
| baseName = project.name | ||
| isStatic = true | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
17 changes: 17 additions & 0 deletions
17
...c/convention/src/main/kotlin/com/peto/droidmorning/KotlinMultiplatformConventionPlugin.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package com.peto.droidmorning | ||
|
|
||
| import org.gradle.api.Plugin | ||
| import org.gradle.api.Project | ||
| import org.gradle.kotlin.dsl.apply | ||
|
|
||
| class KotlinMultiplatformConventionPlugin : Plugin<Project> { | ||
| override fun apply(target: Project) = with(target) { | ||
| with(pluginManager) { | ||
| apply("org.jetbrains.kotlin.multiplatform") | ||
| } | ||
|
|
||
| apply<KotlinMultiPlatformPlugin>() | ||
| apply<KotlinMultiPlatformAndroidPlugin>() | ||
| apply<KotlinMultiPlatformiOSPlugin>() | ||
| } | ||
| } |
35 changes: 35 additions & 0 deletions
35
build-logic/convention/src/main/kotlin/com/peto/droidmorning/extentions/ProjectExtensions.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| package com.peto.droidmorning.extentions | ||
|
|
||
| import com.android.build.api.dsl.ApplicationExtension | ||
| import com.android.build.api.dsl.CommonExtension | ||
| import com.android.build.api.dsl.LibraryExtension | ||
| import org.gradle.api.Project | ||
| import org.gradle.api.artifacts.VersionCatalog | ||
| import org.gradle.api.artifacts.VersionCatalogsExtension | ||
| import org.gradle.kotlin.dsl.configure | ||
| import org.gradle.kotlin.dsl.getByType | ||
| import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
|
|
||
| internal val Project.libs: VersionCatalog | ||
| get() = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
|
|
||
| internal val Project.androidExtension: CommonExtension<*, *, *, *, *, *> | ||
| get() = extensions.findByType(LibraryExtension::class.java) | ||
| ?: extensions.findByType(ApplicationExtension::class.java) | ||
| ?: error("Could not find Library or Application extension from this project") | ||
|
|
||
| internal fun Project.composeMultiplatformDependencies() { | ||
| extensions.configure<KotlinMultiplatformExtension> { | ||
| sourceSets.apply { | ||
| commonMain { | ||
| dependencies { | ||
| implementation(libs.bundle("compose-multiplatform")) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| configurations.findByName("debugImplementation")?.let { cfg -> | ||
| dependencies.add(cfg.name, libs.library("compose-ui-tooling")) | ||
| } | ||
| } | ||
32 changes: 32 additions & 0 deletions
32
...c/convention/src/main/kotlin/com/peto/droidmorning/extentions/VersionCatalogExtensions.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package com.peto.droidmorning.extentions | ||
|
|
||
| import org.gradle.api.JavaVersion | ||
| import org.gradle.api.artifacts.ExternalModuleDependencyBundle | ||
| import org.gradle.api.artifacts.MinimalExternalModuleDependency | ||
| import org.gradle.api.artifacts.VersionCatalog | ||
| import org.gradle.plugin.use.PluginDependency | ||
| import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
|
||
| internal fun VersionCatalog.version(name: String): String { | ||
| return findVersion(name).get().requiredVersion | ||
| } | ||
|
|
||
| internal fun VersionCatalog.library(name: String): MinimalExternalModuleDependency { | ||
| return findLibrary(name).get().get() | ||
| } | ||
|
|
||
| internal fun VersionCatalog.plugin(name: String): PluginDependency { | ||
| return findPlugin(name).get().get() | ||
| } | ||
|
|
||
| internal fun VersionCatalog.bundle(name: String): ExternalModuleDependencyBundle { | ||
| return findBundle(name).get().get() | ||
| } | ||
|
|
||
| internal fun VersionCatalog.javaVersion(name: String): JavaVersion { | ||
| return JavaVersion.toVersion(version(name)) | ||
| } | ||
|
|
||
| internal fun VersionCatalog.jvmTarget(name: String): JvmTarget { | ||
| return JvmTarget.fromTarget(version(name)) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| dependencyResolutionManagement { | ||
| repositories { | ||
| google() | ||
| mavenCentral() | ||
| gradlePluginPortal() | ||
| } | ||
| versionCatalogs { | ||
| create("libs") { | ||
| from(files("../gradle/libs.versions.toml")) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| rootProject.name = "build-logic" | ||
|
|
||
| include(":convention") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.