Create Source Directories in Gradle 1.0-RC3

I had been using an older version of Gradle and had a task that created the source directories for you.  I recently downloaded Gradle 1.0-RC3, whose API changed enough to break that script.

I’ve come up with the replacement below.

task createSrcDirs() << {
    println "Creating all source sets"
    project.sourceSets.each { sset ->
      def sDirSet = sset.allSource
      // srcDirs is a set of File objects
      sDirSet.srcDirs.each { dir ->
        if (!dir.mkdirs()) {
	  println "** Failed to create: ${dir}"
	}
      }
    }
}
createSrcDirs.description = 'Create all the source directories for a new project.'