I’m using Gradle’s concept of SourceSets as a way to declare JavaScript sources, however, I can’t quite figure out a way to allow sources to be declared in a given order. What I want is something like:
javascript.source {
custom {
js {
srcDir "src/js"
include "file2.js", "file1.js"
}
}
}
to give a collection of files in the order I declared.
I know that I can do this with a FileTree, but I feel like there’s something I’m missing to make this work with declaring SourceSets.
If this isn’t possible, what should I use for ordered sources?
EDIT: Note that I need order-dependence because I’m working with JavaScript.
I can suggest you to try declaring a second
sourceSetcontainingfile1.jsand making your originalsourceSetdepend on it. So roughly:Not sure if this is possible with the plugin that you are using, though. But hope you get the idea.
I guess in a declarative system like Gradle, the only way to specify order is though declaring dependencies between the different parts, and letting Gradle work-out the order for you.