I’m working in a language (SystemVerilog) where the order in which files are compiled is important. For example, if file2
references code from file1
, then file1
has to be compiled first. I’m developing a Gradle plugin for this language.
DSL-wise, I’m not 100% sure how I’d like to configure this. At the moment I’m thinking of something very simple:
sourceSets {
main {
sv {
order {
first 'file1'
}
}
}
}
Even if I had the information needed for ordering, what would be the best way of passing it to the compile task? Currently, the actual set of files is passed using a FileTree
property annotated with @InputFiles
, which for the main source set gets its value from sourceSets.main.sv
.
class SystemVerilogCompile {
@InputFiles
public FileTree getSystemVerilogSource();
// ...
}
A FileCollection
doesn’t have the concept of ordering. Would I need a separate @Input
property for the task, which contains information about the desired ordering? Something like this:
class SystemVerilogCompile {
// ...
@Input
public FileOrder getSystemVerilogFileOrder();
}
FileOrder
would be a custom class that encodes the information passed through the order {}
closure on the source set.
Is this a gradlesque solution? Is there something else already built into Gradle that I could use?