-
Notifications
You must be signed in to change notification settings - Fork 250
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
119 lines (96 loc) · 4.03 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
119 lines (96 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
plugins {
kotlin("jvm")
id("maven-publish")
id("application")
alias(libs.plugins.com.github.jk1.tcdeps)
alias(libs.plugins.com.jaredsburrows.license)
id("kotlin-language-server.publishing-conventions")
id("kotlin-language-server.distribution-conventions")
id("kotlin-language-server.kotlin-conventions")
}
val serverDebugPort = 4000
val debugPort = 8000
val debugArgs = "-agentlib:jdwp=transport=dt_socket,server=y,address=$debugPort,suspend=n,quiet=y"
val serverMainClassName = "org.javacs.kt.MainKt"
val applicationName = "kotlin-language-server"
application {
mainClass.set(serverMainClassName)
description = "Code completions, diagnostics and more for Kotlin"
applicationDefaultJvmArgs = listOf("-DkotlinLanguageServer.version=$version")
applicationDistribution.into("bin") { filePermissions { unix("755".toInt(radix = 8)) } }
}
repositories {
maven(url = "https://repo.gradle.org/gradle/libs-releases")
maven("https://jitpack.io")
maven(url = "https://www.jetbrains.com/intellij-repository/releases")
mavenCentral()
}
dependencies {
// dependencies are constrained to versions defined
// in /platform/build.gradle.kts
implementation(platform(project(":platform")))
annotationProcessor(platform(project(":platform")))
implementation(project(":shared"))
implementation(libs.org.eclipse.lsp4j.lsp4j)
implementation(libs.org.eclipse.lsp4j.jsonrpc)
implementation(kotlin("compiler"))
implementation(kotlin("scripting-compiler"))
implementation(kotlin("scripting-jvm-host-unshaded"))
implementation(kotlin("sam-with-receiver-compiler-plugin"))
implementation(kotlin("reflect"))
implementation(libs.com.jetbrains.intellij.java.decompiler)
implementation(libs.org.jetbrains.exposed.core)
implementation(libs.org.jetbrains.exposed.dao)
implementation(libs.org.jetbrains.exposed.jdbc)
implementation(libs.com.h2database.h2)
implementation(libs.com.github.fwcd.ktfmt)
implementation(libs.com.beust.jcommander)
implementation(libs.org.xerial.sqlite.jdbc)
testImplementation(libs.hamcrest.all)
testImplementation(libs.junit.junit)
testImplementation(libs.org.openjdk.jmh.core)
// See
// https://github.com/JetBrains/kotlin/blob/65b0a5f90328f4b9addd3a10c6f24f3037482276/libraries/examples/scripting/jvm-embeddable-host/build.gradle.kts#L8
compileOnly(kotlin("scripting-jvm-host"))
testCompileOnly(kotlin("scripting-jvm-host"))
annotationProcessor(libs.org.openjdk.jmh.generator.annprocess)
}
configurations.forEach { config -> config.resolutionStrategy { preferProjectModules() } }
tasks.startScripts { applicationName = "kotlin-language-server" }
tasks.register<Exec>("fixFilePermissions") {
// When running on macOS or Linux the start script
// needs executable permissions to run.
onlyIf { !System.getProperty("os.name").lowercase().contains("windows") }
commandLine(
"chmod",
"+x",
"${tasks.installDist.get().destinationDir}/bin/kotlin-language-server",
)
}
tasks.register<JavaExec>("debugRun") {
mainClass.set(serverMainClassName)
classpath(sourceSets.main.get().runtimeClasspath)
standardInput = System.`in`
jvmArgs(debugArgs)
args(listOf("--tcpServerPort", serverDebugPort, "--level", "trace", "--tcpDebug"))
doLast { println("Using debug port $debugPort") }
}
tasks.register<CreateStartScripts>("debugStartScripts") {
applicationName = "kotlin-language-server"
mainClass.set(serverMainClassName)
outputDir = tasks.installDist.get().destinationDir.toPath().resolve("bin").toFile()
classpath = tasks.startScripts.get().classpath
defaultJvmOpts = listOf(debugArgs)
}
tasks.register<Sync>("installDebugDist") {
dependsOn("installDist")
finalizedBy("debugStartScripts")
}
tasks.withType<Test>() {
testLogging {
events("failed")
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
tasks.installDist { finalizedBy("fixFilePermissions") }
tasks.build { finalizedBy("installDist") }