Skip to content

Commit 566fd6f

Browse files
committed
Just update regular class path when build script changes
1 parent 2100c1c commit 566fd6f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

server/src/main/kotlin/org/javacs/kt/CompilerClassPath.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,23 @@ class CompilerClassPath(private val config: CompilerConfiguration) : Closeable {
1515
compiler.updateConfiguration(config)
1616
}
1717

18-
private fun refresh() {
18+
private fun refresh(updateBuildScriptClassPath: Boolean = true) {
1919
// TODO: Fetch class path and build script class path concurrently (and asynchronously)
2020
val resolver = defaultClassPathResolver(workspaceRoots)
21-
val newClassPath = resolver.classpathOrEmpty
22-
val newBuildScriptClassPath = resolver.buildScriptClasspathOrEmpty
2321
var refreshCompiler = false
2422

23+
val newClassPath = resolver.classpathOrEmpty
2524
if (newClassPath != classPath) {
2625
syncClassPath(classPath, newClassPath)
2726
refreshCompiler = true
2827
}
2928

30-
if (newBuildScriptClassPath != buildScriptClassPath) {
31-
syncClassPath(buildScriptClassPath, newBuildScriptClassPath)
32-
refreshCompiler = true
29+
if (updateBuildScriptClassPath) {
30+
val newBuildScriptClassPath = resolver.buildScriptClasspathOrEmpty
31+
if (newBuildScriptClassPath != buildScriptClassPath) {
32+
syncClassPath(buildScriptClassPath, newBuildScriptClassPath)
33+
refreshCompiler = true
34+
}
3335
}
3436

3537
if (refreshCompiler) {
@@ -81,7 +83,7 @@ class CompilerClassPath(private val config: CompilerConfiguration) : Closeable {
8183
fun changedOnDisk(file: Path) {
8284
val name = file.fileName.toString()
8385
if (name == "pom.xml" || name == "build.gradle" || name == "build.gradle.kts")
84-
refresh()
86+
refresh(updateBuildScriptClassPath = false)
8587
}
8688

8789
override fun close() {

0 commit comments

Comments
 (0)