Skip to content

Commit 92f2c46

Browse files
authored
Merge pull request #605 from Decodetalkers/catelog
use catalog to manager dependencies and bump to the newest kotlin
2 parents 2db4979 + 4c51f63 commit 92f2c46

File tree

11 files changed

+123
-106
lines changed

11 files changed

+123
-106
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ node_modules
2828
!.vscode/launch.json
2929
!.vscode/tasks.json
3030
*.vsix
31+
kls_database.db

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
44
plugins {
55
kotlin("jvm")
66
`maven-publish`
7-
id("io.gitlab.arturbosch.detekt") version "1.22.0"
7+
alias(libs.plugins.io.gitlab.arturbosch.detekt)
88
}
99

1010
repositories {

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ kotlin {
3030
}
3131

3232
dependencies {
33-
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin")
33+
implementation(libs.org.jetbrains.kotlin.gradle.plugin)
3434
}

buildSrc/settings.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1+
dependencyResolutionManagement {
2+
versionCatalogs {
3+
create("libs") {
4+
from(files("../gradle/libs.versions.toml"))
5+
}
6+
}
7+
}
8+
19
rootProject.name = "build-conventions"

gradle/libs.versions.toml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[versions]
2+
kotlinVersion = "2.1.0"
3+
lsp4jVersion = "0.21.2"
4+
exposedVersion = "0.37.3"
5+
jmhVersion = "1.20"
6+
7+
[libraries]
8+
org-jetbrains-kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlinVersion" }
9+
org-jetbrains-kotlin-compiler = { module = "org.jetbrains.kotlin:kotlin-compiler", version.ref = "kotlinVersion" }
10+
org-jetbrains-kotlin-ktscompiler = { module = "org.jetbrains.kotlin:kotlin-scripting-compiler", version.ref = "kotlinVersion" }
11+
org-jetbrains-kotlin-kts-jvm-host-unshaded = { module = "org.jetbrains.kotlin:kotlin-scripting-jvm-host-unshaded", version.ref = "kotlinVersion" }
12+
org-jetbrains-kotlin-sam-with-receiver-compiler-plugin = { module = "org.jetbrains.kotlin:kotlin-sam-with-receiver-compiler-plugin", version.ref = "kotlinVersion" }
13+
14+
org-jetbrains-kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlinVersion" }
15+
org-jetbrains-kotlin-jvm = { module = "org.jetbrains.kotlin:kotlin-jvm", version.ref = "kotlinVersion" }
16+
17+
org-jetbrains-kotlin-kotlin-scripting-jvm-host = { module = "org.jetbrains.kotlin:kotlin-scripting-jvm-host", version.ref = "kotlinVersion" }
18+
19+
org-eclipse-lsp4j-lsp4j = { module = "org.eclipse.lsp4j:org.eclipse.lsp4j", version.ref = "lsp4jVersion" }
20+
org-eclipse-lsp4j-jsonrpc = { module = "org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc", version.ref = "lsp4jVersion" }
21+
22+
hamcrest-all = { module = "org.hamcrest:hamcrest-all", version = "1.3" }
23+
24+
junit-junit = { module = "junit:junit", version = "4.11" }
25+
26+
org-jetbrains-exposed-core = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposedVersion" }
27+
org-jetbrains-exposed-dao = { module = "org.jetbrains.exposed:exposed-dao", version.ref = "exposedVersion" }
28+
org-jetbrains-exposed-jdbc = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "exposedVersion" }
29+
30+
org-jetbrains-fernflower = { module = "org.jetbrains:fernflower", version = "1.0" }
31+
32+
com-github-fwcd-ktfmt = { module = "com.github.fwcd.ktfmt:ktfmt", version = "b5d31d1" }
33+
34+
com-h2database-h2 = { module = "com.h2database:h2", version = "1.4.200" }
35+
36+
com-beust-jcommander = { module = "com.beust:jcommander", version = "1.78" }
37+
38+
org-openjdk-jmh-generator-annprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmhVersion" }
39+
org-openjdk-jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmhVersion" }
40+
41+
org-xerial-sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version = "3.41.2.1" }
42+
43+
# buildSrc
44+
org-jetbrains-kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin",version.ref = "kotlinVersion" }
45+
46+
[plugins]
47+
com-github-jk1-tcdeps = { id = "com.github.jk1.tcdeps", version = "1.2" }
48+
com-jaredsburrows-license = { id = "com.jaredsburrows.license", version = "0.8.42" }
49+
io-gitlab-arturbosch-detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.22.0" }

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

platform/build.gradle.kts

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,30 @@
1-
plugins {
2-
id("java-platform")
3-
}
4-
5-
javaPlatform {
6-
allowDependencies()
7-
}
1+
plugins { id("java-platform") }
82

9-
val kotlinVersion = "1.9.20"
10-
val exposedVersion = "0.37.3"
11-
val lsp4jVersion = "0.21.2"
3+
javaPlatform { allowDependencies() }
124

