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

buildFlavor 관련 작업 내용 #558

Open
ricky-o-k opened this issue Jun 24, 2023 · 1 comment
Open

buildFlavor 관련 작업 내용 #558

ricky-o-k opened this issue Jun 24, 2023 · 1 comment

Comments

@ricky-o-k
Copy link
Collaborator

ricky-o-k commented Jun 24, 2023

기록용으로 남김

@ricky-o-k ricky-o-k added bug 버그 and removed bug 버그 labels Jun 24, 2023
@ricky-o-k
Copy link
Collaborator Author

ricky-o-k commented Jun 24, 2023

1. buildFlavor 시 config 처리

1. Plugin 설정으로 처리 (불가능)

  1. 동작순서가 플러그인 내용이 먼저 동작 -> build.gradle.kts
    실제 plugin 내용이 먼저 설정되고 build.gradle.kts 내용이 동작하는 것을 확인할 수 있음
    (최하단에 app gradle 동작 내용 로그가 찍혀 있음)
    image

  2. build.gradle.kts 에만 flavor 설정이 가능함
    실제 플러그인에서 설정은 비권장 내용
    image

    그래서 plugin 에서는 정적 컨텐츠 사용을 권장함 (그러므로 versionName 과 versionCode 는 플러그인으로 관리가 가능)

2. data 모듈, app 모듈 모두에 config 설정하기 (불가능)

앱 의존성이 꼬여 동작하지 않음

3. Plugin 내에서 afterEvaluate 사용하기 ✅

afterEvaluate
Kotlin DSL을 사용하는 경우 build.gradle.kts 파일 내의 모든 설정이 처리된 후에 afterEvaluate 블록이 실행됩니다.
따라서 afterEvaluate 블록 내에서 플러그인 설정 이후에 동작해야 하는 로직을 처리할 수 있습니다.

afterEvaluate 를 plugin 에 넣어 사용하니 비로소 값이 나오는 것 확인

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant