-
Notifications
You must be signed in to change notification settings - Fork 0
[Refactor/#200] Gradle 설정 최신화 및 앱 버전 관리 아키텍처 개선 #202
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dfad3ee
Chore: 라이브러리 및 SDK 버전 업데이트
wjdrjs00 482e60a
Refactor: Convention Plugin 구조 개선
wjdrjs00 c35fa57
Refactor: 앱 버전 관리를 app 모듈로 이전
wjdrjs00 26e1f3e
Fix: hiltViewModel import 경로 수정
wjdrjs00 e6ac347
Fix: AndroidManifest에 installLocation="auto" 추가
wjdrjs00 215b48e
Chore: Kotlin Serialization 플러그인 교체 및 namespace 제거
wjdrjs00 1f12e43
Chore: installLocation을 internalOnly로 변경
wjdrjs00 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
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
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
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/threegap/bitnagil/di/data/AppVersionModule.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,25 @@ | ||
| package com.threegap.bitnagil.di.data | ||
|
|
||
| import com.threegap.bitnagil.BuildConfig | ||
| import dagger.Module | ||
| import dagger.Provides | ||
| import dagger.hilt.InstallIn | ||
| import dagger.hilt.components.SingletonComponent | ||
| import javax.inject.Named | ||
|
|
||
| @Module | ||
| @InstallIn(SingletonComponent::class) | ||
| object AppVersionModule { | ||
|
|
||
| @Provides | ||
| @Named("versionMajor") | ||
| fun provideVersionMajor(): Int = BuildConfig.VERSION_MAJOR | ||
|
|
||
| @Provides | ||
| @Named("versionMinor") | ||
| fun provideVersionMinor(): Int = BuildConfig.VERSION_MINOR | ||
|
|
||
| @Provides | ||
| @Named("versionPatch") | ||
| fun provideVersionPatch(): Int = BuildConfig.VERSION_PATCH | ||
| } |
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
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/threegap/bitnagil/util/version/PackageManagerVersionNameProvider.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,13 @@ | ||
| package com.threegap.bitnagil.util.version | ||
|
|
||
| import android.content.Context | ||
| import com.threegap.bitnagil.presentation.util.version.VersionNameProvider | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
| import javax.inject.Inject | ||
|
|
||
| class PackageManagerVersionNameProvider @Inject constructor( | ||
| @param:ApplicationContext private val context: Context, | ||
| ) : VersionNameProvider { | ||
| override fun getVersionName(): String = | ||
| context.packageManager.getPackageInfo(context.packageName, 0).versionName.orEmpty() | ||
| } |
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
13 changes: 5 additions & 8 deletions
13
...gic/convention/src/main/java/com/threegap/bitnagil/convention/AndroidApplicationPlugin.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
2 changes: 1 addition & 1 deletion
2
...d-logic/convention/src/main/java/com/threegap/bitnagil/convention/AndroidComposePlugin.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
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
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
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
10 changes: 10 additions & 0 deletions
10
...-logic/convention/src/main/java/com/threegap/bitnagil/convention/KotlinParcelizePlugin.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,10 @@ | ||
| package com.threegap.bitnagil.convention | ||
|
|
||
| import org.gradle.api.Plugin | ||
| import org.gradle.api.Project | ||
|
|
||
| class KotlinParcelizePlugin : Plugin<Project> { | ||
| override fun apply(target: Project): Unit = with(target) { | ||
| pluginManager.apply("org.jetbrains.kotlin.plugin.parcelize") | ||
| } | ||
| } |
16 changes: 16 additions & 0 deletions
16
...ic/convention/src/main/java/com/threegap/bitnagil/convention/KotlinSerializationPlugin.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,16 @@ | ||
| package com.threegap.bitnagil.convention | ||
|
|
||
| import com.threegap.bitnagil.convention.extension.libs | ||
| import org.gradle.api.Plugin | ||
| import org.gradle.api.Project | ||
| import org.gradle.kotlin.dsl.dependencies | ||
|
|
||
| class KotlinSerializationPlugin : Plugin<Project> { | ||
| override fun apply(target: Project): Unit = with(target) { | ||
| pluginManager.apply("org.jetbrains.kotlin.plugin.serialization") | ||
|
|
||
| dependencies { | ||
| "implementation"(libs.findLibrary("kotlinx-serialization-json").get()) | ||
| } | ||
| } | ||
| } |
33 changes: 7 additions & 26 deletions
33
...d-logic/convention/src/main/java/com/threegap/bitnagil/convention/extension/AppVersion.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 |
|---|---|---|
| @@ -1,37 +1,18 @@ | ||
| package com.threegap.bitnagil.convention.extension | ||
|
|
||
| import com.android.build.api.dsl.ApplicationExtension | ||
| import com.android.build.api.dsl.LibraryExtension | ||
| import org.gradle.api.Project | ||
| import org.gradle.api.artifacts.VersionCatalogsExtension | ||
| import org.gradle.kotlin.dsl.findByType | ||
| import org.gradle.kotlin.dsl.getByType | ||
|
|
||
| internal fun Project.configureAppVersion() { | ||
| val libs = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
| internal fun Project.configureAppVersion(extension: ApplicationExtension) { | ||
| val major = libs.findVersion("versionMajor").get().requiredVersion | ||
| val minor = libs.findVersion("versionMinor").get().requiredVersion | ||
| val patch = libs.findVersion("versionPatch").get().requiredVersion | ||
|
|
||
| extensions.findByType<ApplicationExtension>()?.let { appExtension -> | ||
| appExtension.defaultConfig { | ||
| versionName = "$major.$minor.$patch" | ||
| buildConfigField("int", "VERSION_MAJOR", major) | ||
| buildConfigField("int", "VERSION_MINOR", minor) | ||
| buildConfigField("int", "VERSION_PATCH", patch) | ||
| } | ||
| } | ||
|
|
||
| extensions.findByType<LibraryExtension>()?.let { libExtension -> | ||
| libExtension.apply { | ||
| defaultConfig { | ||
| buildConfigField("int", "VERSION_MAJOR", major) | ||
| buildConfigField("int", "VERSION_MINOR", minor) | ||
| buildConfigField("int", "VERSION_PATCH", patch) | ||
| } | ||
| buildFeatures { | ||
| buildConfig = true | ||
| } | ||
| } | ||
| extension.defaultConfig { | ||
| versionCode = libs.findVersion("versionCode").get().requiredVersion.toInt() | ||
| versionName = "$major.$minor.$patch" | ||
| buildConfigField("int", "VERSION_MAJOR", major) | ||
| buildConfigField("int", "VERSION_MINOR", minor) | ||
| buildConfigField("int", "VERSION_PATCH", patch) | ||
| } | ||
| } |
27 changes: 0 additions & 27 deletions
27
...ogic/convention/src/main/java/com/threegap/bitnagil/convention/extension/ApplicationId.kt
This file was deleted.
Oops, something went wrong.
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
15 changes: 15 additions & 0 deletions
15
...d-logic/convention/src/main/java/com/threegap/bitnagil/convention/extension/Extensions.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,15 @@ | ||
| package com.threegap.bitnagil.convention.extension | ||
|
|
||
| import org.gradle.api.Project | ||
| import org.gradle.api.artifacts.VersionCatalog | ||
| import org.gradle.api.artifacts.VersionCatalogsExtension | ||
| import org.gradle.kotlin.dsl.getByType | ||
|
|
||
| internal val Project.libs: VersionCatalog | ||
| get() = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
|
|
||
| internal val Project.basePackage: String | ||
| get() = libs.findVersion("applicationId").get().requiredVersion | ||
|
|
||
| internal val Project.namespace: String | ||
| get() = if (path == ":app") basePackage else "$basePackage.${name.replace("-", "_")}" |
Oops, something went wrong.
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.