summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorkaklakariada <kaklakariada@users.noreply.github.com>2016-08-15 18:01:13 +0200
committerkaklakariada <kaklakariada@users.noreply.github.com>2016-08-15 18:01:13 +0200
commit674b5cacd32419d178f3fc545aae0d0d06f01853 (patch)
tree3616f7f65ad70191e954fba812ca29281c0c5a09 /README.md
parent8d99b0ea8ca492149b6582721b0fca2d6d522ebf (diff)
downloadjava-language-server-674b5cacd32419d178f3fc545aae0d0d06f01853.zip
Describe gradle setup
Diffstat (limited to 'README.md')
-rw-r--r--README.md46
1 files changed, 45 insertions, 1 deletions
diff --git a/README.md b/README.md
index a0de394..f64ecfe 100644
--- a/README.md
+++ b/README.md
@@ -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