Skip to content

SpotlessTask: mark target as task input #461

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

Merged
merged 5 commits into from
Sep 30, 2019

Conversation

rpalcolea
Copy link
Contributor

SpotlessTask: mark target as task input.

This fixes issue in Gradle 6.x with Warning: Type 'com.diffplug.gradle.spotless.SpotlessTask': property 'target' is not annotated with an input or output annotation

@nedtwigg
Copy link
Member

target is not an input on purpose - it is accounted for here:

protected Iterable<File> target;
public Iterable<File> getTarget() {
return target;
}
public void setTarget(Iterable<File> target) {
this.target = Objects.requireNonNull(target);
}
/** Internal use only. */
@InputFiles
@Deprecated
public Iterable<File> getInternalTargetInput() {
return getInternalTarget();
}
/** Internal use only. */
@OutputFiles
@Deprecated
public Iterable<File> getInternalTargetOutput() {
return getInternalTarget();
}
private Iterable<File> getInternalTarget() {
// used to combine the special cache file and the real target
return Iterables.concat(ImmutableList.of(getCacheFile()), target);
}

If you want to fix the warning, I think the right thing is to mark it @Internal.

@rpalcolea
Copy link
Contributor Author

rpalcolea commented Sep 25, 2019

This appears to be a task input from

I got confused by it

596229e changes that

@nedtwigg
Copy link
Member

Yep. Spotless is a weird case because we modify the input (the source code is the input and the output), so we have to do some tricks to make up-to-date checking work.

@nedtwigg
Copy link
Member

The PR is failing because of a formatting error, run spotlessApply ;-)

@rpalcolea
Copy link
Contributor Author

of course! done! thanks @nedtwigg

@nedtwigg nedtwigg merged commit f9cc6a0 into diffplug:master Sep 30, 2019
@rpalcolea rpalcolea deleted the validatePlugin-warning-fix branch September 30, 2019 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants