-
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.
Merge pull request #76 from Nexters/feature/implement-build-logic-module
build-logic 구현
- Loading branch information
Showing
55 changed files
with
373 additions
and
314 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/build | ||
/release | ||
.kotlin/ | ||
|
||
# Created by https://www.gitignore.io/api/kotlin,androidstudio | ||
|
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 @@ | ||
/build |
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,27 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
dependencies { | ||
implementation(libs.android.gradle.plugin) | ||
implementation(libs.kotlin.gradle.plugin) | ||
compileOnly(libs.ksp.gradle.plugin) | ||
compileOnly(libs.compose.compiler.gradle.plugin) | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
register("androidApplication") { | ||
id = "missionmate.android.application" | ||
implementationClass = "MissionmateAndroidApplicationPlugin" | ||
} | ||
register("androidLibrary") { | ||
id = "missionmate.android.library" | ||
implementationClass = "MissionmateAndroidLibrary" | ||
} | ||
register("androidHilt") { | ||
id = "missionmate.android.hilt" | ||
implementationClass = "com.goalpanzi.mission_mate.convention.HiltAndroidPlugin" | ||
} | ||
} | ||
} |
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,14 @@ | ||
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") | ||
@Suppress("UnstableApiUsage") | ||
dependencyResolutionManagement { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
build-logic/src/main/kotlin/com/goalpanzi/mission_mate/convention/AppNameExtension.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,9 @@ | ||
package com.goalpanzi.mission_mate.convention | ||
|
||
import org.gradle.api.Project | ||
|
||
fun Project.setNamespace(name: String) { | ||
androidExtension.apply { | ||
namespace = "com.goalpanzi.mission_mate.$name" | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
build-logic/src/main/kotlin/com/goalpanzi/mission_mate/convention/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,41 @@ | ||
package com.goalpanzi.mission_mate.convention | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
import org.gradle.kotlin.dsl.getByType | ||
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension | ||
|
||
internal fun Project.configureComposeAndroid() { | ||
with(plugins) { | ||
apply("org.jetbrains.kotlin.plugin.compose") | ||
} | ||
|
||
val libs = extensions.libs | ||
androidExtension.apply { | ||
buildFeatures { | ||
compose = true | ||
} | ||
|
||
dependencies { | ||
val bom = libs.findLibrary("androidx-compose-bom").get() | ||
implementation(platform(bom)) | ||
implementation(libs.findLibrary("androidx.ui").get()) | ||
implementation(libs.findLibrary("androidx.ui.graphics").get()) | ||
implementation(libs.findLibrary("androidx.ui.tooling.preview").get()) | ||
implementation(libs.findLibrary("androidx.material3").get()) | ||
implementation(libs.findLibrary("androidx.material").get()) | ||
implementation(libs.findLibrary("androidx.navigation.compose").get()) | ||
implementation(libs.findLibrary("androidx.hilt.navigation.compose").get()) | ||
|
||
debugImplementation(libs.findLibrary("androidx.ui.tooling").get()) | ||
debugImplementation(libs.findLibrary("androidx.ui.test.manifest").get()) | ||
|
||
androidTestImplementation(platform(bom)) | ||
androidTestImplementation(libs.findLibrary("androidx.ui.test.junit4").get()) | ||
} | ||
} | ||
|
||
extensions.getByType<ComposeCompilerGradlePluginExtension>().apply { | ||
enableStrongSkippingMode.set(true) | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
build-logic/src/main/kotlin/com/goalpanzi/mission_mate/convention/CoroutineAndroid.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,20 @@ | ||
package com.goalpanzi.mission_mate.convention | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
internal fun Project.configureCoroutineAndroid() { | ||
val libs = extensions.libs | ||
configureCoroutineKotlin() | ||
dependencies { | ||
implementation(libs.findLibrary("coroutines.android").get()) | ||
} | ||
} | ||
|
||
internal fun Project.configureCoroutineKotlin() { | ||
val libs = extensions.libs | ||
dependencies { | ||
implementation(libs.findLibrary("coroutines.core").get()) | ||
testImplementation(libs.findLibrary("coroutines.test").get()) | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
build-logic/src/main/kotlin/com/goalpanzi/mission_mate/convention/Extension.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,46 @@ | ||
package com.goalpanzi.mission_mate.convention | ||
|
||
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.api.artifacts.dsl.DependencyHandler | ||
import org.gradle.api.plugins.ExtensionContainer | ||
import org.gradle.kotlin.dsl.getByType | ||
|
||
internal val ExtensionContainer.libs: VersionCatalog | ||
get() = getByType<VersionCatalogsExtension>().named("libs") | ||
|
||
internal val Project.androidExtension: CommonExtension<*, *, *, *, *, *> | ||
get() = runCatching { libraryExtension } | ||
.recoverCatching { applicationExtension } | ||
.onFailure { println("Could not find Library or Application extension from this project") } | ||
.getOrThrow() | ||
|
||
internal val Project.applicationExtension: CommonExtension<*, *, *, *, *, *> | ||
get() = extensions.getByType<ApplicationExtension>() | ||
|
||
internal val Project.libraryExtension: CommonExtension<*, *, *, *, *, *> | ||
get() = extensions.getByType<LibraryExtension>() | ||
|
||
internal fun DependencyHandler.implementation(dependencyNotation: Any) { | ||
add("implementation", dependencyNotation) | ||
} | ||
|
||
internal fun DependencyHandler.testImplementation(dependencyNotation: Any) { | ||
add("testImplementation", dependencyNotation) | ||
} | ||
|
||
internal fun DependencyHandler.androidTestImplementation(dependencyNotation: Any) { | ||
add("androidTestImplementation", dependencyNotation) | ||
} | ||
|
||
internal fun DependencyHandler.debugImplementation(dependencyNotation: Any) { | ||
add("debugImplementation", dependencyNotation) | ||
} | ||
|
||
internal fun DependencyHandler.ksp(dependencyNotation: Any) { | ||
add("ksp", dependencyNotation) | ||
} |
26 changes: 26 additions & 0 deletions
26
build-logic/src/main/kotlin/com/goalpanzi/mission_mate/convention/HiltAndroid.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.goalpanzi.mission_mate.convention | ||
|
||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
internal fun Project.configureHiltAndroid() { | ||
with(pluginManager) { | ||
apply("dagger.hilt.android.plugin") | ||
apply("com.google.devtools.ksp") | ||
} | ||
|
||
val libs = extensions.libs | ||
dependencies { | ||
implementation(libs.findLibrary("hilt.android").get()) | ||
ksp(libs.findLibrary("hilt.compiler").get()) | ||
} | ||
} | ||
|
||
internal class HiltAndroidPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
with(target) { | ||
configureHiltAndroid() | ||
} | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
build-logic/src/main/kotlin/com/goalpanzi/mission_mate/convention/KotlinAndroid.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,51 @@ | ||
package com.goalpanzi.mission_mate.convention | ||
|
||
import org.gradle.api.JavaVersion | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.withType | ||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
internal fun Project.configureKotlinAndroid() { | ||
|
||
pluginManager.apply("org.jetbrains.kotlin.android") | ||
|
||
androidExtension.apply { | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
minSdk = 26 | ||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
getByName("release") { | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
|
||
buildFeatures { | ||
buildConfig = true | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
tasks.withType<KotlinCompile>().configureEach { | ||
compilerOptions { | ||
jvmTarget.set(JvmTarget.JVM_17) | ||
} | ||
} | ||
|
||
packaging { | ||
resources { | ||
excludes += "/META-INF/{AL2.0,LGPL2.1}" | ||
} | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
build-logic/src/main/kotlin/com/goalpanzi/mission_mate/convention/NetworkAndroid.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,15 @@ | ||
package com.goalpanzi.mission_mate.convention | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
internal fun Project.configureNetworkAndroid() { | ||
val libs = extensions.libs | ||
|
||
dependencies { | ||
implementation(libs.findLibrary("retrofit").get()) | ||
implementation(libs.findLibrary("retrofit.kotlinx.serialization").get()) | ||
implementation(libs.findLibrary("okhttp3").get()) | ||
implementation(libs.findLibrary("okhttp3.logging.interceptor").get()) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
build-logic/src/main/kotlin/missionmate.android.application.gradle.kts
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,9 @@ | ||
import com.goalpanzi.mission_mate.convention.configureHiltAndroid | ||
import com.goalpanzi.mission_mate.convention.configureKotlinAndroid | ||
|
||
plugins { | ||
id("com.android.application") | ||
} | ||
|
||
configureKotlinAndroid() | ||
configureHiltAndroid() |
3 changes: 3 additions & 0 deletions
3
build-logic/src/main/kotlin/missionmate.android.compose.gradle.kts
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,3 @@ | ||
import com.goalpanzi.mission_mate.convention.configureComposeAndroid | ||
|
||
configureComposeAndroid() |
33 changes: 33 additions & 0 deletions
33
build-logic/src/main/kotlin/missionmate.android.feature.gradle.kts
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,33 @@ | ||
import com.goalpanzi.mission_mate.convention.configureHiltAndroid | ||
import com.goalpanzi.mission_mate.convention.libs | ||
|
||
plugins { | ||
id("missionmate.android.library") | ||
id("missionmate.android.compose") | ||
} | ||
|
||
android { | ||
packaging { | ||
resources { | ||
excludes.add("META-INF/**") | ||
} | ||
} | ||
defaultConfig { | ||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
} | ||
|
||
configureHiltAndroid() | ||
|
||
dependencies { | ||
implementation(project(":core:designsystem")) | ||
implementation(project(":core:navigation")) | ||
implementation(project(":core:domain:user")) | ||
implementation(project(":core:domain:setting")) | ||
implementation(project(":core:domain:mission")) | ||
implementation(project(":core:domain:common")) | ||
implementation(project(":core:domain:auth")) | ||
implementation(project(":core:ui")) | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
build-logic/src/main/kotlin/missionmate.android.library.gradle.kts
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,11 @@ | ||
import com.goalpanzi.mission_mate.convention.configureCoroutineAndroid | ||
import com.goalpanzi.mission_mate.convention.configureHiltAndroid | ||
import com.goalpanzi.mission_mate.convention.configureKotlinAndroid | ||
|
||
plugins { | ||
id("com.android.library") | ||
} | ||
|
||
configureKotlinAndroid() | ||
configureCoroutineAndroid() | ||
configureHiltAndroid() |
Oops, something went wrong.