Skip to content

Commit 57d309e

Browse files
committed
WIP: Moved language server code into 'server' module and renamed Gradle project from 'kotlin-language-server' to 'KotlinLanguageServer'
1 parent 9eb52e1 commit 57d309e

File tree

115 files changed

+126
-116
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+126
-116
lines changed

BUILDING.md

Lines changed: 9 additions & 9 deletions

build.gradle

Lines changed: 52 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -9,123 +9,72 @@ buildscript {
99
}
1010

1111
plugins {
12-
id "com.github.jk1.tcdeps" version "0.17"
12+
id 'com.github.jk1.tcdeps' version '0.17' apply false
1313
}
1414

15-
apply plugin: 'kotlin'
16-
apply plugin: 'application'
17-
apply plugin: 'maven'
15+
def rootProjectDir = projectDir
1816

19-
group = 'org.javacs'
20-
version = '0.1.1'
17+
allprojects {
18+
apply plugin: 'kotlin'
19+
apply plugin: 'maven'
20+
apply plugin: 'com.github.jk1.tcdeps'
2121

22-
mainClassName = "org.javacs.kt.MainKt"
23-
description = "Code completions, diagnostics and more for Kotlin"
22+
sourceCompatibility = 1.8
23+
targetCompatibility = 1.8
2424

25-
sourceCompatibility = 1.8
26-
targetCompatibility = 1.8
27-
28-
def debugPort = 8000
29-
def debugArgs = "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n,quiet=y"
30-
31-
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
32-
kotlinOptions {
33-
jvmTarget = "1.8"
25+
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
26+
kotlinOptions {
27+
jvmTarget = "1.8"
28+
}
3429
}
35-
}
3630

