@@ -5,30 +5,51 @@ import sbt.internal.inc.ScalaInstance
55
66// This class needs to be in package sbt to access the ClassLoaderCache
77object Bootstrap {
8+ /** A ScalaInstance (without scaladoc). */
89 def makeScalaInstance (
910 state : State ,
1011 version : String ,
1112 libraryJars : Array [File ],
1213 compilerJars : Array [File ],
13- docJars : Array [File ],
1414 topLoader : ClassLoader
1515 ): ScalaInstance = {
1616 // `extendedClassLoaderCache` is package private in package sbt
1717 val cache = state.extendedClassLoaderCache
1818
1919 val libraryLoader = cache(libraryJars.toList, topLoader)
2020 val compilerLoader = cache(compilerJars.toList, libraryLoader)
21- val fullLoader = cache(docJars.toList, compilerLoader)
2221
2322 new ScalaInstance (
2423 version = version,
25- loader = fullLoader ,
24+ loader = compilerLoader ,
2625 loaderCompilerOnly = compilerLoader,
2726 loaderLibraryOnly = libraryLoader,
2827 libraryJars = libraryJars,
2928 compilerJars = compilerJars,
30- allJars = libraryJars ++ compilerJars ++ docJars ,
29+ allJars = libraryJars ++ compilerJars,
3130 explicitActual = Some (version)
3231 )
3332 }
34- }
33+
34+ /** A ScalaInstance identical to `base` but with additional jars for scaladoc. */
35+ def makeDocScalaInstance (
36+ state : State ,
37+ base : ScalaInstance ,
38+ docJars : Array [File ]
39+ ): ScalaInstance = {
40+ val cache = state.extendedClassLoaderCache
41+
42+ val fullLoader = cache(docJars.toList, base.loaderCompilerOnly)
43+
44+ new ScalaInstance (
45+ version = base.version,
46+ loader = fullLoader,
47+ loaderCompilerOnly = base.loaderCompilerOnly,
48+ loaderLibraryOnly = base.loaderLibraryOnly,
49+ libraryJars = base.libraryJars,
50+ compilerJars = base.compilerJars,
51+ allJars = base.allJars ++ docJars,
52+ explicitActual = base.explicitActual
53+ )
54+ }
55+ }
0 commit comments