Introduce lazy tasks except for ktlint #184
Conversation
Release 0.8.1
…ugin into develop
Guess running too many PRs ws too much for the machine. Gradle daemon disappeared. Can someone retry the task please? |
protected abstract void createToolTaskForAndroid(sourceSet) | ||
|
||
protected void configureToolTask(T task) { | ||
sourceFilter.applyTo(task) |
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.
Collected all common functionality here. It is automatically applied to all tool tasks thanks to configureEach
in line 53 above.
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.
LGTM already, a couple of questions.
} | ||
} | ||
|
||
protected final String getToolTaskNameFor(sourceSet) { |
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.
technically this isn't always a sourceset right? maybe we can just called it named
?
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.
Soooo, this was actually only for sourceSet
. Then I realized that FindBugs
needs to be configured per variant because it needs javaCompile
task. I will go over and make sure that naming is consistent.
|
||
class TasksCompat { | ||
|
||
private static boolean IS_GRADLE_MIN_49 = GradleVersion.current() >= GradleVersion.version("4.9") |
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.
nit:
I'd prefer '
over "
💃
protected void configureToolTask(T task) { | ||
sourceFilter.applyTo(task) | ||
task.group = 'verification' | ||
task.exclude '**/*.kt' |
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.
is this ok because this configurator is bound to SourceTask
& CodeQualityExtension
?
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.
Yes, here exclude
method comes from SourceTask
.
Finally finished with lazy tasks except for ktlint.
Ktlint is more challenging since we support multiple versions. That's why we need to resolve tasks to identify.
For Checkstyle, PMD and Findbugs, I've changed
CodeQualityConfigurator
a lot. How we configure tasks is completely redesigned.collectViolations
tasks per sourceSetcollectViolationsVariant
as a meta task to trigger others. This one is also used for variantFilter.Android Lint was easier. Just used
register
instead ofmaybeCreate
. But I had to hold on a flag to make sure that the task is created only once. There is no equivalentmaybeRegister
in Gradle.Detekt is also similar. But now, I've realized that we don't support configuring multiple times. I will do a follow-up to support that.
Notice that the number of tasks configured is the same (only 23)