htmlSanityCheck icon indicating copy to clipboard operation
htmlSanityCheck copied to clipboard

Provide an extension to configure the default task

Open thc202 opened this issue 7 years ago • 3 comments

It's considered best practice to configure the default task through an extension.

This also has the advantage of providing a more similar configuration for Groovy and Kotlin DSLs.

Currently, in Groovy DSL you can simply do:

htmlSanityCheck {
    sourceDir = file("src/main/docs")
}

but in Kotlin DSL you need to be more explicit and get the task, e.g.:

tasks.named<org.aim42.htmlsanitycheck.HtmlSanityCheckTask>("htmlSanityCheck") {
    sourceDir = file("src/main/docs")
}

which is more verbose than the usual/ideal.

It might also be a good opportunity to start using lazy properties and task configuration avoidance.

thc202 avatar Sep 14 '18 22:09 thc202

  • Sorry, I have absolutely no experience in Kotlin :-(
  • The idea of configuring through extension seems nice on first read, but I'm quite sure I won't find time to implement that before October...

I'm open for suggestions on how to proceed here. Is it an urgent issue for you?

again, thanx for your research and contribution

gernotstarke avatar Sep 15 '18 06:09 gernotstarke

This can be implemented in Groovy (the Kotlin DSL is just another consumer), happy to contribute that.

No urgency, just a good to have.

thc202 avatar Sep 19 '18 00:09 thc202

We are currently modularising HSC and therefore reorganising the complete build (cf. #309 and the develop branch of the project). Are you still interested in contributing a respective extension, @thc202? I'd be happy to see a PR.

You seem to be very familiar with Gradle. If you happen to have some time, reviewing the modular build, I'd appreciate any feedback as well.

ascheman avatar Jan 28 '24 15:01 ascheman