37-
repositories {
38-
mavenCentral()
39-
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
40-
teamcityServer {
41-
url = teamCityUrl
42-
credentials {
43-
username = teamCityUsername
44-
password = teamCityPassword
31+
repositories {
32+
mavenCentral()
33+
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
34+
teamcityServer {
35+
url = teamCityUrl
36+
credentials {
37+
username = teamCityUsername
38+
password = teamCityPassword
39+
}
4540
}
4641
}
47-
}
48-
49-
configurations {
50-
kotlinJVMLib
51-
}
52-
53-
dependencies {
54-
def kotlinTeamCity = "$kotlinBuildType:$kotlinBuild:kotlin-plugin-${kotlinPluginBuild}.zip!/Kotlin"
55-
56-
implementation "com.google.guava:guava:21.0"
57-
implementation "org.gradle:gradle-tooling-api:4.3"
58-
implementation "org.eclipse.lsp4j:org.eclipse.lsp4j:0.5.0"
59-
60-
implementation "org.jetbrains.kotlin:kotlin-compiler:$kotlinVersion"
61-
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
62-
kotlinJVMLib tc("$kotlinTeamCity/lib/kotlin-plugin.jar")
63-
kotlinJVMLib tc("$kotlinTeamCity/lib/j2k.jar")
6442

65-
implementation fileTree(dir: "lib", include: ["*.jar"])
66-
implementation fileTree(dir: "lib-kotlin", include: ["*.jar"])
67-
testImplementation "org.hamcrest:hamcrest-all:1.3"
68-
testImplementation "junit:junit:4.10"
69-
testImplementation "org.openjdk.jmh:jmh-core:1.20"
70-
testImplementation "org.jetbrains.kotlin:kotlin-script-runtime:$kotlinVersion"
71-
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:1.20"
72-
}
73-
74-
configurations.all { config ->
75-
config.resolutionStrategy {
76-
preferProjectModules()
43+
configurations {
44+
kotlinJVMLib
7745
}
78-
}
7946

80-
test {
81-
testLogging {
82-
events "failed"
83-
exceptionFormat "short"
47+
dependencies {
48+
def kotlinTeamCity = "$kotlinBuildType:$kotlinBuild:kotlin-plugin-${kotlinPluginBuild}.zip!/Kotlin"
49+
50+
implementation "com.google.guava:guava:21.0"
51+
implementation "org.gradle:gradle-tooling-api:4.3"
52+
implementation "org.eclipse.lsp4j:org.eclipse.lsp4j:0.5.0"
53+
54+
implementation "org.jetbrains.kotlin:kotlin-compiler:$kotlinVersion"
55+
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
56+
kotlinJVMLib tc("$kotlinTeamCity/lib/kotlin-plugin.jar")
57+
kotlinJVMLib tc("$kotlinTeamCity/lib/j2k.jar")
58+
59+
implementation fileTree(dir: "$rootProjectDir/lib", include: ["*.jar"])
60+
implementation fileTree(dir: "$rootProjectDir/lib-kotlin", include: ["*.jar"])
61+
testImplementation "org.hamcrest:hamcrest-all:1.3"
62+
testImplementation "junit:junit:4.10"
63+
testImplementation "org.openjdk.jmh:jmh-core:1.20"
64+
testImplementation "org.jetbrains.kotlin:kotlin-script-runtime:$kotlinVersion"
65+
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:1.20"
8466
}
85-
}
86-
87-
run {
88-
standardInput = System.in
89-
}
90-
91-
task copyKotlinJVMLib(type: Copy) {
92-
from configurations.kotlinJVMLib
93-
into "$projectDir/lib-kotlin"
94-
}
95-
96-
task fixFilePermissions(type: Exec) {
97-
// When running on macOS or Linux the start script
98-
// needs executable permissions to run.
99-
onlyIf { !System.getProperty("os.name").toLowerCase().contains("windows") }
100-
commandLine 'chmod', '+x', 'build/install/kotlin-language-server/bin/kotlin-language-server'
101-
}
10267

103-
task debugRun(type: JavaExec) {
104-
main = mainClassName
105-
classpath sourceSets.main.runtimeClasspath
106-
standardInput = System.in
107-
108-
println "Configured debugPort to $debugPort"
109-
jvmArgs debugArgs
110-
}
111-
112-
task debugStartScripts(type: CreateStartScripts) {
113-
applicationName = startScripts.applicationName
114-
mainClassName = startScripts.mainClassName
115-
outputDir = installDist.destinationDir.toPath().resolve('bin').toFile()
116-
classpath = startScripts.classpath
117-
defaultJvmOpts = [debugArgs]
118-
}
68+
configurations.all { config ->
69+
config.resolutionStrategy {
70+
preferProjectModules()
71+
}
72+
}
11973

120-
task installDebugDist(type: Sync) {
121-
dependsOn installDist
122-
finalizedBy debugStartScripts
123-
}
74+
task copyKotlinJVMLib(type: Copy) {
75+
from configurations.kotlinJVMLib
76+
into "$rootProjectDir/lib-kotlin"
77+
}
12478

125-
applicationDistribution.into('bin') {
126-
fileMode = 0755
79+
compileKotlin.dependsOn copyKotlinJVMLib
12780
}
128-
129-
compileKotlin.dependsOn copyKotlinJVMLib
130-
installDist.finalizedBy fixFilePermissions
131-
build.finalizedBy installDist

server/build.gradle

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
plugins {
2+
id 'application'
3+
}
4+
5+
group = 'org.javacs'
6+
version = '0.1.1'
7+
8+
mainClassName = 'org.javacs.kt.MainKt'
9+
description = 'Code completions, diagnostics and more for Kotlin'
10+
11+
def debugPort = 8000
12+
def debugArgs = '-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n,quiet=y'
13+
14+
applicationDistribution.into('bin') {
15+
fileMode = 0755
16+
}
17+
18+
task fixFilePermissions(type: Exec) {
19+
// When running on macOS or Linux the start script
20+
// needs executable permissions to run.
21+
onlyIf { !System.getProperty("os.name").toLowerCase().contains("windows") }
22+
commandLine 'chmod', '+x', "${project.buildDir}/install/KotlinLanguageServer/bin/KotlinLanguageServer"
23+
}
24+
25+
task debugRun(type: JavaExec) {
26+
main = mainClassName
27+
classpath sourceSets.main.runtimeClasspath
28+
standardInput = System.in
29+
30+
println "Configured debugPort to $debugPort"
31+
jvmArgs debugArgs
32+
}
33+
34+
task debugStartScripts(type: CreateStartScripts) {
35+
applicationName = startScripts.applicationName
36+
mainClassName = startScripts.mainClassName
37+
outputDir = installDist.destinationDir.toPath().resolve('bin').toFile()
38+
classpath = startScripts.classpath
39+
defaultJvmOpts = [debugArgs]
40+
}
41+
42+
task installDebugDist(type: Sync) {
43+
dependsOn installDist
44+
finalizedBy debugStartScripts
45+
}
46+
47+
run {
48+
standardInput = System.in
49+
}
50+
51+
test {
52+
testLogging {
53+
events "failed"
54+
exceptionFormat "short"
55+
}
56+
}
57+
58+
installDist.finalizedBy fixFilePermissions
59+
build.finalizedBy installDist

0 commit comments

Comments
 (0)