Ordered SourceSets

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 recommend for ordered sources?