Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ node_modules
!.vscode/launch.json
!.vscode/tasks.json
*.vsix
kls_database.db
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
plugins {
kotlin("jvm")
`maven-publish`
id("io.gitlab.arturbosch.detekt") version "1.22.0"
alias(libs.plugins.io.gitlab.arturbosch.detekt)
}

repositories {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ kotlin {
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin")
implementation(libs.org.jetbrains.kotlin.gradle.plugin)
}
8 changes: 8 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}

rootProject.name = "build-conventions"
49 changes: 49 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[versions]
kotlinVersion = "2.1.0"
lsp4jVersion = "0.21.2"
exposedVersion = "0.37.3"
jmhVersion = "1.20"

[libraries]
org-jetbrains-kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlinVersion" }
org-jetbrains-kotlin-compiler = { module = "org.jetbrains.kotlin:kotlin-compiler", version.ref = "kotlinVersion" }
org-jetbrains-kotlin-ktscompiler = { module = "org.jetbrains.kotlin:kotlin-scripting-compiler", version.ref = "kotlinVersion" }
org-jetbrains-kotlin-kts-jvm-host-unshaded = { module = "org.jetbrains.kotlin:kotlin-scripting-jvm-host-unshaded", version.ref = "kotlinVersion" }
org-jetbrains-kotlin-sam-with-receiver-compiler-plugin = { module = "org.jetbrains.kotlin:kotlin-sam-with-receiver-compiler-plugin", version.ref = "kotlinVersion" }

org-jetbrains-kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlinVersion" }
org-jetbrains-kotlin-jvm = { module = "org.jetbrains.kotlin:kotlin-jvm", version.ref = "kotlinVersion" }

org-jetbrains-kotlin-kotlin-scripting-jvm-host = { module = "org.jetbrains.kotlin:kotlin-scripting-jvm-host", version.ref = "kotlinVersion" }

org-eclipse-lsp4j-lsp4j = { module = "org.eclipse.lsp4j:org.eclipse.lsp4j", version.ref = "lsp4jVersion" }
org-eclipse-lsp4j-jsonrpc = { module = "org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc", version.ref = "lsp4jVersion" }

hamcrest-all = { module = "org.hamcrest:hamcrest-all", version = "1.3" }

junit-junit = { module = "junit:junit", version = "4.11" }

org-jetbrains-exposed-core = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposedVersion" }
org-jetbrains-exposed-dao = { module = "org.jetbrains.exposed:exposed-dao", version.ref = "exposedVersion" }
org-jetbrains-exposed-jdbc = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "exposedVersion" }

org-jetbrains-fernflower = { module = "org.jetbrains:fernflower", version = "1.0" }

com-github-fwcd-ktfmt = { module = "com.github.fwcd.ktfmt:ktfmt", version = "b5d31d1" }

com-h2database-h2 = { module = "com.h2database:h2", version = "1.4.200" }

com-beust-jcommander = { module = "com.beust:jcommander", version = "1.78" }

org-openjdk-jmh-generator-annprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmhVersion" }
org-openjdk-jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmhVersion" }

org-xerial-sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version = "3.41.2.1" }

# buildSrc
org-jetbrains-kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin",version.ref = "kotlinVersion" }

[plugins]
com-github-jk1-tcdeps = { id = "com.github.jk1.tcdeps", version = "1.2" }
com-jaredsburrows-license = { id = "com.jaredsburrows.license", version = "0.8.42" }
io-gitlab-arturbosch-detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.22.0" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
60 changes: 24 additions & 36 deletions platform/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,42 +1,30 @@
plugins {
id("java-platform")
}

javaPlatform {
allowDependencies()
}
plugins { id("java-platform") }

val kotlinVersion = "1.9.20"
val exposedVersion = "0.37.3"
val lsp4jVersion = "0.21.2"
javaPlatform { allowDependencies() }

