-
Notifications
You must be signed in to change notification settings - Fork 50
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
Documentation wrong on customizing tasks #251
Comments
Can you point which Kotlin example is labelled as Groovy? 🤔 By "configuring tasks" do you mean Customizing tasks, Custom tasks or Configuration?
I see 2 usages of Can you share which Kotlin DSL examples don't work for you? |
I was referring to Customizing tasks. I could not get tasks.taskName { } to work and not sure how you could make that work in Kotlin. As far as groovy you don't need to use named, you can just do taskName { }. The use of named in the groovy example made me think that was actually Kotlin as that is what you often have to do with Kotlin. Unfortunately, I was just trying to switch from our hand done ktlint invocation to one of the plugins, but I could not get any of them to filter worth a darn and could not exclude some generated and third party source code from being linted. |
Actually, you shouldn't use I tried the you can even see the extension implementation I was referring to: You probably want to verify you configured Kotlin DSL correctly and if you're passing the right task name 👀 tasks.withType<LintTask>().configureEach {
experimentalRules.set(true) // or any other config
}
tasks.withType<FormatTask>().configureEach {
experimentalRules.set(true) // or any other config
} |
Thanks for the answers @mateuszkwiecinski and hopefully that worked for you @dalewking Regarding:
There are some good notes on how to do that here. tasks.named("lintKotlinMain") {
source = source - fileTree("$buildDir/generated")
}
tasks.named("formatKotlinMain") {
source = source - fileTree("$buildDir/generated")
} |
In fact, really ought to update our docs to include that note on additional exclude styles 🤔 |
Tested and determined readme has correct syntax here. |
so, in order to make Jeremy's code work, I had to explicitly cast |
Oh, interesting. I thought I tested it, but feel free to issue a PR against the Readme if it needs a correction and you have the syntax working. |
After reviewing @mateuszkwiecinski's post again, here's where I ended up:
I had to do the final call to |
The groovy and kotlin examples for configuring tasks are labeled backwards, the one labeled kotlin is groovy and vice versa.
Also for the kotlin example (incorrectly labeled as groovy) tasks.named is going to need a type parameter unless you are just using basic task properties like enabled.
The text was updated successfully, but these errors were encountered: