[2.x] fix: Respect last plugin toggle for enablePlugins/disablePlugins#8794
Merged
eed3si9n merged 1 commit intosbt:developfrom Feb 23, 2026
Merged
Conversation
…sbt#1926) Treat explicit plugin toggles as last-call-wins for the same plugin. This avoids contradictory include/exclude states when disablePlugins(X) is followed by enablePlugins(X) (and vice versa), aligning behavior with normal override expectations. Apply the same semantics to ProjectMatrix and add regression coverage: - unit tests in main/src/test/scala/ProjectSpec.scala - scripted test in sbt-app/src/sbt-test/project/i1926-disable-enable-plugin
Contributor
Author
|
@eed3si9n please review my PR. thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1926
Problem
Calling
disablePlugins(X).enablePlugins(X)(or the reverse order) could leave both include and exclude for the same plugin in the selected plugin expression, which causedAutoPluginExceptioncontradiction during project load/reload.Solution
Introduce explicit toggle precedence (
last call wins) when combining plugin selections:disable -> enablekeeps plugin enabledenable -> disablekeeps plugin disabledApply the same behavior to both
ProjectandProjectMatrix.Testing
sbt-app/src/sbt-test/project/i1926-disable-enable-pluginmain/src/test/scala/ProjectSpec.scalasbt "mainProj/testOnly sbt.ProjectSpec"sbt "scripted project/i1926-disable-enable-plugin"