Skip to content

Commit 38d478c

Browse files
committed
Honor disabled script support in compiler
1 parent b223561 commit 38d478c

File tree

5 files changed

+317
-276
lines changed

5 files changed

+317
-276
lines changed

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ import java.nio.file.Path
1515
* Manages the class path (compiled JARs, etc), the Java source path
1616
* and the compiler. Note that Kotlin sources are stored in SourcePath.
1717
*/
18-
class CompilerClassPath(private val config: CompilerConfiguration, private val databaseService: DatabaseService) : Closeable {
18+
class CompilerClassPath(
19+
private val config: CompilerConfiguration,
20+
private val scriptsConfig: ScriptsConfiguration,
21+
private val databaseService: DatabaseService
22+
) : Closeable {
1923
val workspaceRoots = mutableSetOf<Path>()
2024

2125
private val javaSourcePath = mutableSetOf<Path>()
@@ -24,7 +28,13 @@ class CompilerClassPath(private val config: CompilerConfiguration, private val d
2428
val outputDirectory: File = Files.createTempDirectory("klsBuildOutput").toFile()
2529
val javaHome: String? = System.getProperty("java.home", null)
2630

27-
var compiler = Compiler(javaSourcePath, classPath.map { it.compiledJar }.toSet(), buildScriptClassPath, outputDirectory)
31+
var compiler = Compiler(
32+
javaSourcePath,
33+
classPath.map { it.compiledJar }.toSet(),
34+
buildScriptClassPath,
35+
scriptsConfig,
36+
outputDirectory
37+
)
2838
private set
2939

3040
private val async = AsyncExecutor()
@@ -72,7 +82,13 @@ class CompilerClassPath(private val config: CompilerConfiguration, private val d
7282
if (refreshCompiler) {
7383
LOG.info("Reinstantiating compiler")
7484
compiler.close()
75-
compiler = Compiler(javaSourcePath, classPath.map { it.compiledJar }.toSet(), buildScriptClassPath, outputDirectory)
85+
compiler = Compiler(
86+
javaSourcePath,
87+
classPath.map { it.compiledJar }.toSet(),
88+
buildScriptClassPath,
89+
scriptsConfig,
90+
outputDirectory
91+
)
7692
updateCompilerConfiguration()
7793
}
7894

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import java.util.concurrent.CompletableFuture.completedFuture
2525
class KotlinLanguageServer : LanguageServer, LanguageClientAware, Closeable {
2626
val config = Configuration()
2727
val databaseService = DatabaseService()
28-
val classPath = CompilerClassPath(config.compiler, databaseService)
28+
val classPath = CompilerClassPath(config.compiler, config.scripts, databaseService)
2929

3030
private val tempDirectory = TemporaryDirectory()
3131
private val uriContentProvider = URIContentProvider(ClassContentProvider(config.externalSources, classPath, tempDirectory, CompositeSourceArchiveProvider(JdkSourceArchiveProvider(classPath), ClassPathSourceArchiveProvider(classPath))))

0 commit comments

Comments
 (0)