@@ -7,6 +7,10 @@ import java.nio.file.FileSystems
7
7
import java.nio.file.Path
8
8
import java.util.stream.Collectors
9
9
10
+ /* *
11
+ * Manages the class path (compiled JARs, etc), the Java source path
12
+ * and the compiler. Note that Kotlin sources are stored in SourcePath.
13
+ */
10
14
class CompilerClassPath (private val config : CompilerConfiguration ) : Closeable {
11
15
private val workspaceRoots = mutableSetOf<Path >()
12
16
private val javaSourcePath = mutableSetOf<Path >()
@@ -19,6 +23,7 @@ class CompilerClassPath(private val config: CompilerConfiguration) : Closeable {
19
23
compiler.updateConfiguration(config)
20
24
}
21
25
26
+ /* * Updates and possibly reinstantiates the compiler using new paths. */
22
27
private fun refresh (
23
28
updateClassPath : Boolean = true,
24
29
updateBuildScriptClassPath : Boolean = true,
@@ -31,7 +36,7 @@ class CompilerClassPath(private val config: CompilerConfiguration) : Closeable {
31
36
if (updateClassPath) {
32
37
val newClassPath = resolver.classpathOrEmpty
33
38
if (newClassPath != classPath) {
34
- syncPath (classPath, newClassPath, " class path" )
39
+ syncPaths (classPath, newClassPath, " class path" )
35
40
refreshCompiler = true
36
41
}
37
42
}
@@ -40,7 +45,7 @@ class CompilerClassPath(private val config: CompilerConfiguration) : Closeable {
40
45
LOG .info(" Update build script path" )
41
46
val newBuildScriptClassPath = resolver.buildScriptClasspathOrEmpty
42
47
if (newBuildScriptClassPath != buildScriptClassPath) {
43
- syncPath (buildScriptClassPath, newBuildScriptClassPath, " class path" )
48
+ syncPaths (buildScriptClassPath, newBuildScriptClassPath, " class path" )
44
49
refreshCompiler = true
45
50
}
46
51
}
@@ -55,7 +60,8 @@ class CompilerClassPath(private val config: CompilerConfiguration) : Closeable {
55
60
return refreshCompiler
56
61
}
57
62
58
- private fun syncPath (dest : MutableSet <Path >, new : Set <Path >, name : String ) {
63
+ /* * Synchronizes the given two path sets and logs the differences. */
64
+ private fun syncPaths (dest : MutableSet <Path >, new : Set <Path >, name : String ) {
59
65
val added = new - dest
60
66
val removed = dest - new
61
67
0 commit comments