-
-
Save ArneBab/fe3fcbcab418d99432d8e8fec8c91545 to your computer and use it in GitHub Desktop.
jdee.gradle
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
// use by adding | |
// apply from:'jdee.gradle' | |
// to build.gradle | |
def prj = { project -> | |
"(jdee-project-file-version" (["1.0"]) | |
"(jdee-set-variables" { | |
"'(jdee-compile-option-directory" ([project.sourceSets.main.output.classesDir]) | |
"'(jdee-junit-working-directory" ([project.projectDir]) | |
"'(jdee-compile-option-source" { | |
"'(" (["default"]) | |
} | |
"'(jdee-compile-option-target" { | |
"'(" (["default"]) | |
} | |
"'(jdee-compile-option-command-line-args" { | |
"'(" (["-source"] + ["${project.sourceCompatibility}"]) | |
} | |
"'(jdee-sourcepath" { | |
"'(" ( | |
project.sourceSets.main.allSource.srcDirs | |
+ project.sourceSets.test.allSource.srcDirs) | |
} | |
"'(jdee-global-classpath" { | |
"'(" ( | |
[] + project.sourceSets.main.output.classesDir | |
+ project.sourceSets.test.output.classesDir | |
+ project.sourceSets.main.allSource.srcDirs | |
+ project.sourceSets.test.allSource.srcDirs | |
+ (([] as Set) + project.configurations.compile.getFiles() | |
+ project.configurations.testCompile.getFiles())) | |
} | |
} | |
} | |
projects { | |
task("jdee") << { | |
def output = new File(project.projectDir, "prj.el").newPrintWriter() | |
try { | |
prj.delegate = new NodeBuilder() { | |
def lev = 0 | |
def write = { Object file -> | |
output.print '\n' + ''.padRight(lev, ' ') + "\"${file}\"".tr('\\', '/') | |
} | |
Object createNode(Object name) { | |
output.print '\n' + ''.padRight(lev++, ' ') + name | |
return name | |
} | |
Object createNode(Object name, Object value) { | |
createNode(name) | |
value.each write | |
return name | |
} | |
void nodeCompleted(Object parent, Object child) { | |
output.print ")" | |
lev-- | |
} | |
} | |
prj(project) | |
output.close() | |
} finally { | |
output.flush() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment