diff options
author | kaklakariada <kaklakariada@users.noreply.github.com> | 2016-08-15 18:01:13 +0200 |
---|---|---|
committer | kaklakariada <kaklakariada@users.noreply.github.com> | 2016-08-15 18:01:13 +0200 |
commit | 674b5cacd32419d178f3fc545aae0d0d06f01853 (patch) | |
tree | 3616f7f65ad70191e954fba812ca29281c0c5a09 /README.md | |
parent | 8d99b0ea8ca492149b6582721b0fca2d6d522ebf (diff) | |
download | java-language-server-674b5cacd32419d178f3fc545aae0d0d06f01853.zip |
Describe gradle setup
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 46 |
1 files changed, 45 insertions, 1 deletions
@@ -105,7 +105,51 @@ Ignore `classpath.txt`, since it will be different on every host classpath.txt ... - + +### Gradle + +Add this to your `build.gradle`: + +```gradle +task vscodeClasspathFile { + description 'Generates classpath file for the Visual Studio Code java plugin' + ext.destFile = file("$buildDir/classpath.txt") + outputs.file destFile + doLast { + def classpathString = configurations.compile.collect{ it.absolutePath }.join(':') + assert destFile.parentFile.mkdir() + destFile.text = classpathString + } +} + +task vscodeJavaconfigFile(dependsOn: vscodeClasspathFile) { + description 'Generates javaconfig.json file for the Visual Studio Code java plugin' + + def relativePath = { File f -> + f.absolutePath - "${project.rootDir.absolutePath}/" + } + ext.destFile = file("javaconfig.json") + ext.config = [ + sourcePath: sourceSets.collect{ it.java.srcDirs }.flatten().collect{ relativePath(it) }, + classPathFile: relativePath(tasks.getByPath(':vscodeClasspathFile').outputs.files.singleFile), + outputDirectory: relativePath(new File(buildDir, 'vscode-classes')) + ] + doLast { + def jsonContent = groovy.json.JsonOutput.toJson(ext.config) + destFile.text = groovy.json.JsonOutput.prettyPrint(jsonContent) + } +} + +task vscode(dependsOn: vscodeJavaconfigFile) { + description 'Generates config files for the Visual Studio Code java plugin' + group 'vscode' +} +``` + +Then run `gradlew vscode`. This will generate +* `javaconfig.json` +* `build/classpath.txt` + ## Directory structure ### Java service process |