Skip to content

Instantly share code, notes, and snippets.

@ivv-private
Last active September 2, 2018 11:22
Show Gist options
  • Save ivv-private/6053761 to your computer and use it in GitHub Desktop.
Save ivv-private/6053761 to your computer and use it in GitHub Desktop.
jdee.gradle
def prj = { project ->
"(jde-project-file-version" (["1.0"])
"(jde-set-variables" {
"'(jde-compile-option-directory" ([project.sourceSets.main.output.classesDir])
"'(jde-junit-working-directory" ([project.projectDir])
"'(jde-compile-option-source" {
"'(" (["default"])
}
"'(jde-compile-option-target" {
"'(" (["default"])
}
"'(jde-compile-option-command-line-args" {
"'(" (["-${project.sourceCompatibility}"])
}
"'(jde-sourcepath" {
"'(" (
project.sourceSets.main.allSource.srcDirs
+ project.sourceSets.test.allSource.srcDirs)
}
"'(jde-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()))
}
}
}
subprojects {
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