-
Notifications
You must be signed in to change notification settings - Fork 8
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
Better define how lazy task registration and task replacement work together #710
Comments
Whatever we come up with for this should also apply to |
To flesh out the suggestion in the description, we would do something like this: Add a method called
It would also be an error to replace a task using an implementation type that is not compatible:
Given this, every provider created with a given name would then always return the same instance:
And configuration actions would apply to the same instance:
We would start by deprecating using We also have the "overwrite" option on the eager task API. This should end up working the same way as |
As brought up in #644, |
I can start working on this, do we agree with the behaviors explained in this issue? I have no objection. Basically, we deprecate remove entirely, add error case for specific replacement scenario with |
SGTM |
Here is the PR for deprecating all removal method on |
Should the following become an error when task
Right now, it just adds the task to the container. |
The following case cannot work right now because replace return a
|
The removal is almost merged. I'm going away on vacation so I will move this back to the iteration. We agreed that we need another API to replace that is lazy. I suggest deprecating Possible candidate for the new method name:
|
We shouldn't deprecate |
The introduction of the lazy task API gives us an opportunity to improve the mechanism by which tasks are replaced. (Note that "improve" might mean "remove").
Task replacement provides a mechanism whereby build logic can replace an implementation of a task defined by some other build logic with a different implementation. If we want to support this use case, we should move towards making the solution safer, as there are a number of issues with the current approach. The basic cause of these issues is that a task instance observed by some build logic can disappear and be replaced later by a different instance.
We should:
create()
).register()
and whatever API the previous item adds) always return the same instance for a given name.The text was updated successfully, but these errors were encountered: