serenity-bdd / serenity-gradle-plugin

Apache License 2.0
1 stars 11 forks source link

fix: recreate services instances (Fixes #9) #11

Closed gallardo closed 2 years ago

gallardo commented 2 years ago

Due to gradle starting by default as daemon and many services configured guice singletons, configuration is read only on first gradle run. If these services are not explicitly reset, serenity configuration changes are ignored on subsequent gradle runs.

This commit fixes https://github.com/serenity-bdd/serenity-gradle-plugin/issues/9. It instructs guice to recreate many of these services when they are requested instead of reusing them.

gallardo commented 2 years ago

Notice that this is a workaround and that it would be probably better if we used guice scopes to control the lifecycle of the instances.

I also have to admit that I couldn't understand the code to the point where I could have proposed a more performant solution. Recreating all these instances each time they are needed will have an impact on big projects.

gallardo commented 2 years ago

Important: this commit requires https://github.com/serenity-bdd/serenity-core/commit/c2bcb25828a4c036a1f56a7cd90b838da8947cf5, but this commit is currently only in master.

gallardo commented 2 years ago

I'm experiencing more issues with this PR. I'm closing it for the moment until I see it clearer.