Skip to content

Fix plugin ID mismatch between Gradle plugin and compiler plugin#55

Open
pawinkler wants to merge 1 commit intoJetBrains:mainfrom
pawinkler:plugin-id-mismatch
Open

Fix plugin ID mismatch between Gradle plugin and compiler plugin#55
pawinkler wants to merge 1 commit intoJetBrains:mainfrom
pawinkler:plugin-id-mismatch

Conversation

@pawinkler
Copy link
Collaborator

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() in FormVerGradleSubplugin was constructing the ID dynamically:

"${BuildConfig.COMPILER_PLUGIN_GROUP}.${BuildConfig.COMPILER_PLUGIN_NAME}"

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: Fix getCompilerPluginId() to return FormalVerificationPluginNames.PLUGIN_ID directly, making both sides agree on the ID.
  • PluginConfiguration.kt: Add toString() 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.

@pawinkler pawinkler requested a review from jesyspa March 4, 2026 17:02
}
}

override fun toString(): String =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just make this a data class?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seemed like the safer option for permanent modification, but after a bit of research, this is unsupported. Should I change it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please

logLevel, errorStyle, behaviour, conversionSelection, verificationSelection,
checkUniqueness
)
configuration.messageCollector.report(CompilerMessageSeverity.INFO, "Formal verification plugin: $config")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants