-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Gradle configuration cache support #307
Comments
Hello, thank you for reporting this! 👍 I spent a long time reading the documentation and trying to understand what exactly should be done. I'm not sure we are able to satisfy all the requirements 😢 E.g. Do you please have any idea how to overcome this? 🙏 |
I've probably got it. The tasks shouldn't depend on the extension but a type that contains a subset of the properties (excluding tasks). The main point for me is that the cache root is a Task so we must ensure the task is serializable. |
Yes, you got it right. Each task and all types that it holds should be serializable and it's state should be small (granular) as much as possible. |
@ALikhachev My idea is that I will use |
@augi, this is correct and the way to go! |
@eskatos Thank you for the confirmation! 👍 I will try to perform this refactoring during the next few weeks, so if this is critical for someone, any PR is welcomed 🙏 |
Given the configuration cache adds more strictness to how plugins must be implemented, it is a good measure to always enable it in your integration tests. That way you can be confident your plugin works both without and with CC and you don't break the support going forward. But I only found |
I use the following as a workaround for now:
|
@vmiliantsei Are you sure your workaround works fine? You are accessing Project#getTasks at execution time which will lead to NPE ( The first build probably passes fine due to lack of Groovy scripts validations in terms of configuration cache. |
@ALikhachev, sorry, seems like I confused cache with the incremental build. I needed services to not start if test is |
@augi, it's great you took steps in the right direction. Any plans on going further and to split the extension in order to remove cross-task references? |
@eskatos There is still one thing that I don't know how to resolve 😢 The tasks use an instance of ComposeExecutor class. The instance is created just once, in the extension, and the tasks are using it via the extension. I don't know how to handle the lifestyle of this class instance and ensure that tasks are serializable. E.g. how exactly the tasks is deserialized, if there is an extension point where we could create a new instance of the It would be OK to have a new instance of this class for each task, but it would lead to small performance degradation because this cache wouldn't be so efficient. |
This sounds like a good candidate for a shared build service https://docs.gradle.org/current/userguide/build_services.html.
Another approach would be to move the computation of the compose version to a task, write it's output to a file and then consume that from the tasks that need it. |
Reading all the environment variables at configuration time leads to marking each of them as configuration cache input, so Gradle will detect value changes and invalidate cache on any irrelevant variable value change avast#307
Reading all the environment variables at configuration time leads to marking each of them as configuration cache input, so Gradle will detect value changes and invalidate cache on any irrelevant variable value change #307
The plugin currently doesn't support Gradle configuration cache feature that aims to improve build performance by caching configured task graph. There're a bunch of limitations of what tasks can use and/or capture: https://docs.gradle.org/current/userguide/configuration_cache.html
The text was updated successfully, but these errors were encountered: