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

PitestAggregator doesn't pick up all reports in a multi module project #344

Open
NikolayMetchev opened this issue Jul 5, 2023 · 10 comments

Comments

@NikolayMetchev
Copy link

I tried to use the aggregator plugin and it just pulled in 1 submodule instead of everything. It seems the aggregator plugin runs too early.
Not sure if Gradle 8.2 is the problem of if the aggregator is just broken. I have a hacky patch that makes it work locally for me:

Fix_PitestAggregatorPlugin.patch

Perhaps you can make it work in some other way, but as it stands now the aggregator plugin doesn't work for me.

@szpak
Copy link
Owner

szpak commented Jul 5, 2023

Hmm, we have smoke tests for the aggregator functionality and - in general - it should work. The tests (currently) are not executed with Gradle 8.2, so it might be broken. However, could you downgrade to Gradle to 8.0 or 7.x to check if it is still broken in your project? Maybe there is something else problematic with your project configuration?

@NikolayMetchev
Copy link
Author

Please find attached a reproducer.
If you run

 ./gradlew clean pitestReportAggregate --no-configuration-cache --no-build-cache

It will only aggregate the common project and not the alerts-core project.

messaging-pitest-bug.tar.gz

@szpak
Copy link
Owner

szpak commented Jul 12, 2023

Thanks. I will take a look.

@szpak
Copy link
Owner

szpak commented Jul 21, 2023

I was able to reproduce the problem and you were right about the reason. I will try to find some "less hacky" fix for that.

@NikolayMetchev
Copy link
Author

Any news here?

szpak added a commit that referenced this issue Sep 20, 2023
Just a useful leftover after debugging the issue which still is not solved.
@NikolayMetchev
Copy link
Author

@szpak any luck with a proper fix?

@szpak
Copy link
Owner

szpak commented Oct 18, 2023

@NikolayMetchev Unfortunately, not. I confirmed the reason (thanks to your sample project!) and even improved the logging to more clearly see that the properties are not set, but I don't have a look idea how to fix it in the prettier :-/.

@Vampire You often have some good ideas about Gradle shortcomings. Maybe you have any proposal for the patch proposed in the issue description could be improved (there is even a reproducer in the 3rd)?

@NikolayMetchev
Copy link
Author

Any chance you can apply the hacky patch and create a new issue to clean it up later?

I'm surprised this works for anyone. Not sure what my reproducer is doing that other people will not.

@Vampire
Copy link
Contributor

Vampire commented Oct 19, 2023

afterEvaluate is evil in almost all situations. Is most often just doing symptom treatment, shifting problems to a later, more hard to reproduce, more hard to find, and more hard to debug and fix point in time. It is like using SwingUtilities.invokeLater or Platform.runLater to "fix" a GUI problem. The main effect of using afterEvaluate is introducing ordering problems, timing problems, and race conditions. There are very little cases where it is necessary to mitigate some still existing shortcomings.

From a cursory look over that plugin class, the problem is not a Gradle shortcoming, but misusage. You use unsafe cross-project publication, and also access the model of the other projects in the build. Both are highly problematic and even afterEvaluate could fail to fully help.

At https://docs.gradle.org/current/userguide/cross_project_publications.html you can find how to properly do cross-project publication. You can also have a look at the two aggregator plugins that are built-in to Gradle. Those are also using this technique, publishing feature variants with the necessary things and then depending on those in the aggregator project.

@NikolayMetchev NikolayMetchev changed the title PitestAggregator doesn't work with Gradle 8.2 PitestAggregator doesn't pick up all reports in a multi module project Oct 23, 2023
@NikolayMetchev
Copy link
Author

@szpak any chance this will be looked at? Is my hacky solution possible until you fix it properly?

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

3 participants