13-
// constrain the dependencies that we use to these specific versions
145
dependencies {
156
constraints {
16-
api("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
17-
api("org.hamcrest:hamcrest-all:1.3")
18-
api("junit:junit:4.11")
19-
api("org.eclipse.lsp4j:org.eclipse.lsp4j:$lsp4jVersion")
20-
api("org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc:$lsp4jVersion")
21-
api("org.jetbrains.kotlin:kotlin-compiler:$kotlinVersion")
22-
api("org.jetbrains.kotlin:kotlin-scripting-compiler:$kotlinVersion")
23-
api("org.jetbrains.kotlin:kotlin-scripting-jvm-host-unshaded:$kotlinVersion")
24-
api("org.jetbrains.kotlin:kotlin-sam-with-receiver-compiler-plugin:$kotlinVersion")
25-
api("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
26-
api("org.jetbrains.kotlin:kotlin-jvm:$kotlinVersion")
27-
api("org.jetbrains:fernflower:1.0")
28-
api("org.jetbrains.exposed:exposed-core:$exposedVersion")
29-
api("org.jetbrains.exposed:exposed-dao:$exposedVersion")
30-
api("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
31-
api("com.h2database:h2:1.4.200")
32-
api("com.github.fwcd.ktfmt:ktfmt:b5d31d1")
33-
api("com.beust:jcommander:1.78")
34-
api("org.hamcrest:hamcrest-all:1.3")
35-
api("junit:junit:4.11")
36-
api("org.openjdk.jmh:jmh-core:1.20")
37-
api("org.jetbrains.kotlin:kotlin-scripting-jvm-host:$kotlinVersion")
38-
api("org.jetbrains.kotlin:kotlin-scripting-jvm-host:$kotlinVersion")
39-
api("org.openjdk.jmh:jmh-generator-annprocess:1.20")
40-
api("org.xerial:sqlite-jdbc:3.41.2.1")
7+
api(libs.org.jetbrains.kotlin.stdlib)
8+
api(libs.hamcrest.all)
9+
api(libs.junit.junit)
10+
api(libs.org.eclipse.lsp4j.lsp4j)
11+
api(libs.org.eclipse.lsp4j.jsonrpc)
12+
api(libs.org.jetbrains.kotlin.compiler)
13+
api(libs.org.jetbrains.kotlin.ktscompiler)
14+
api(libs.org.jetbrains.kotlin.kts.jvm.host.unshaded)
15+
api(libs.org.jetbrains.kotlin.sam.with.receiver.compiler.plugin)
16+
api(libs.org.jetbrains.kotlin.reflect)
17+
api(libs.org.jetbrains.kotlin.jvm)
18+
api(libs.org.jetbrains.fernflower)
19+
api(libs.org.jetbrains.exposed.core)
20+
api(libs.org.jetbrains.exposed.dao)
21+
api(libs.org.jetbrains.exposed.jdbc)
22+
api(libs.com.h2database.h2)
23+
api(libs.com.github.fwcd.ktfmt)
24+
api(libs.com.beust.jcommander)
25+
api(libs.org.openjdk.jmh.core)
26+
api(libs.org.jetbrains.kotlin.kotlin.scripting.jvm.host)
27+
api(libs.org.openjdk.jmh.generator.annprocess)
28+
api(libs.org.xerial.sqlite.jdbc)
4129
}
4230
}

server/build.gradle.kts

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ plugins {
22
kotlin("jvm")
33
id("maven-publish")
44
id("application")
5-
id("com.github.jk1.tcdeps")
6-
id("com.jaredsburrows.license")
5+
alias(libs.plugins.com.github.jk1.tcdeps)
6+
alias(libs.plugins.com.jaredsburrows.license)
77
id("kotlin-language-server.publishing-conventions")
88
id("kotlin-language-server.distribution-conventions")
99
id("kotlin-language-server.kotlin-conventions")
@@ -19,9 +19,7 @@ application {
1919
mainClass.set(serverMainClassName)
2020
description = "Code completions, diagnostics and more for Kotlin"
2121
applicationDefaultJvmArgs = listOf("-DkotlinLanguageServer.version=$version")
22-
applicationDistribution.into("bin") {
23-
fileMode = 755
24-
}
22+
applicationDistribution.into("bin") { fileMode = 755 }
2523
}
2624

2725
repositories {
@@ -40,49 +38,49 @@ dependencies {
4038

4139
implementation(project(":shared"))
4240

43-
implementation("org.eclipse.lsp4j:org.eclipse.lsp4j")
44-
implementation("org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc")
41+
implementation(libs.org.eclipse.lsp4j.lsp4j)
42+
implementation(libs.org.eclipse.lsp4j.jsonrpc)
43+
4544
implementation(kotlin("compiler"))
4645
implementation(kotlin("scripting-compiler"))
4746
implementation(kotlin("scripting-jvm-host-unshaded"))
4847
implementation(kotlin("sam-with-receiver-compiler-plugin"))
4948
implementation(kotlin("reflect"))
50-
implementation("org.jetbrains:fernflower")
51-
implementation("org.jetbrains.exposed:exposed-core")
52-
implementation("org.jetbrains.exposed:exposed-dao")
53-
implementation("org.jetbrains.exposed:exposed-jdbc")
54-
implementation("com.h2database:h2")
55-
implementation("com.github.fwcd.ktfmt:ktfmt")
56-
implementation("com.beust:jcommander")
57-
implementation("org.xerial:sqlite-jdbc")
58-
59-
testImplementation("org.hamcrest:hamcrest-all")
60-
testImplementation("junit:junit")
61-
testImplementation("org.openjdk.jmh:jmh-core")
62-
63-
// See https://github.com/JetBrains/kotlin/blob/65b0a5f90328f4b9addd3a10c6f24f3037482276/libraries/examples/scripting/jvm-embeddable-host/build.gradle.kts#L8
49+
implementation(libs.org.jetbrains.fernflower)
50+
implementation(libs.org.jetbrains.exposed.core)
51+
implementation(libs.org.jetbrains.exposed.dao)
52+
implementation(libs.org.jetbrains.exposed.jdbc)
53+
implementation(libs.com.h2database.h2)
54+
implementation(libs.com.github.fwcd.ktfmt)
55+
implementation(libs.com.beust.jcommander)
56+
implementation(libs.org.xerial.sqlite.jdbc)
57+
58+
testImplementation(libs.hamcrest.all)
59+
testImplementation(libs.junit.junit)
60+
testImplementation(libs.org.openjdk.jmh.core)
61+
62+
// See
63+
// https://github.com/JetBrains/kotlin/blob/65b0a5f90328f4b9addd3a10c6f24f3037482276/libraries/examples/scripting/jvm-embeddable-host/build.gradle.kts#L8
6464
compileOnly(kotlin("scripting-jvm-host"))
6565
testCompileOnly(kotlin("scripting-jvm-host"))
6666

67-
annotationProcessor("org.openjdk.jmh:jmh-generator-annprocess")
67+
annotationProcessor(libs.org.openjdk.jmh.generator.annprocess)
6868
}
6969

70-
configurations.forEach { config ->
71-
config.resolutionStrategy {
72-
preferProjectModules()
73-
}
74-
}
70+
configurations.forEach { config -> config.resolutionStrategy { preferProjectModules() } }
7571

76-
tasks.startScripts {
77-
applicationName = "kotlin-language-server"
78-
}
72+
tasks.startScripts { applicationName = "kotlin-language-server" }
7973

8074
tasks.register<Exec>("fixFilePermissions") {
8175
// When running on macOS or Linux the start script
8276
// needs executable permissions to run.
8377

8478
onlyIf { !System.getProperty("os.name").lowercase().contains("windows") }
85-
commandLine("chmod", "+x", "${tasks.installDist.get().destinationDir}/bin/kotlin-language-server")
79+
commandLine(
80+
"chmod",
81+
"+x",
82+
"${tasks.installDist.get().destinationDir}/bin/kotlin-language-server"
83+
)
8684
}
8785

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

9391
jvmArgs(debugArgs)
94-
doLast {
95-
println("Using debug port $debugPort")
96-
}
92+
doLast { println("Using debug port $debugPort") }
9793
}
9894

9995
tasks.register<CreateStartScripts>("debugStartScripts") {
@@ -116,10 +112,6 @@ tasks.withType<Test>() {
116112
}
117113
}
118114

119-
tasks.installDist {
120-
finalizedBy("fixFilePermissions")
121-
}
115+
tasks.installDist { finalizedBy("fixFilePermissions") }
122116

123-
tasks.build {
124-
finalizedBy("installDist")
125-
}
117+
tasks.build { finalizedBy("installDist") }

server/src/main/kotlin/org/javacs/kt/compiler/Compiler.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private class CompilationEnvironment(
9999

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

425425
fun createContainer(sourcePath: Collection<KtFile>): Pair<ComponentProvider, BindingTraceContext> {
426-
val trace = CliBindingTrace()
426+
val trace = CliBindingTrace(environment.project)
427427
val container = TopDownAnalyzerFacadeForJVM.createContainer(
428428
project = environment.project,
429429
files = sourcePath,

settings.gradle.kts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,6 @@ pluginManagement {
33
gradlePluginPortal()
44
maven("https://cache-redirector.jetbrains.com/kotlin.bintray.com/kotlin-plugin")
55
}
6-
7-
// Centralize plugin versions.
8-
// Ensure these plugins use the same version from the /gradle/platform/build.gradle.kts
9-
// otherwise you'll get an exception during Gradle's configuration phase
10-
// stating that the plugin with the specified (or unspecified) version
11-
// cannot be found.
12-
//
13-
// Once declared here, subsequent plugin blocks in the build don't require
14-
// a version to be applied. They inherit the versions from the following
15-
// block.
16-
//
17-
// This can be verified by running the dependencies task via
18-
// ./gradlew dependencies
19-
plugins {
20-
id("application") apply false
21-
id("maven-publish") apply false
22-
23-
kotlin("jvm") version "1.8.10" apply false
24-
id("com.github.jk1.tcdeps") version "1.2" apply false
25-
id("com.jaredsburrows.license") version "0.8.42" apply false
26-
}
276
}
287

298
rootProject.name = "kotlin-language-server"

0 commit comments

Comments
 (0)