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

Make automatic configuration updates configurable per project #1664

Merged

Conversation

HannesWell
Copy link
Contributor

And degrade problems about out-dated project configuration to severity 'info', if automatic updates are disabled for a project.

grafik

Fixes #1661

@laeubi what do you think?
I'm not sure adding API methods is really necessary (for now I just added it for completes/symmetry) but it is probably sufficient to have this internal.

@HannesWell HannesWell force-pushed the auto-update-project-preference branch from ca7690e to a2136e0 Compare February 2, 2024 17:30
Copy link

github-actions bot commented Feb 2, 2024

Test Results

  214 files  ±0    214 suites  ±0   18m 36s ⏱️ +37s
  664 tests ±0    654 ✅ ±0  10 💤 ±0  0 ❌ ±0 
1 328 runs  ±0  1 306 ✅ ±0  22 💤 ±0  0 ❌ ±0 

Results for commit 2688bc9. ± Comparison against base commit 086955c.

♻️ This comment has been updated with latest results.

@HannesWell HannesWell force-pushed the auto-update-project-preference branch 2 times, most recently from ef9509a to 8f80e1e Compare February 2, 2024 22:40
@HannesWell
Copy link
Contributor Author

I'm not sure adding API methods is really necessary (for now I just added it for completes/symmetry) but it is probably sufficient to have this internal.

I have now reverted the changes of the IProjectConfiguration interface, but could not avoid new methods in ResolverConfiguration. In order to prevent/discourage external usage, I annotated them with @noreference.

@HannesWell
Copy link
Contributor Author

I'm not sure adding API methods is really necessary (for now I just added it for completes/symmetry) but it is probably sufficient to have this internal.

I have now reverted the changes of the IProjectConfiguration interface, but could not avoid new methods in ResolverConfiguration. In order to prevent/discourage external usage, I annotated them with @noreference.

Now the change is fully internal and does not need any new methods in any API (that would need @noreference).

Copy link
Member

@laeubi laeubi left a comment

Choose a reason for hiding this comment

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

Looks good just one thing for the UI I think it must be a radio group with the options:

  • Use Workspace default (
  • Update Automatically
  • Never update automatically

Also from the code it currently looks like if the project has enabled it but it is disabled in the workspace settings no update will ever happen as there is an early exit.

@@ -40,10 +41,10 @@ public class MavenUpdateConfigurationChangeListener implements IResourceChangeLi

@Override
public void resourceChanged(IResourceChangeEvent event) {
if(isDisabled()) {
if(isAutoConfigurationUpdateDisabled()) {
Copy link
Member

Choose a reason for hiding this comment

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

This must be removed or disbaled in the workspace can't be changed by a project.

updateProjectConfiguration(outOfDateProjects);
}

private boolean isDisabled() {
public static boolean isAutoConfigurationUpdateDisabled() {
Copy link
Member

Choose a reason for hiding this comment

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

I would add an IProject parameter here then it could:

  1. Check if there is a project config and if yes choose this one unless it is configured to use the workspace default
  2. fallback to the global default
Suggested change
public static boolean isAutoConfigurationUpdateDisabled() {
public static boolean isAutoConfigurationUpdate(IProject) {

@@ -52,10 +53,12 @@ public void resourceChanged(IResourceChangeEvent event) {
LOG.error("An error occurred while checking for out-of-date configuration markers", e);
return;
}
outOfDateProjects = outOfDateProjects.stream() //
.filter(ResolverConfigurationIO::isAutomaticallyUpdateConfiguration).toList();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.filter(ResolverConfigurationIO::isAutomaticallyUpdateConfiguration).toList();
.filter(MavenConfigurationChangeListener::isAutoConfigurationUpdate).toList();

@HannesWell
Copy link
Contributor Author

Also from the code it currently looks like if the project has enabled it but it is disabled in the workspace settings no update will ever happen as there is an early exit.

That's right and this was actually by design, based on the assumption that this is mainly used to disable specific projects in their preferences and that the corresponding preferences is committed in the SCM.
I assume the other way round is not very common since updates are enabled by default and if one disables them it is probably expected to have a workspace-global effect.

With that in mind I wanted to keep the preferences simple. But the current behavior is already reflected in the project preference since it is disabled, when the workspace preference is disabled:
grafik

@laeubi
Copy link
Member

laeubi commented Feb 4, 2024

I think it depends a bit, e.g. if I have a problem with many projects I might want to have this only on some projects where it works well, or only enable it step by step ... but of course we can add it also if its really a demand it is just that usually project settings take precedence over global settings so this might be a bit of a surprise.

And degrade problems about out-dated project configuration to severity
'info', if automatic updates are disabled for a project.

Fixes eclipse-m2e#1661
@HannesWell HannesWell force-pushed the auto-update-project-preference branch from 07c4386 to 2688bc9 Compare February 4, 2024 12:35
@HannesWell
Copy link
Contributor Author

I think it depends a bit, e.g. if I have a problem with many projects I might want to have this only on some projects where it works well, or only enable it step by step ... but of course we can add it also if its really a demand it is just that usually project settings take precedence over global settings so this might be a bit of a surprise.

In that case, you are right. But I think the current setup is sufficient for most case (I assume in the workspace it is turned on in most cases as it is default) and I would prefer to wait for further enhancements until there is a real demand for it.

@HannesWell HannesWell merged commit c3fa2ed into eclipse-m2e:master Feb 4, 2024
6 of 7 checks passed
@HannesWell HannesWell deleted the auto-update-project-preference branch February 4, 2024 16:16
@HannesWell HannesWell added this to the 2.6.0 milestone Feb 17, 2024
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.

Allow configiration of automatic project updates per project
2 participants