SourceSet objects now provide the all_dependencies() method, that complement the existing all_sources() method.
SourceSet
all_dependencies()
all_sources()