-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] refactor build-logic, init network module (#21)
* [build] kotlin-Serialization id 수정 * [init] network 모듈 * [build] hilt : migrate from kapt to ksp * [build] kotlin config * [build] testing 모듈에 JVM 플러그인 적용 * [build] ksp, hilt verson up * [build] Build-logic refactoring
- Loading branch information
Showing
17 changed files
with
224 additions
and
123 deletions.
There are no files selected for viewing
This file contains 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
28 changes: 26 additions & 2 deletions
28
build-logic/convention/src/main/kotlin/com/moya/funch/plugins/AndroidApplicationPlugin.kt
This file contains 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 |
---|---|---|
@@ -1,12 +1,36 @@ | ||
package com.moya.funch.plugins | ||
|
||
import com.android.build.api.dsl.ApplicationExtension | ||
import com.moya.funch.plugins.utils.configureAndroidCommonPlugin | ||
import com.moya.funch.plugins.utils.configureKotlinAndroid | ||
import com.moya.funch.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<Project> { | ||
override fun apply(target: Project) = | ||
override fun apply(target: Project) { | ||
with(target) { | ||
plugins.apply("com.android.application") | ||
with(pluginManager) { | ||
apply("com.android.application") | ||
apply("kotlin-android") | ||
} | ||
configureAndroidCommonPlugin() | ||
|
||
extensions.configure<ApplicationExtension> { | ||
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")) | ||
} | ||
} | ||
} | ||
} |
19 changes: 16 additions & 3 deletions
19
build-logic/convention/src/main/kotlin/com/moya/funch/plugins/AndroidFeaturePlugin.kt
This file contains 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 |
---|---|---|
@@ -1,12 +1,25 @@ | ||
package com.moya.funch.plugins | ||
|
||
import com.moya.funch.plugins.utils.configureAndroidCommonPlugin | ||
import com.moya.funch.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<Project> { | ||
override fun apply(target: Project) = | ||
override fun apply(target: Project) { | ||
with(target) { | ||
plugins.apply("com.android.library") | ||
configureAndroidCommonPlugin() | ||
apply<AndroidLibraryPlugin>() | ||
|
||
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")) | ||
} | ||
} | ||
} | ||
} |
This file contains 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
46 changes: 0 additions & 46 deletions
46
build-logic/convention/src/main/kotlin/com/moya/funch/plugins/AndroidKotlinPlugin.kt
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
build-logic/convention/src/main/kotlin/com/moya/funch/plugins/AndroidLibraryPlugin.kt
This file contains 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,31 @@ | ||
package com.moya.funch.plugins | ||
|
||
import com.android.build.gradle.LibraryExtension | ||
import com.moya.funch.plugins.utils.configureAndroidCommonPlugin | ||
import com.moya.funch.plugins.utils.configureKotlinAndroid | ||
import com.moya.funch.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 AndroidLibraryPlugin : Plugin<Project> { | ||
override fun apply(target: Project) = | ||
with(target) { | ||
with(pluginManager) { | ||
apply("com.android.library") | ||
apply("kotlin-android") | ||
} | ||
configureAndroidCommonPlugin() | ||
|
||
extensions.configure<LibraryExtension> { | ||
configureKotlinAndroid(this) | ||
defaultConfig.targetSdk = libs.findVersion("targetSdk").get().requiredVersion.toInt() | ||
} | ||
|
||
dependencies { | ||
add("testImplementation", kotlin("test")) | ||
} | ||
} | ||
} |
47 changes: 0 additions & 47 deletions
47
build-logic/convention/src/main/kotlin/com/moya/funch/plugins/CommonConfigs.kt
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
build-logic/convention/src/main/kotlin/com/moya/funch/plugins/JvmLibraryPlugin.kt
This file contains 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,19 @@ | ||
package com.moya.funch.plugins | ||
|
||
import com.moya.funch.plugins.utils.configureKotlinJvm | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
|
||
/** | ||
* 순수 JVM 라이브러리를 위한 플러그인 ex) domain | ||
* */ | ||
class JvmLibraryPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
with(pluginManager) { | ||
apply("org.jetbrains.kotlin.jvm") | ||
} | ||
configureKotlinJvm() | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
build-logic/convention/src/main/kotlin/com/moya/funch/plugins/utils/AndroidCommonConfigs.kt
This file contains 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,22 @@ | ||
package com.moya.funch.plugins.utils | ||
|
||
import com.android.build.gradle.BaseExtension | ||
import com.moya.funch.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<AndroidHiltPlugin>() | ||
|
||
extensions.getByType<BaseExtension>().apply { | ||
buildFeatures.apply { | ||
buildConfig = true | ||
} | ||
} | ||
|
||
dependencies { | ||
add("implementation", libs.findLibrary("timber").get()) | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
build-logic/convention/src/main/kotlin/com/moya/funch/plugins/utils/KotlinConfigs.kt
This file contains 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,67 @@ | ||
package com.moya.funch.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("coreLibraryDesugaring", libs.findLibrary("desugarLibs").get()) | ||
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<JavaPluginExtension> { | ||
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<KotlinCompile>().configureEach { | ||
kotlinOptions { | ||
jvmTarget = JavaVersion.VERSION_17.toString() | ||
} | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -1,14 +1,9 @@ | ||
plugins { | ||
alias(libs.plugins.android.library) | ||
alias(libs.plugins.funch.android.kotlin) | ||
alias(libs.plugins.funch.android.library) | ||
alias(libs.plugins.funch.compose) | ||
} | ||
|
||
android { | ||
namespace = "com.moya.funch.designsystem" | ||
} | ||
|
||
dependencies { | ||
implementation(libs.timber) | ||
} | ||
|
This file contains 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 @@ | ||
/build |
Oops, something went wrong.