Howto use RegularFileProperty.convention()


in a custom task I have define a file property

open class SomeTask() : DefaultTask() {
    val somePath = project.objects.fileProperty()

I would like to add some convention

open class SomeTask() : DefaultTask() {
    val somePath = project.objects.fileProperty().convention(file("/some/path/here"))

but convention()require RegularFilePropertyas input type.

What is the idiomatic way to define a default value for a fileProperty ?


RegularFileProperty file = project.getObjects().fileProperty()
// If default location is in build/some/path/here, use:
// project.getLayout().getBuildDirectory().file("some/path/here")

Note that API is still incubating, so it might evolve in the upcoming releases.