Skip to content

Instantly share code, notes, and snippets.

@mononite
Last active December 17, 2015 13:39
Show Gist options
  • Save mononite/5618949 to your computer and use it in GitHub Desktop.
Save mononite/5618949 to your computer and use it in GitHub Desktop.
Create default directory layout for an empty project.
// $ gradle initLayout
// $ gradle initLayout -PapplyPlugins=java,groovy
projectsEvaluated {
rootProject.allprojects {
tasks.withType(Compile) {
options.compilerArgs << "-Xlint:unchecked"
}
if (!tasks.findByName('initLayout')) {
task initLayout(description : 'Create default directory layout') << {
if (project.hasProperty('applyPlugins')) {
applyPlugins.split(',').each { applyPlugin ->
project.apply {
plugin(applyPlugin.trim())
}
}
}
sourceSets*.allSource*.srcDirs.flatten().each { dir ->
println "Create directory $dir"
dir.mkdirs()
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment