-
Notifications
You must be signed in to change notification settings - Fork 0
chore: AGP 9.0.0 마이그레이션 #264
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
base: develop
Are you sure you want to change the base?
Conversation
빌드시 warning 뜨는 문제들 해결
WalkthroughAGP 9.0으로 업그레이드하면서 더 이상 필요 없는 Kotlin DSL 억제 주석을 제거하고, 라이브러리 확장 임포트를 최신 API로 변경했으며, 플러그인 적용 방식을 간소화하고 주요 의존성 및 Gradle 래퍼를 업데이트했습니다. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Failure to add the new IP will result in interrupted reviews. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@build-logic/src/main/kotlin/com/ninecraft/booket/convention/Android.kt`:
- Around line 7-18: The Android configuration sets Java
sourceCompatibility/targetCompatibility in configureAndroid (CommonExtension ->
compileOptions using ApplicationConstants.javaVersion) but doesn't align
Kotlin's jvmTarget; add a Kotlin compile task config after the
compileOptions.apply block to set the Kotlin jvmTarget to the same Java version
(use tasks.withType<KotlinCompile>().configureEach and
compilerOptions.jvmTarget.set(JvmTarget.JVM_17> or derive from
ApplicationConstants.javaVersion) so Kotlin bytecode matches Java.
In `@build-logic/src/main/kotlin/com/ninecraft/booket/convention/Compose.kt`:
- Around line 20-29: The ComposeCompilerGradlePluginExtension DSL is always
setting metricsDestination and reportsDestination (metricsDestination,
reportsDestination, includeSourceInformation) which conflicts with the
compiler-arg toggles implemented in buildComposeMetricsParameters()
(enableComposeComposeCompilerMetrics, enableComposeCompilerReports) and leads to
duplicated/uneven paths; make the DSL destinations conditional or unify the
paths: check the boolean gradle properties (enableComposeComposeCompilerMetrics
and enableComposeCompilerReports) before calling
extensions.configure<ComposeCompilerGradlePluginExtension> to set
metricsDestination.file("build/composeMetrics") and
reportsDestination.file("build/composeReports"), or alternatively use the same
path values produced by buildComposeMetricsParameters() so they are consistent
(ensure symbols referenced: ComposeCompilerGradlePluginExtension,
includeSourceInformation, metricsDestination, reportsDestination,
buildComposeMetricsParameters, enableComposeComposeCompilerMetrics,
enableComposeCompilerReports).
In `@gradle/libs.versions.toml`:
- Around line 54-55: 현재 gradle/libs.versions.toml에서 androidx-credentials =
"1.6.0-rc01"로 릴리스 후보(RC)를 사용하고 있는데, 의도된 결정인지 확인하고 필요시 안정 버전으로 롤백하세요; 확인 방법은
프로젝트에서 androidx-credentials가 제공하는 특정 기능/버그픽스(또는 릴리스 노트)를 참조해
"androidx-credentials" 1.6.0-rc01 사용 이유를 명시하고, 의도된 경우 PR 설명에 그 사유를 추가하거나 그렇지 않으면
값을 "1.5.0"처럼 최신 안정판 버전으로 변경하세요.
| internal fun Project.configureAndroid(extension: CommonExtension) { | ||
| extension.apply { | ||
| compileSdk = libs.versions.compileSdk.get().toInt() | ||
|
|
||
| defaultConfig { | ||
| defaultConfig.apply { | ||
| minSdk = libs.versions.minSdk.get().toInt() | ||
| } | ||
|
|
||
| compileOptions { | ||
| compileOptions.apply { | ||
| sourceCompatibility = ApplicationConstants.javaVersion | ||
| targetCompatibility = ApplicationConstants.javaVersion | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# Find and examine ApplicationConstants file
fd -t f "ApplicationConstants" --type fRepository: YAPP-Github/Reed-Android
Length of output: 151
🏁 Script executed:
# Search for javaVersion definition
rg -t kotlin "javaVersion" -A 2 -B 2Repository: YAPP-Github/Reed-Android
Length of output: 1696
🌐 Web query:
AGP 9 default Kotlin jvmTarget compatibility
💡 Result:
- AGP 9.0 uses “built-in Kotlin” and depends on Kotlin Gradle Plugin (KGP) ≥ 2.2.10. If your declared KGP is lower, AGP will auto-upgrade it. [1]
- Kotlin’s default
jvmTargetis still 1.8 (if you don’t set it, it effectively compiles to Java 8 bytecode). [3][4] - AGP 9 changes the default Java
sourceCompatibility/targetCompatibilityto Java 11, so an “unconfigured” project can end up with Java = 11 but Kotlin = 1.8, which is an incompatible mix. [1][3]
Recommended fix (keep Kotlin/Java targets aligned): configure a Java toolchain (preferred), which (if you don’t explicitly set Kotlin jvmTarget) will also make Kotlin target the toolchain version. [3][5]
java {
toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } // or 11
}
// If you set it explicitly, keep it the same as the toolchain:
kotlin {
compilerOptions { jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17) } // or JVM_11
}Sources: AGP 9 release notes [1], Kotlin Gradle docs on defaults/toolchains [3], Kotlin jvmTarget API reference [4], Android “Java versions in Android builds” guidance [5].
Kotlin jvmTarget을 Java 버전과 명시적으로 일치시키세요.
현재 코드는 sourceCompatibility와 targetCompatibility를 Java 17로 설정하지만, Kotlin의 기본 jvmTarget은 1.8로 유지됩니다. 이로 인해 Java와 Kotlin 바이트코드 버전이 불일치하게 됩니다. compileOptions.apply 블록 아래에 Kotlin 컴파일 옵션을 추가하여 jvmTarget을 명시적으로 설정하세요:
tasks.withType<KotlinCompile>().configureEach {
compilerOptions.jvmTarget.set(JvmTarget.JVM_17)
}또는 Java 도구체인을 설정하면 Kotlin이 자동으로 따르게 됩니다.
🤖 Prompt for AI Agents
In `@build-logic/src/main/kotlin/com/ninecraft/booket/convention/Android.kt`
around lines 7 - 18, The Android configuration sets Java
sourceCompatibility/targetCompatibility in configureAndroid (CommonExtension ->
compileOptions using ApplicationConstants.javaVersion) but doesn't align
Kotlin's jvmTarget; add a Kotlin compile task config after the
compileOptions.apply block to set the Kotlin jvmTarget to the same Java version
(use tasks.withType<KotlinCompile>().configureEach and
compilerOptions.jvmTarget.set(JvmTarget.JVM_17> or derive from
ApplicationConstants.javaVersion) so Kotlin bytecode matches Java.
| extensions.configure<ComposeCompilerGradlePluginExtension> { | ||
| includeSourceInformation.set(true) | ||
|
|
||
| metricsDestination.file("build/composeMetrics") | ||
| reportsDestination.file("build/composeReports") | ||
| metricsDestination.file("build/composeMetrics") | ||
| reportsDestination.file("build/composeReports") | ||
|
|
||
| stabilityConfigurationFiles.addAll( | ||
| project.rootProject.layout.projectDirectory.file("stability.config.conf"), | ||
| ) | ||
| } | ||
| stabilityConfigurationFiles.addAll( | ||
| project.rootProject.layout.projectDirectory.file("stability.config.conf"), | ||
| ) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
ComposeCompilerGradlePluginExtension metricsDestination reportsDestination official behavior Gradle plugin
💡 Result:
In the Compose compiler Gradle plugin DSL (composeCompiler { ... }), both metricsDestination and reportsDestination are DirectoryProperty outputs that are only produced when you set them (i.e., they opt-in to dumping files). [1]
-
metricsDestination: when specified, the Compose compiler dumps “build metrics” for the current module (including amodule.jsonwith stats like processed composables/classes, stable classes/parameters, skippable functions, etc.). For Kotlin Multiplatform, metrics are written under a target/compilation subdirectory layout derived fromKotlinTarget.disambiguationClassifierandKotlinCompilation.compilationName(example:<dest>/jvm/main,<dest>/jvm/custom). [2] -
reportsDestination: when specified, the Compose compiler dumps “build reports” about the compilation, such as which composable functions are skippable, restartable, readonly, etc., useful for manual runtime-performance analysis. [3]
Sources:
[1] ComposeCompilerGradlePluginExtension API page (Kotlin Gradle Plugins API reference) (kotlinlang.org)
[2] metricsDestination API doc (kotlinlang.org)
[3] reportsDestination API doc (kotlinlang.org)
Citations:
- 1: https://kotlinlang.org/api/kotlin-gradle-plugin/compose-compiler-gradle-plugin/org.jetbrains.kotlin.compose.compiler.gradle/-compose-compiler-gradle-plugin-extension/
- 2: https://kotlinlang.org/api/kotlin-gradle-plugin/compose-compiler-gradle-plugin/org.jetbrains.kotlin.compose.compiler.gradle/-compose-compiler-gradle-plugin-extension/metrics-destination.html
- 3: https://kotlinlang.org/api/kotlin-gradle-plugin/compose-compiler-gradle-plugin/org.jetbrains.kotlin.compose.compiler.gradle/-compose-compiler-gradle-plugin-extension/reports-destination.html
🏁 Script executed:
# First, let's read the full Compose.kt file to understand the context
fd "Compose.kt" --type f | head -5Repository: YAPP-Github/Reed-Android
Length of output: 138
🏁 Script executed:
# Search for any gradle property usage related to compose metrics
rg "enableComposeCompilerMetrics|enableComposeCompilerReports|metricsDestination|reportsDestination" --type kotlin -A 2 -B 2Repository: YAPP-Github/Reed-Android
Length of output: 3039
🏁 Script executed:
# Check for gradle.properties or similar configuration files
fd "gradle.properties|local.properties" --type fRepository: YAPP-Github/Reed-Android
Length of output: 85
🏁 Script executed:
cat -n build-logic/src/main/kotlin/com/ninecraft/booket/convention/Compose.ktRepository: YAPP-Github/Reed-Android
Length of output: 2909
ComposeCompilerGradlePluginExtension의 DSL 설정과 compiler args의 불일치 수정 필요
현재 코드에서 metricsDestination과 reportsDestination은 라인 23-24에서 항상 설정되지만, 실제 gradle 속성(enableComposeComposeCompilerMetrics, enableComposeCompilerReports)은 buildComposeMetricsParameters() 내 compiler args에만 적용됩니다. DSL에서 destination을 설정하면 공식 문서에 따라 파일 생성이 활성화되므로, 현재 구조는 gradle 속성의 toggle 의도와 맞지 않습니다. 또한 DSL 경로(build/composeMetrics)와 compiler args 경로(compose-metrics/relative/path)가 다르므로 중복 생성 가능성도 있습니다.
DSL 설정을 gradle 속성에 따라 조건부로 적용하거나, 경로를 통일하는 것이 필요합니다.
조건부 설정 예시
extensions.configure<ComposeCompilerGradlePluginExtension> {
includeSourceInformation.set(true)
- metricsDestination.file("build/composeMetrics")
- reportsDestination.file("build/composeReports")
+ val enableMetrics = project.providers
+ .gradleProperty("enableComposeCompilerMetrics")
+ .orNull == "true"
+ if (enableMetrics) {
+ metricsDestination.file("build/composeMetrics")
+ }
+
+ val enableReports = project.providers
+ .gradleProperty("enableComposeCompilerReports")
+ .orNull == "true"
+ if (enableReports) {
+ reportsDestination.file("build/composeReports")
+ }
stabilityConfigurationFiles.addAll(
project.rootProject.layout.projectDirectory.file("stability.config.conf"),
)
}🤖 Prompt for AI Agents
In `@build-logic/src/main/kotlin/com/ninecraft/booket/convention/Compose.kt`
around lines 20 - 29, The ComposeCompilerGradlePluginExtension DSL is always
setting metricsDestination and reportsDestination (metricsDestination,
reportsDestination, includeSourceInformation) which conflicts with the
compiler-arg toggles implemented in buildComposeMetricsParameters()
(enableComposeComposeCompilerMetrics, enableComposeCompilerReports) and leads to
duplicated/uneven paths; make the DSL destinations conditional or unify the
paths: check the boolean gradle properties (enableComposeComposeCompilerMetrics
and enableComposeCompilerReports) before calling
extensions.configure<ComposeCompilerGradlePluginExtension> to set
metricsDestination.file("build/composeMetrics") and
reportsDestination.file("build/composeReports"), or alternatively use the same
path values produced by buildComposeMetricsParameters() so they are consistent
(ensure symbols referenced: ComposeCompilerGradlePluginExtension,
includeSourceInformation, metricsDestination, reportsDestination,
buildComposeMetricsParameters, enableComposeComposeCompilerMetrics,
enableComposeCompilerReports).
| androidx-credentials = "1.6.0-rc01" | ||
| googleid = "1.2.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
androidx credentials latest stable version
💡 Result:
Latest stable AndroidX Credentials (Credential Manager) version is 1.5.0 (artifacts: androidx.credentials:credentials and androidx.credentials:credentials-play-services-auth). [1]
dependencies {
implementation("androidx.credentials:credentials:1.5.0")
implementation("androidx.credentials:credentials-play-services-auth:1.5.0")
}androidx-credentials RC 버전 사용 의도 확인
현재 1.6.0-rc01(릴리스 후보)을 사용 중인데, 최신 안정판은 1.5.0입니다. RC 버전을 사용하면 안정성 측면에서 릴리스 리스크가 증가할 수 있습니다. RC 사용이 특정 기능이나 버그 수정이 필요한 의도된 결정인지 확인 부탁드립니다.
🤖 Prompt for AI Agents
In `@gradle/libs.versions.toml` around lines 54 - 55, 현재
gradle/libs.versions.toml에서 androidx-credentials = "1.6.0-rc01"로 릴리스 후보(RC)를
사용하고 있는데, 의도된 결정인지 확인하고 필요시 안정 버전으로 롤백하세요; 확인 방법은 프로젝트에서 androidx-credentials가
제공하는 특정 기능/버그픽스(또는 릴리스 노트)를 참조해 "androidx-credentials" 1.6.0-rc01 사용 이유를 명시하고,
의도된 경우 PR 설명에 그 사유를 추가하거나 그렇지 않으면 값을 "1.5.0"처럼 최신 안정판 버전으로 변경하세요.
🔗 관련 이슈
📙 작업 설명
🧪 테스트 내역 (선택)
💬 추가 설명 or 리뷰 포인트 (선택)
이 내용 관련해서 Uri.parse() 쓰면 toUri()로 변경하라고 안스에서 권장하는데, toUri()쓰면 이제 에러나는 딜레마가 있네요. 아직 안스에 android.core 1.17.0 버전 관련 변경사항이 대응이 안되어있는것 같기도 합니다.
reference)
https://developer.android.com/build/releases/agp-9-0-0-release-notes?hl=ko
https://angrypodo.tistory.com/29
Summary by CodeRabbit
릴리스 노트