Skip to content
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

Only set mimaPreviousArtifacts when not set by other plugins #138

Open
bjaglin opened this issue Sep 21, 2022 · 2 comments
Open

Only set mimaPreviousArtifacts when not set by other plugins #138

bjaglin opened this issue Sep 21, 2022 · 2 comments

Comments

@bjaglin
Copy link

bjaglin commented Sep 21, 2022

Found via scalacenter/scalafix#1673.

When mimaPreviousArtifacts is already set by another plugin that happens to run before SbtVersionPolicyPlugin, the value gets overriden (in the case of Scalafix, mimaPreviousArtifacts is set to compare module_2.13.$n against module_2.13.${n-1} through a local plugin for example).

Suggestion: when the value is already set (non-empty), do not provide a default.

@julienrf
Copy link
Collaborator

IIUC, the suggested fix is to rely on the fact that, by default, the MiMa plugin sets mimaPreviousArtifacts to an empty collection. So, if it is not empty, it means that someone set it and we don’t want to overwrite it. However, maybe in some cases, people do want sbt-version-policy to overwrite a value otherwise incorrectly set by another plugin. I wonder if the correct way to fix this issue is to change the order of application of the plugins (like you did)?

@bjaglin
Copy link
Author

bjaglin commented Oct 18, 2022

I wonder if the correct way to fix this issue is to change the order of application of the plugins (like you did)?

It should be yes, unfortunately, I don't know a way in sbt to control the order of application of plugins you don't define yourself (I was lucky to be in control as it was an internal plugin that can be made aware of the presence of SbtVersionPolicyPlugin).

Suggestion: when the value is already set (non-empty), do not provide a default.

Now I realize this suggestion is not good, as it relies on the plugin application order (somewhat stable, but not deterministic/speced). SbtVersionPolicyPlugin might run first, and the value it sets may get overriden by another plugin, so it's a general problem.

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

No branches or pull requests

2 participants