Skip to content
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

[REFACTOR/#171] buildSrc에서 build-logic 마이그레이션 #172

Merged
merged 24 commits into from
Nov 25, 2024

Conversation

Copy link

@kkk5474096 kkk5474096 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

따로 남길건 없을것 같네유~
컴포즈도 세부적으로 나누고 싶으면 컴포즈플러그인을 따로 만드는 것도 좋을듯?

@Marchbreeze
Copy link
Member Author

따로 남길건 없을것 같네유~ 컴포즈도 세부적으로 나누고 싶으면 컴포즈플러그인을 따로 만드는 것도 좋을듯?

아자뵤
컴포즈할때 다시 또 건드려보겠슴ㄴ다 !!

kotlin("kapt")
id("kotlin-parcelize")
id("dagger.hilt.android.plugin")
id("kr.genti.androidApplication")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 매번 이렇게 하드코딩하는것이 휴먼 에러를 발생시킬 수 있다고 생각해서 libs.version.toml의 플러그인으로 등록해두는 편입니다. 휴먼에러 방지용!!

// libs.version.toml
[plugins]
genti-androidApplication = { id = "kr.genti.androidApplication", version = "unspecified" }

// build.gradle.kts
plugins {
    alias(libs.plugins.genti.androidApplication)
}

kotlin("android")
kotlin("kapt")
kotlin("plugin.serialization") version Versions.kotlinVersion
id("kr.genti.androidLibrary")
}

android {
namespace = "kr.genti.data"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분도 매번 작성한다면, 혹은 정말 불가피한 일로 package 이름이 바뀐다면 모든 gradle에 가서 수정해줘야 하는 불편함이 있다고 생각해요. 그래서 저는 이 부분도 함수화 시켜둬서 모든 곳에 적용해뒀어요

// buildLogic 내부에 하나 만들면 돼요
import org.gradle.api.Project

fun Project.setNamespace(name: String) {
    androidExtension.apply {
        namespace = "kr.genti.$name"
    }
}

// build.gradle
android {
    setNamespace("data")
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분은 단순한 궁금증인데, 저는 모든 버전을 libs.version.toml에서 관리하는 방법을 주로 사용해요.
하나의 파일에서 모든 버전을 관리한다면 추후 버전을 변경할 때 찾기 쉬울 것이라는 생각에 그러한 방식을 사용하는데 따로 Constants를 사용하신 이유나 장점이 있나요??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libs.version.toml에서는 implementation 관련된 버전만 관리하는게 편할 것 같아서 했습니다!
또한 libs.version.toml에서 저장하면 build-logic에서 getVersion 확장함수로 매번 가져와야하는데, 아예 build-logic 모듈 안에서 관리하게 된다면 접근할 필요가 없어진다고 생각했어요 (gradle에 활용되는 버전들을 모두 빌드로직에 옮겨두었기 때문에)

@Marchbreeze Marchbreeze merged commit 43092e2 into develop Nov 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] build-logic 마이그레이션
3 participants