// constrain the dependencies that we use to these specific versions
dependencies {
constraints {
api("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
api("org.hamcrest:hamcrest-all:1.3")
api("junit:junit:4.11")
api("org.eclipse.lsp4j:org.eclipse.lsp4j:$lsp4jVersion")
api("org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc:$lsp4jVersion")
api("org.jetbrains.kotlin:kotlin-compiler:$kotlinVersion")
api("org.jetbrains.kotlin:kotlin-scripting-compiler:$kotlinVersion")
api("org.jetbrains.kotlin:kotlin-scripting-jvm-host-unshaded:$kotlinVersion")
api("org.jetbrains.kotlin:kotlin-sam-with-receiver-compiler-plugin:$kotlinVersion")
api("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
api("org.jetbrains.kotlin:kotlin-jvm:$kotlinVersion")
api("org.jetbrains:fernflower:1.0")
api("org.jetbrains.exposed:exposed-core:$exposedVersion")
api("org.jetbrains.exposed:exposed-dao:$exposedVersion")
api("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
api("com.h2database:h2:1.4.200")
api("com.github.fwcd.ktfmt:ktfmt:b5d31d1")
api("com.beust:jcommander:1.78")
api("org.hamcrest:hamcrest-all:1.3")
api("junit:junit:4.11")
api("org.openjdk.jmh:jmh-core:1.20")
api("org.jetbrains.kotlin:kotlin-scripting-jvm-host:$kotlinVersion")
api("org.jetbrains.kotlin:kotlin-scripting-jvm-host:$kotlinVersion")
api("org.openjdk.jmh:jmh-generator-annprocess:1.20")
api("org.xerial:sqlite-jdbc:3.41.2.1")
api(libs.org.jetbrains.kotlin.stdlib)
api(libs.hamcrest.all)
api(libs.junit.junit)
api(libs.org.eclipse.lsp4j.lsp4j)
api(libs.org.eclipse.lsp4j.jsonrpc)
api(libs.org.jetbrains.kotlin.compiler)
api(libs.org.jetbrains.kotlin.ktscompiler)
api(libs.org.jetbrains.kotlin.kts.jvm.host.unshaded)
api(libs.org.jetbrains.kotlin.sam.with.receiver.compiler.plugin)
api(libs.org.jetbrains.kotlin.reflect)
api(libs.org.jetbrains.kotlin.jvm)
api(libs.org.jetbrains.fernflower)
api(libs.org.jetbrains.exposed.core)
api(libs.org.jetbrains.exposed.dao)
api(libs.org.jetbrains.exposed.jdbc)
api(libs.com.h2database.h2)
api(libs.com.github.fwcd.ktfmt)
api(libs.com.beust.jcommander)
api(libs.org.openjdk.jmh.core)
api(libs.org.jetbrains.kotlin.kotlin.scripting.jvm.host)
api(libs.org.openjdk.jmh.generator.annprocess)
api(libs.org.xerial.sqlite.jdbc)
}
}
72 changes: 32 additions & 40 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ plugins {
kotlin("jvm")
id("maven-publish")
id("application")
id("com.github.jk1.tcdeps")
id("com.jaredsburrows.license")
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")
Expand All @@ -19,9 +19,7 @@ application {
mainClass.set(serverMainClassName)
description = "Code completions, diagnostics and more for Kotlin"
applicationDefaultJvmArgs = listOf("-DkotlinLanguageServer.version=$version")
applicationDistribution.into("bin") {
fileMode = 755
}
applicationDistribution.into("bin") { fileMode = 755 }
}

repositories {
Expand All @@ -40,49 +38,49 @@ dependencies {

implementation(project(":shared"))

implementation("org.eclipse.lsp4j:org.eclipse.lsp4j")
implementation("org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc")
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("org.jetbrains:fernflower")
implementation("org.jetbrains.exposed:exposed-core")
implementation("org.jetbrains.exposed:exposed-dao")
implementation("org.jetbrains.exposed:exposed-jdbc")
implementation("com.h2database:h2")
implementation("com.github.fwcd.ktfmt:ktfmt")
implementation("com.beust:jcommander")
implementation("org.xerial:sqlite-jdbc")

testImplementation("org.hamcrest:hamcrest-all")
testImplementation("junit:junit")
testImplementation("org.openjdk.jmh:jmh-core")

// See https://github.com/JetBrains/kotlin/blob/65b0a5f90328f4b9addd3a10c6f24f3037482276/libraries/examples/scripting/jvm-embeddable-host/build.gradle.kts#L8
implementation(libs.org.jetbrains.fernflower)
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("org.openjdk.jmh:jmh-generator-annprocess")
annotationProcessor(libs.org.openjdk.jmh.generator.annprocess)
}

configurations.forEach { config ->
config.resolutionStrategy {
preferProjectModules()
}
}
configurations.forEach { config -> config.resolutionStrategy { preferProjectModules() } }

tasks.startScripts {
applicationName = "kotlin-language-server"
}
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")
commandLine(
"chmod",
"+x",
"${tasks.installDist.get().destinationDir}/bin/kotlin-language-server"
)
}

tasks.register<JavaExec>("debugRun") {
Expand All @@ -91,9 +89,7 @@ tasks.register<JavaExec>("debugRun") {
standardInput = System.`in`

jvmArgs(debugArgs)
doLast {
println("Using debug port $debugPort")
}
doLast { println("Using debug port $debugPort") }
}

tasks.register<CreateStartScripts>("debugStartScripts") {
Expand All @@ -116,10 +112,6 @@ tasks.withType<Test>() {
}
}

tasks.installDist {
finalizedBy("fixFilePermissions")
}
tasks.installDist { finalizedBy("fixFilePermissions") }

tasks.build {
finalizedBy("installDist")
}
tasks.build { finalizedBy("installDist") }
4 changes: 2 additions & 2 deletions server/src/main/kotlin/org/javacs/kt/compiler/Compiler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private class CompilationEnvironment(

init {
environment = KotlinCoreEnvironment.createForProduction(
parentDisposable = disposable,
projectDisposable = disposable,
// Not to be confused with the CompilerConfiguration in the language server Configuration
configuration = KotlinCompilerConfiguration().apply {
val langFeatures = mutableMapOf<LanguageFeature, LanguageFeature.State>()
Expand Down Expand Up @@ -423,7 +423,7 @@ private class CompilationEnvironment(
}

fun createContainer(sourcePath: Collection<KtFile>): Pair<ComponentProvider, BindingTraceContext> {
val trace = CliBindingTrace()
val trace = CliBindingTrace(environment.project)
val container = TopDownAnalyzerFacadeForJVM.createContainer(
project = environment.project,
files = sourcePath,
Expand Down
21 changes: 0 additions & 21 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,6 @@ pluginManagement {
gradlePluginPortal()
maven("https://cache-redirector.jetbrains.com/kotlin.bintray.com/kotlin-plugin")
}

// Centralize plugin versions.
// Ensure these plugins use the same version from the /gradle/platform/build.gradle.kts
// otherwise you'll get an exception during Gradle's configuration phase
// stating that the plugin with the specified (or unspecified) version
// cannot be found.
//
// Once declared here, subsequent plugin blocks in the build don't require
// a version to be applied. They inherit the versions from the following
// block.
//
// This can be verified by running the dependencies task via
// ./gradlew dependencies
plugins {
id("application") apply false
id("maven-publish") apply false

kotlin("jvm") version "1.8.10" apply false
id("com.github.jk1.tcdeps") version "1.2" apply false
id("com.jaredsburrows.license") version "0.8.42" apply false
}
}

rootProject.name = "kotlin-language-server"
Expand Down
8 changes: 4 additions & 4 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ dependencies {
implementation(platform(project(":platform")))

implementation(kotlin("stdlib"))
implementation("org.jetbrains.exposed:exposed-core")
implementation("org.jetbrains.exposed:exposed-dao")
testImplementation("org.hamcrest:hamcrest-all")
testImplementation("junit:junit")
implementation(libs.org.jetbrains.exposed.core)
implementation(libs.org.jetbrains.exposed.dao)
testImplementation(libs.hamcrest.all)
testImplementation(libs.junit.junit)
}
Loading