Files
prog8/languageServer/build.gradle.kts
T

119 lines
2.8 KiB
Kotlin

plugins {
kotlin("jvm")
id("application")
id("com.peterabeles.gversion") version "1.11.0"
}
val debugPort = 8000
val debugArgs = "-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n,quiet=y"
val serverMainClassName = "prog8lsp.MainKt"
val applicationName = "prog8-language-server"
application {
mainClass.set(serverMainClassName)
description = "Code completions, diagnostics and more for Prog8"
applicationDistribution.into("bin") {
filePermissions {
user {
read=true
execute=true
write=true
}
other.execute = true
group.execute = true
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.eclipse.lsp4j:org.eclipse.lsp4j:1.0.0")
implementation("org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc:1.0.0")
implementation(project(":compilerAst"))
implementation(project(":codeCore"))
implementation(project(":parser"))
// Test dependencies - Kotest BOM is provided by root build.gradle.kts
testImplementation("io.kotest:kotest-runner-junit5")
}
configurations.forEach { config ->
config.resolutionStrategy {
preferProjectModules()
}
}
// Generate version file like the compiler module does
gversion {
srcDir = "src/"
classPackage = "prog8.buildversion"
className = "Version"
language = "kotlin"
debug = false
annotate = ""
}
tasks.compileKotlin {
dependsOn(tasks.createVersionFile)
}
tasks.compileTestKotlin {
dependsOn(tasks.createVersionFile)
}
sourceSets {
main {
java.srcDir("src")
resources.srcDir("resources")
}
}
tasks.startScripts {
applicationName = "prog8-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/prog8-language-server")
}
tasks.register<JavaExec>("debugRun") {
mainClass.set(serverMainClassName)
classpath(sourceSets.main.get().runtimeClasspath)
standardInput = System.`in`
jvmArgs(debugArgs)
doLast {
println("Using debug port $debugPort")
}
}
tasks.register<CreateStartScripts>("debugStartScripts") {
applicationName = "prog8-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.installDist {
finalizedBy("fixFilePermissions")
}
tasks.build {
finalizedBy("installDist")
}