Fix Configuration Cache compatibility (#108)#109
Conversation
Fixes #108 by eliminating getProject() calls during task execution time and moving all configuration logic to the configuration phase. Key changes: - Moved args/jvmArgs configuration from exec() to new configureArgs() methods - Changed getProject().getLogger() to getLogger() in task execution - Added gwtDevRuntimeClasspath field to store classpath during configuration - Updated all config classes to call configureArgs() during configuration phase - Added processResources task dependency to GwtCompileTask The plugin now works correctly with Gradle Configuration Cache enabled.
There was a problem hiding this comment.
Pull Request Overview
This PR fixes Gradle Configuration Cache compatibility issues by refactoring GWT plugin tasks to separate configuration-time and execution-time logic, ensuring compliance with Gradle's Configuration Cache requirements.
- Moved all task configuration from execution phase to configuration phase to eliminate Configuration Cache violations
- Added dedicated
configureArgs()methods to separate argument setup from task execution - Introduced
gwtDevRuntimeClasspathfield to store classpath configuration during configuration phase
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| AbstractBaseTask.java | Refactored to separate argument configuration from execution, added gwtDevRuntimeClasspath field |
| GwtCompileTask.java | Added configureCompileArgs() method and fixed logger access for Configuration Cache compatibility |
| GwtCompileConfig.java | Modified to configure classpath and arguments during configuration phase |
| GwtDevModeConfig.java | Modified to configure classpath and arguments during configuration phase |
| GwtSuperDevConfig.java | Modified to configure classpath and arguments during configuration phase |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Reduces code duplication by extracting the repeated classpath configuration logic into a shared configureClasspath() method in AbstractBaseTask. This eliminates 33 lines of duplicated code across three config classes and improves maintainability.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…roject() Improves code clarity by passing the project instance that's already available in the execute() method, rather than calling task.getProject() again. This also makes the code more consistent across all config classes.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Rename allMainSourcePaths to mainSourcePaths for clarity - Add Project import and use simple type name instead of FQN - Improves code readability and consistency
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Summary
Fixes #108 by adding full Gradle Configuration Cache compatibility to the GWT Gradle plugin. The plugin previously failed with Configuration Cache enabled due to accessing
getProject()during task execution time, which violates Gradle's Configuration Cache requirements.Problem
When Configuration Cache was enabled (
-Dorg.gradle.configuration-cache=true), Gradle reported incompatibilities:getProject()during execution time (inexec()methods)Solution
configureArgs()andconfigureCompileArgs()methods that are called during task configuration rather than executiongetProject()calls: ChangedgetProject().getLogger()togetLogger()and moved all project access to configuration phasegwtDevRuntimeClasspathfield: Stores the GWT dev runtime classpath as aConfigurableFileCollectionthat is populated during configurationGwtCompileConfig,GwtDevModeConfig, andGwtSuperDevConfigto set up classpath and callconfigureArgs()during configurationprocessResourcesdependency toGwtCompileTaskChanges Made
exec()method to separate configuration-time setup from execution-time logicconfigureCompileArgs()methodImpact