Refactor afterEvaluated1 to afterEvaluated2 and update version#241
Refactor afterEvaluated1 to afterEvaluated2 and update version#241twisti-dev merged 1 commit intoversion/1.21.11from
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the Paper Gradle plugin lifecycle hook so shared Paper configuration runs in a final afterEvaluated1, while platform-specific logic moves into a new overridable afterEvaluated2. It also bumps the Gradle plugin module version.
Changes:
- Introduce
afterEvaluated2inAbstractPaperSurfPluginand delegate to it from a now-finalafterEvaluated1. - Update
PaperPluginSurfPluginto overrideafterEvaluated2instead ofafterEvaluated1. - Bump
surf-api-gradle-pluginversion from-1.13.0to-1.13.1.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/platform/paper/plugin/PaperPluginSurfPlugin.kt | Migrates Paper plugin-specific after-evaluation setup to the new afterEvaluated2 hook. |
| surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/platform/paper/AbstractPaperSurfPlugin.kt | Makes Paper shared after-evaluation behavior final and adds a new overridable hook for extensions. |
| surf-api-gradle-plugin/build.gradle.kts | Increments the module version suffix. |
| } | ||
|
|
||
| override fun Project.afterEvaluated1(extension: E) { | ||
| final override fun Project.afterEvaluated1(extension: E) { |
There was a problem hiding this comment.
afterEvaluated1 overrides a protected hook from AbstractCoreSurfPlugin, but this override widens visibility (no protected). For consistency with the lifecycle-hook pattern used elsewhere (e.g. CommonSurfPlugin.afterEvaluated0, AbstractCoreSurfPlugin.afterEvaluated1), consider keeping this override protected while making it final (or otherwise ensure this hook isn’t unintentionally callable from unrelated code within the module).
| final override fun Project.afterEvaluated1(extension: E) { | |
| protected final override fun Project.afterEvaluated1(extension: E) { |
| open fun Project.afterEvaluated2(extension: E) { | ||
|
|
||
| } |
There was a problem hiding this comment.
afterEvaluated2 is introduced as an open (public) hook with an empty body. Other lifecycle hooks in this plugin hierarchy are protected open, which better communicates intended usage and prevents unrelated module-internal code from calling it. Consider changing this to protected open and collapsing the empty implementation to {} (or adding a comment explaining why the hook exists).
| open fun Project.afterEvaluated2(extension: E) { | |
| } | |
| protected open fun Project.afterEvaluated2(extension: E) {} |
No description provided.