-
Notifications
You must be signed in to change notification settings - Fork 4
Refactor and update Gradle plugin APIs and configurations #93
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
Conversation
Reorganized Gradle plugin structure by introducing a separate module for deprecated configurations. Deprecated `SuspendTransformGradleExtension`, redirecting users to `SuspendTransformPluginExtension`. Added compatibility handling to maintain backward support while preparing for full removal of deprecated features.
Reorganized plugin configuration by refactoring `SuspendTransformConfiguration` to improve modularity and readability. The README_CN was updated for enhanced documentation and clarity.
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.
Pull Request Overview
This pull request refactors and updates the Gradle plugin APIs and configurations to provide a more maintainable and modern DSL for suspend transform configuration. Key changes include updating package imports and configuration keys, refactoring the transformation logic (in both FIR and IR components), and deprecating legacy configuration APIs in favor of a new, DSL-driven approach.
Reviewed Changes
Copilot reviewed 44 out of 48 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformIrGenerationExtension.kt | Updated import path for SuspendTransformConfiguration to the new configuration module. |
compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt | Refactored transformer symbol maps, adjusted predicate handling, and removed the legacy check for non-null className in transform function info. |
compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirExtensionRegistrar.kt | Updated import for configuration and reformatted class declaration. |
compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformComponentRegistrar.kt | Adjusted dependencies with additional configuration imports and updated resolve logic. |
compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformCommandLineProcessor.kt | Replaced legacy configuration key with the new one and merged configuration updates using the plus operator. |
compiler/suspend-transform-plugin-deprecated-configuration/src/main/kotlin/love/forte/plugin/suspendtrans/DeprecatedSuspendTransformConfiguration.kt | Added deprecation annotations with guidance to use the new configuration API. |
compiler/suspend-transform-plugin-cli | Introduced new CLI modules for encoding/decoding configuration and updated associated README files. |
buildSrc/src/main/kotlin/IProject.kt | Bumped the plugin version as part of the refactoring effort. |
Files not reviewed (4)
- compiler/suspend-transform-plugin-cli/build.gradle.kts: Language not supported
- compiler/suspend-transform-plugin-configuration/build.gradle.kts: Language not supported
- compiler/suspend-transform-plugin-deprecated-configuration/build.gradle.kts: Language not supported
- compiler/suspend-transform-plugin/build.gradle.kts: Language not supported
Comments suppressed due to low confidence (2)
compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:114
- The removal of the error check for a non-null className might allow transformer functions to be configured incorrectly. If this change is intentional, please add a clarifying comment or documentation entry to explain the updated behavior.
val className = transformFunctionInfo.className
compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformCommandLineProcessor.kt:35
- [nitpick] The merging of configurations using the plus operator is not immediately obvious. Consider adding an inline comment or referencing documentation to clarify how configuration merging is expected to work.
if (SuspendTransformCliOptions.CLI_CONFIGURATION.optionName == option.optionName) {
PR waits to consider merging it after testing it with other local application projects. |
simbot core 本地尝试迁移后未出现二进制变化,大致可以确认配置迁移后行为一致。稍后再试试各组件。 |
Introduce `SuspendTransformPluginExtensionSpecFactory` and its implementation to modularize the creation of various specs. Refactor related methods to leverage the factory for cleaner and more consistent object instantiation.
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.
Pull Request Overview
This pull request refactors and updates the Gradle plugin APIs and configurations by introducing a new DSL API (suspendTransformPlugin) and improving the internal configuration mapping and CLI option handling. Key changes include:
- Renaming and restructuring of DSL and configuration classes for improved readability and future extensibility.
- Extraction of configuration and CLI options into separate modules with updated serialization and deprecation support.
- Updates to test coverage and build scripts reflecting the new plugin version.
Reviewed Changes
Copilot reviewed 48 out of 52 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt | Adjusts transformer symbol mapping, updates FIR transformation logic, and modifies origin handling. |
compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirExtensionRegistrar.kt | Updates imports and class declaration to conform to new configuration package structure. |
compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt | Updates import to use the new configuration package. |
compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformComponentRegistrar.kt | Modifies configuration resolution and adds deprecation comments for legacy code. |
compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformCommandLineProcessor.kt | Revises CLI option processing including updating the configuration key and merging configurations. |
compiler/suspend-transform-plugin-deprecated-configuration/src/main/kotlin/love/forte/plugin/suspendtrans/DeprecatedSuspendTransformConfiguration.kt | Adds deprecation annotations and helpful replacement suggestions for legacy configurations. |
compiler/suspend-transform-plugin-deprecated-configuration/src/main/kotlin/love/forte/plugin/suspendtrans/CliOptions.kt | Marks legacy CLI options as deprecated with updated warnings. |
compiler/suspend-transform-plugin-deprecated-configuration/README.md | Documents the purpose of the deprecated configuration module for transitional support. |
compiler/suspend-transform-plugin-cli/src/test/kotlin/love/forte/plugin/suspendtrans/cli/ConfigurationSerializeTests.kt | Introduces tests to verify configuration serialization and deserialization. |
compiler/suspend-transform-plugin-cli/src/main/kotlin/love/forte/plugin/suspendtrans/cli/SuspendTransformCliOptions.kt | Adds a new CLI option definition for configuration serialization. |
compiler/suspend-transform-plugin-cli/src/main/kotlin/love/forte/plugin/suspendtrans/cli/SuspendTransformCliOption.kt | Provides a new implementation for CLI options conversion and abstraction. |
compiler/suspend-transform-plugin-cli/src/main/kotlin/love/forte/plugin/suspendtrans/cli/KotlinCompilerPluginCliOptions.kt | Introduces new CLI options for the Kotlin compiler plugin. |
compiler/suspend-transform-plugin-cli/src/main/kotlin/love/forte/plugin/suspendtrans/cli/GradlePluginCliOptions.kt | Updates encoding/decoding logic for CLI options in the Gradle plugin module. |
compiler/suspend-transform-plugin-cli/README.md | Adds documentation for the CLI options module. |
buildSrc/src/main/kotlin/IProject.kt | Updates plugin version information to reflect the new release version. |
buildSrc/src/main/kotlin/GradleSupportHelper.kt | Adds a helper function ensuring Gradle buildSrc compatibility with updated Kotlin compiler versions. |
Files not reviewed (4)
- compiler/suspend-transform-plugin-cli/build.gradle.kts: Language not supported
- compiler/suspend-transform-plugin-configuration/build.gradle.kts: Language not supported
- compiler/suspend-transform-plugin-deprecated-configuration/build.gradle.kts: Language not supported
- compiler/suspend-transform-plugin/build.gradle.kts: Language not supported
直接就重构了😨 |
包的 |
This pr refactoring and updates the Gradle plugin configurations and APIs. Key changes include:
SuspendTransformConfiguration
for better structure and readability.Configuration and CLI options are extracted as separate modules, which should solve #90.
SuspendTransformGradleExtension
) and redirected usage to the newSuspendTransformPluginExtension
.Past extensions are exposed to the public via
data class
. It's not conducive to maintenance and updates, and it's not “Gradle” enough.The old
suspendTransform { ... }
DSL API is now deprecated and a newsuspendTransformPlugin { ... }
DSL API is provided. The new API uses Gradle'sProperty
API and uses it as a bridge to hide the true compiler plugin configuration type for possible future extensions.The new usage examples have been updated in the README.
Past:
Now:
In addition, the Kotlin builds and dependencies of the
cli
,configuration
, andgradle-plugin
modules have been tweaked along the way (Language version down toKOTLIN_1_9
, dependencies e.g.kotlin-stdlib
down to1.9.0
), so they can now continue to be used in Gradle'sbuildSrc
and the like.Since Gradle has a built-in version of Kotlin and a relatively low version, in previous versions the compiler plugin has relied on a version of the Kotlin language that exceeds Gradle's built-in version, rendering it unusable in
buildSrc
.Warning
Absolute binary compatibility with the previous is not guaranteed. But the source code SHOULD BE compatible.
The generated code is theoretically unaffected.
close #90
close #92
close #81