Martin
01/28/2025, 8:33 AM@InputDirectory
: https://mbonnin.net/2025-01-22_input_directory_is_a_lie/Vampire
01/28/2025, 9:52 AMMartin
01/28/2025, 9:56 AMMartin
01/28/2025, 9:57 AMVampire
01/28/2025, 9:58 AMVampire
01/28/2025, 9:58 AMMartin
01/28/2025, 10:00 AMMartin
01/28/2025, 10:01 AMVampire
01/28/2025, 10:02 AMVampire
01/28/2025, 10:02 AMVampire
03/06/2025, 12:25 AMThere might be a proper use case for input directories, but I havenβt found one yet. If someone finds one, please reach out!Reaching out. π I have a task. This task gets a directory configured. It does not do anything with that directory itself directly, but just passes on the directory to a 3rd party tool. So the property is a
DirectoryProperty
with @InputDirectory
.
Or do you see any problems or objections there too?Martin
03/06/2025, 9:42 AM@get:InputFiles
val sourceFiles: ConfigurableFileCollection
// Absolute path to the base folder containing all the files in sourceFiles
@get:Internal
val root: String
Martin
03/06/2025, 9:44 AMVampire
03/06/2025, 9:44 AMMartin
03/06/2025, 9:45 AM*.foo
files, you can add an include pattern to sourceFiles
and avoid task reruns if something irrelevant changes inside your directoryMartin
03/06/2025, 9:45 AMVampire
03/06/2025, 9:45 AMVampire
03/06/2025, 9:46 AMVampire
03/06/2025, 9:46 AMMartin
03/06/2025, 9:47 AM@DirectoryProperty
@InputDirectory
is fine but in the grand scheme of things, I'd say the extra overhead and footguns introduced by @DirectoryProperty
Vampire
03/06/2025, 9:47 AM@InputDirectory
πMartin
03/06/2025, 9:47 AMVampire
03/06/2025, 9:48 AMMartin
03/06/2025, 9:49 AMVampire
03/06/2025, 9:50 AMMartin
03/06/2025, 9:51 AMMartin
03/06/2025, 9:51 AMVampire
03/06/2025, 9:51 AMMartin
03/06/2025, 9:53 AM@get:InputDirectory
@get:PathSensitivity(NAME) // Does that apply to the directory path? Or the contents of the directory?
val dir: DirectoryProperty
Vampire
03/06/2025, 9:53 AMMartin
03/06/2025, 9:54 AMVampire
03/06/2025, 9:54 AMVampire
03/06/2025, 9:56 AMSo what is Fop doesn't care about the relative local path of the .fo files from their base dir? How do you express that?That's a big "IF" that hides as "is", because the path is relevant π
Martin
03/06/2025, 9:58 AMVampire
03/06/2025, 9:58 AMMartin
03/06/2025, 9:58 AMMartin
03/06/2025, 9:58 AMVampire
03/06/2025, 9:59 AMMartin
03/06/2025, 9:59 AMMartin
03/06/2025, 10:00 AMVampire
03/06/2025, 10:00 AMVampire
03/06/2025, 10:01 AMVampire
03/06/2025, 10:01 AMMartin
03/06/2025, 10:02 AMMartin
03/06/2025, 10:04 AM@InputDirectory
saves you a few lines because you satisfy all the conditions (all the files in the input are used and their relative path is used as well).
In terms of API design, I still believe it's a bit of a niche API that is easy to misuse and adds mental load for no real benefit. The same thing can be achieved with @ConfigurableFileCollection
.Martin
03/06/2025, 10:05 AMConfigurableFileCollection
to determine if it is "rooted". This would remove the need for @Internal
completelyVampire
03/06/2025, 10:06 AMVampire
03/06/2025, 10:06 AMMartin
03/06/2025, 10:07 AM