Created
April 4, 2012 13:54
-
-
Save makotan/2301257 to your computer and use it in GitHub Desktop.
build.gradle でsrc系のディレクトリと.gitignoreを作成するタスク
This file contains hidden or 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
version = '0.1-SNAPSHOT' | |
group = 'foo.bar' | |
task init << { | |
def ignores = ["/.*","/build","/lib","/bin","/repo" | |
,"/gradle*","!gradle","!gradle.bat" | |
,"target","/out","/logs","/log","/bin" | |
,"*.iml","*.ipr","*.iws",".idea" | |
,".DS_Store" | |
] | |
def ignoreFile = file(".gitignore") | |
if(ignoreFile.canRead()) { | |
ignores = ignores - ignoreFile.readLines() | |
} | |
ignores.each {ignoreFile.append("$it\n") } | |
file('logs').mkdirs() | |
} | |
subprojects { | |
apply plugin: 'java' | |
apply plugin: 'scala' | |
apply plugin: 'idea' | |
group = parent.group | |
versionnn = parent.version | |
// プロジェクトディレクトリの作成 | |
task createBuilds(dependsOn: init) << { | |
projectDir.mkdirs() | |
def buildFile = file("$projectDir.absolutePath/build.gradle") | |
if(buildFile.canRead() == false) { | |
buildFile.createNewFile() | |
} | |
} | |
// srcディレクトリの作成 | |
task createDirs(dependsOn: createBuilds) << { | |
if(childProjects.size() == 0) { | |
sourceSets*.allSource.srcDirs.each { for(dir in it) { dir.mkdirs() } } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
settings.gradle
include 'prj1', 'prj2' , 'libs:p1'