Custom Default SourceSets for Components

software-model

(Dan Nguyen) #1

So I’ve been using a Mutate rule to add tasks whenever my component and sourceset are modeled properly together.

model {
components {
comp(CustomComponent) {
sources {
src(CustomSourceSet)
}
}
}

That works fine, but I would like to have the sourceset definition be optional. Is there a right way to do this? I currently have it working where if the ‘src’ sourceset does not exist in the component, to check if the src directory exists, and then create the task with the src directory without needing to create a sourceset in the model