Another question: let's say you want to configure ...
# community-support
b
Another question: let's say you want to configure a task with a tuple of source folder and filename like:
Copy code
tasks.register<ValidateJsonFiles>("validateJsonFiles") {
    files = listOf(
        layout.projectDirectory.dir("data/recipes") to layout.projectDirectory.dir("schemas/recipes.json"),
        layout.projectDirectory.dir("data/tasks") to layout.projectDirectory.dir("schemas/tasks.json"),
    )
}
what property do I need to use on the task to correctly define inputs/ouptputs?
1
v
Asssuming your
ValidateJsonFiles
is an own task and iirc, you should make a managed type like
DirAndJson
which has
@InputDirectory
on its
dir
property and
@InputFile
on its
json
property and then have
files
be a
ListProperty<DirAndJson>
that is annotated with
@Nested
.
But please test it out, that's just from the top of my head.
b
thank you
just needed to know where to look 🙂
v
The task could also have helper methods that create the
DirAndJson
instances for you, so that you can e. g. do
setFiles(dir to file, dir2 to file2)
and the
setFiles
method then creates the
DirAndJson
instances and adds them to the
files
list
b
yeah, that's what I've got right now as well
👌 1