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

An extension should never be injected into a task #5

Open
bmuschko opened this issue Aug 5, 2021 · 0 comments
Open

An extension should never be injected into a task #5

bmuschko opened this issue Aug 5, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@bmuschko
Copy link

bmuschko commented Aug 5, 2021

The plugin extension should not be injected into a task implementation. That's bad practice. Instead, the actual properties of interest should be exposed as input/output declarations so that they can be handled by Gradle's incremental build functionality.

In the case of this particular task you should have something like this:

private final Property<Boolean> autoDownload;
private final Property<Boolean> autoUpdate;

...

@Input
public Property<Boolean> getAutoDownload() { ... }

@Input
public Property<Boolean> getAutoUpdate() { ... }
@bmuschko bmuschko changed the title An extension should never be inject into a task An extension should never be injected into a task Aug 5, 2021
@bmvermeer bmvermeer added the enhancement New feature or request label Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants