Add AGP 9 and Gradle 9 configuration cache compatibility#84
Conversation
Replace the internal `BaseAppModuleExtension` (removed in AGP 9) with the stable public `ApplicationExtension`, migrate `LibraryExtension` to the `com.android.build.api.dsl` package, and replace the removed `applicationVariants`/`libraryVariants` APIs with direct reads of `productFlavors` and `buildTypes`. Bump the compileOnly AGP dependency to 9.0.0 and update the minimum requirement in the README accordingly.
…with `defaultResPath.get()`. The fallback was dead code — defaultResPath always carries a value set at configuration time — but Kotlin's eager argument evaluation caused `Task.project` to be accessed at execution time, which Gradle's configuration cache forbids.
|
Hello @adriangl, could you pls check this PR? |
adriangl
left a comment
There was a problem hiding this comment.
Hey @jawnpaul! First of all, thanks for the contribution, it's truly appreciated!
Sorry I took so long to reply, some life stuff didn't let me focus on this project.
I've just got a couple of questions about the changes, but overall LGTM! 😁
| ## Minimum requirements | ||
| * Gradle 8.2 or above | ||
| * Android Gradle Plug-in 8.0 or above | ||
| * Android Gradle Plug-in 9.0 or above |
There was a problem hiding this comment.
One question regarding this: it should still be compatible with AGP 8, right? AFAIK, AGP 8 also has the new interfaces.
If AGP 9 is indeed required, this would qualify as a breaking change (just so it can be listed in the release changelog 😛)
| resDirPath = defaultResPath.getOrElse(getResourceDirectory( | ||
| project, DefaultValues.MAIN_CONFIG_NAME).absolutePath | ||
| ), | ||
| resDirPath = defaultResPath.get(), |
There was a problem hiding this comment.
So it should be enough with the conventions that we set in other code blocks, if I understood this correctly
Github issue
Resolves #82
PR's key points
ImportPoEditorStringsTask: replacedefaultResPath.getOrElse(getResourceDirectory(project, …))withdefaultResPath.get(), eliminating an illegalTask.projectaccess at execution timeHow to review this PR?
ImportPoEditorStringsTask.kt— theresDirPathassignment in@TaskActionnow calls.get()directly sincedefaultResPathalways carries a value set at configuration time; thegetResourceDirectoryfallback was dead code that caused the violation./gradlew buildto confirm compilation and tests passimportPoEditorStringswith--configuration-cacheenabled to confirm noTask.projectinvocation errorDefinition of Done