-
Notifications
You must be signed in to change notification settings - Fork 5k
Annotate remaining Project-scoped services #32646
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
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The following builds have failed: |
@bot-gradle test without pts |
This comment has been minimized.
This comment has been minimized.
The following builds have passed: |
import java.io.File; | ||
|
||
@ServiceScope(Scope.Project.class) | ||
public class DefaultProjectLayout implements ProjectLayout, TaskFileVarFactory { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be dropped if we registered ProjectLayout
as the service?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already register it as a service. The current reason is due to DefaultProject
injecting the implementation, rather than the interfaces:
gradle/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java
Line 1001 in e05529f
public abstract DefaultProjectLayout getLayout(); |
It seems, this is only due to the need to do DefaultProjectLayout#setBuildDirectory
, which according to the comment should go away:
Lines 126 to 131 in fb8cc20
/** | |
* A temporary home. Should be on the public API somewhere | |
*/ | |
public void setBuildDirectory(Object value) { | |
buildDir.set(fileResolver.resolve(value)); | |
} |
It's a nice catch, I'll fix it in a follow-up to avoid mixing non-trivial changes to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the follow-up. It resolved your question, but also uncovered more questions about the buildDirectory setter
Annotates remaining Project-scope services and makes the Project-scope service registry strictly requiring the annotations.
Follows up after #32636