Fix plugin ID mismatch between Gradle plugin and compiler plugin#55
Fix plugin ID mismatch between Gradle plugin and compiler plugin#55pawinkler wants to merge 1 commit intoJetBrains:mainfrom
Conversation
| } | ||
| } | ||
|
|
||
| override fun toString(): String = |
There was a problem hiding this comment.
Why not just make this a data class?
There was a problem hiding this comment.
It seemed like the safer option for permanent modification, but after a bit of research, this is unsupported. Should I change it?
| logLevel, errorStyle, behaviour, conversionSelection, verificationSelection, | ||
| checkUniqueness | ||
| ) | ||
| configuration.messageCollector.report(CompilerMessageSeverity.INFO, "Formal verification plugin: $config") |
There was a problem hiding this comment.
@ligee Does this look reasonable? I am a bit concerned about adding a diagnostic to every build that uses our plugin.
|
|
||
| override fun getCompilerPluginId(): String = | ||
| "${BuildConfig.COMPILER_PLUGIN_GROUP}.${BuildConfig.COMPILER_PLUGIN_NAME}" | ||
| override fun getCompilerPluginId(): String = FormalVerificationPluginNames.PLUGIN_ID |
There was a problem hiding this comment.
For my understanding: why is this the correct place to adjust? (If the problem is because of a mismatch between two places, why make the change at A instead of B?)
There was a problem hiding this comment.
The old code produced org.jetbrains.kotlin.formver.formver.compiler-plugin, which seemed deprecated to me, as it contains formver twice and only refers to the sub-project. Also, as far as I understand, changing the PLUGIN_ID would invalidate all existing Gradle configurations.
There was a problem hiding this comment.
Ah, I think I see. Invalidating existing configurations isn't a big deal (we have zero users).
Is it okay that the PLUGIN_ID here ends up being shared by the gradle plugin and the compiler plugin? My understanding is that PLUGIN_ID was intended to refer to the gradle one.
Problem
When passing settings from Gradle to the plugin, the settings were silently ignored. The root cause was a mismatch between the plugin ID used by the Gradle plugin and the one used by the compiler plugin.
getCompilerPluginId()inFormVerGradleSubpluginwas constructing the ID dynamically:This produced a different string than
FormalVerificationPluginNames.PLUGIN_ID. Kotlin uses the plugin ID to match options to their plugin, so a mismatch means all options are dropped.Changes
FormVerSubplugin.kt: FixgetCompilerPluginId()to returnFormalVerificationPluginNames.PLUGIN_IDdirectly, making both sides agree on the ID.PluginConfiguration.kt: AddtoString()so the configuration can be meaningfully logged.FormalVerificationPluginComponentRegistrar.kt: Log the resolved configuration at startup via the compiler message collector, making it easier to diagnose configuration issues in future.