-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
643 additions
and
41 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
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,51 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
group = "com.boostcamp.mapisode.convention" | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
dependencies { | ||
compileOnly(libs.android.gradlePlugin) | ||
compileOnly(libs.kotlin.gradlePlugin) | ||
compileOnly(libs.compose.compiler.gradlePlugin) | ||
compileOnly(libs.ksp.gradlePlugin) | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
register("androidApplication") { | ||
id = "mapisode.android.application" | ||
implementationClass = "AndroidApplicationPlugin" | ||
} | ||
|
||
register("androidLibrary") { | ||
id = "mapisode.android.library" | ||
implementationClass = "AndroidLibraryPlugin" | ||
} | ||
|
||
register("androidCompose") { | ||
id = "mapisode.android.compose" | ||
implementationClass = "AndroidComposePlugin" | ||
} | ||
|
||
register("androidHilt") { | ||
id = "mapisode.android.hilt" | ||
implementationClass = "HiltPlugin" | ||
} | ||
|
||
register("feature") { | ||
id = "mapisode.feature" | ||
implementationClass = "MapisodeFeaturePlugin" | ||
} | ||
|
||
register("data") { | ||
id = "mapisode.data" | ||
implementationClass = "MapisodeDataPlugin" | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...ic/convention/src/main/java/com/boostcamp/mapisode/convention/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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.boostcamp.mapisode.convention | ||
|
||
import com.android.build.api.dsl.ApplicationExtension | ||
import com.boostcamp.mapisode.convention.extension.configureComposeAndroid | ||
import com.boostcamp.mapisode.convention.extension.configureKotlinAndroid | ||
import com.boostcamp.mapisode.convention.extension.getLibrary | ||
import com.boostcamp.mapisode.convention.extension.getVersion | ||
import com.boostcamp.mapisode.convention.extension.implementation | ||
import com.boostcamp.mapisode.convention.extension.libs | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
class AndroidApplicationPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
pluginManager.apply("com.android.application") | ||
|
||
extensions.configure<ApplicationExtension> { | ||
configureKotlinAndroid(this) | ||
configureComposeAndroid(this) | ||
|
||
with(defaultConfig) { | ||
targetSdk = libs.getVersion("targetSdk").requiredVersion.toInt() | ||
versionCode = libs.getVersion("versionCode").requiredVersion.toInt() | ||
versionName = libs.getVersion("versionName").requiredVersion | ||
} | ||
|
||
dependencies { | ||
implementation(libs.getLibrary("timber")) | ||
} | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...-logic/convention/src/main/java/com/boostcamp/mapisode/convention/AndroidComposePlugin.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.boostcamp.mapisode.convention | ||
|
||
import com.android.build.gradle.LibraryExtension | ||
import com.boostcamp.mapisode.convention.extension.configureComposeAndroid | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.configure | ||
|
||
class AndroidComposePlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
pluginManager.apply("mapisode.android.compose") | ||
|
||
extensions.configure<LibraryExtension> { | ||
configureComposeAndroid(this) | ||
} | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...-logic/convention/src/main/java/com/boostcamp/mapisode/convention/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,29 @@ | ||
package com.boostcamp.mapisode.convention | ||
|
||
import com.android.build.gradle.LibraryExtension | ||
import com.boostcamp.mapisode.convention.extension.configureKotlinAndroid | ||
import com.boostcamp.mapisode.convention.extension.configureKotlinCoroutine | ||
import com.boostcamp.mapisode.convention.extension.getLibrary | ||
import com.boostcamp.mapisode.convention.extension.implementation | ||
import com.boostcamp.mapisode.convention.extension.libs | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.configure | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
class AndroidLibraryPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
pluginManager.apply("com.android.library") | ||
|
||
extensions.configure<LibraryExtension> { | ||
configureKotlinAndroid(this) | ||
configureKotlinCoroutine(this) | ||
} | ||
|
||
dependencies { | ||
implementation(libs.getLibrary("timber")) | ||
} | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
build-logic/convention/src/main/java/com/boostcamp/mapisode/convention/HiltPlugin.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,25 @@ | ||
package com.boostcamp.mapisode.convention | ||
|
||
import com.boostcamp.mapisode.convention.extension.getLibrary | ||
import com.boostcamp.mapisode.convention.extension.implementation | ||
import com.boostcamp.mapisode.convention.extension.ksp | ||
import com.boostcamp.mapisode.convention.extension.libs | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
class HiltPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
pluginManager.apply { | ||
apply("dagger.hilt.android.plugin") | ||
apply("com.google.devtools.ksp") | ||
} | ||
|
||
dependencies { | ||
implementation(libs.getLibrary("hilt-android")) | ||
ksp(libs.getLibrary("hilt-android-compiler")) | ||
} | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
build-logic/convention/src/main/java/com/boostcamp/mapisode/convention/MapisodeDataPlugin.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,30 @@ | ||
package com.boostcamp.mapisode.convention | ||
|
||
import com.boostcamp.mapisode.convention.extension.getBundle | ||
import com.boostcamp.mapisode.convention.extension.getLibrary | ||
import com.boostcamp.mapisode.convention.extension.implementation | ||
import com.boostcamp.mapisode.convention.extension.libs | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
class MapisodeDataPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
pluginManager.apply { | ||
apply("mapisode.android.library") | ||
apply("mapisode.android.hilt") | ||
apply("org.jetbrains.kotlin.plugin.serialization") | ||
} | ||
|
||
dependencies { | ||
val retrofitBom = libs.getLibrary("retrofit-bom") | ||
implementation(platform(retrofitBom)) | ||
implementation(project(":core:model")) | ||
implementation(project(":core:network")) | ||
implementation(libs.getLibrary("kotlinx-serialization")) | ||
implementation(libs.getBundle("retrofit")) | ||
} | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...logic/convention/src/main/java/com/boostcamp/mapisode/convention/MapisodeFeaturePlugin.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,26 @@ | ||
package com.boostcamp.mapisode.convention | ||
|
||
import com.boostcamp.mapisode.convention.extension.getBundle | ||
import com.boostcamp.mapisode.convention.extension.implementation | ||
import com.boostcamp.mapisode.convention.extension.libs | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
class MapisodeFeaturePlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
pluginManager.apply { | ||
apply("mapisode.android.library") | ||
apply("mapisode.android.compose") | ||
} | ||
|
||
dependencies { | ||
implementation(project(":core:ui")) | ||
implementation(project(":core:designsystem")) | ||
implementation(project(":core:model")) | ||
implementation(libs.getBundle("compose")) | ||
} | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...ic/convention/src/main/java/com/boostcamp/mapisode/convention/extension/ComposeAndroid.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,25 @@ | ||
package com.boostcamp.mapisode.convention.extension | ||
|
||
import com.android.build.api.dsl.CommonExtension | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
internal fun Project.configureComposeAndroid( | ||
commonExtension: CommonExtension<*, *, *, *, *, *>, | ||
) { | ||
pluginManager.apply("org.jetbrains.kotlin.plugin.compose") | ||
|
||
commonExtension.apply { | ||
buildFeatures { | ||
compose = true | ||
} | ||
|
||
dependencies { | ||
val composeBom = libs.getLibrary("compose-bom") | ||
implementation(platform(composeBom)) | ||
implementation(libs.getBundle("compose")) | ||
debugImplementation(libs.getBundle("compose-debug")) | ||
// TODO: Test 의존성 추가 | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
.../main/java/com/boostcamp/mapisode/convention/extension/DependencyHandlerScopeExtension.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,55 @@ | ||
package com.boostcamp.mapisode.convention.extension | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.file.ConfigurableFileCollection | ||
import org.gradle.api.file.ConfigurableFileTree | ||
import org.gradle.api.provider.Provider | ||
import org.gradle.kotlin.dsl.DependencyHandlerScope | ||
|
||
fun DependencyHandlerScope.implementation(project: Project) { | ||
"implementation"(project) | ||
} | ||
|
||
fun DependencyHandlerScope.implementation(provider: Provider<*>) { | ||
"implementation"(provider) | ||
} | ||
|
||
fun DependencyHandlerScope.implementation(fileTree: ConfigurableFileTree) { | ||
"implementation"(fileTree) | ||
} | ||
|
||
fun DependencyHandlerScope.implementation(fileCollection: ConfigurableFileCollection) { | ||
"implementation"(fileCollection) | ||
} | ||
|
||
fun DependencyHandlerScope.debugImplementation(provider: Provider<*>) { | ||
"debugImplementation"(provider) | ||
} | ||
|
||
fun DependencyHandlerScope.releaseImplementation(provider: Provider<*>) { | ||
"releaseImplementation"(provider) | ||
} | ||
|
||
fun DependencyHandlerScope.ksp(provider: Provider<*>) { | ||
"ksp"(provider) | ||
} | ||
|
||
fun DependencyHandlerScope.kspTest(provider: Provider<*>) { | ||
"kspTest"(provider) | ||
} | ||
|
||
fun DependencyHandlerScope.coreLibraryDesugaring(provider: Provider<*>) { | ||
"coreLibraryDesugaring"(provider) | ||
} | ||
|
||
fun DependencyHandlerScope.androidTestImplementation(provider: Provider<*>) { | ||
"androidTestImplementation"(provider) | ||
} | ||
|
||
fun DependencyHandlerScope.testImplementation(provider: Provider<*>) { | ||
"testImplementation"(provider) | ||
} | ||
|
||
fun DependencyHandlerScope.compileOnly(provider: Provider<*>) { | ||
"compileOnly"(provider) | ||
} |
Oops, something went wrong.