Last active
December 17, 2015 13:39
-
-
Save mononite/5618949 to your computer and use it in GitHub Desktop.
Create default directory layout for an empty project.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $ 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