Skip to content

Make scaladoc a bootstrapped-only project #12315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ val `scala3-interfaces` = Build.`scala3-interfaces`
val `scala3-compiler` = Build.`scala3-compiler`
val `scala3-compiler-bootstrapped` = Build.`scala3-compiler-bootstrapped`
val `scala3-library` = Build.`scala3-library`
val `scala3-library-js` = Build.`scala3-library-js`
val `scala3-library-bootstrapped` = Build.`scala3-library-bootstrapped`
val `scala3-library-bootstrappedJS` = Build.`scala3-library-bootstrappedJS`
val `scala3-sbt-bridge` = Build.`scala3-sbt-bridge`
val `scala3-sbt-bridge-tests` = Build.`scala3-sbt-bridge-tests`
val `scala3-staging` = Build.`scala3-staging`
val `scala3-tasty-inspector` = Build.`scala3-tasty-inspector`
val `scala3-tasty-inspector-nonbootstrapped` = Build.`scala3-tasty-inspector-nonbootstrapped`
val `scala3-language-server` = Build.`scala3-language-server`
val `scala3-bench` = Build.`scala3-bench`
val `scala3-bench-bootstrapped` = Build.`scala3-bench-bootstrapped`
Expand All @@ -21,11 +19,8 @@ val `tasty-core` = Build.`tasty-core`
val `tasty-core-bootstrapped` = Build.`tasty-core-bootstrapped`
val `tasty-core-scala2` = Build.`tasty-core-scala2`
val scaladoc = Build.scaladoc
val `scaladoc-nonBootstrapped` = Build.`scaladoc-nonBootstrapped`
val `scaladoc-testcases` = Build.`scaladoc-testcases`
val `scaladoc-testcases-nonBootstrapped` = Build.`scaladoc-testcases-nonBootstrapped`
val `scaladoc-js` = Build.`scaladoc-js`
val `scaladoc-js-nonBootstrapped` = Build.`scaladoc-js-nonBootstrapped`
val `scala3-bench-run` = Build.`scala3-bench-run`
val dist = Build.dist
val `community-build` = Build.`community-build`
Expand Down
31 changes: 26 additions & 5 deletions project/Bootstrap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,51 @@ import sbt.internal.inc.ScalaInstance

// This class needs to be in package sbt to access the ClassLoaderCache
object Bootstrap {
/** A ScalaInstance (without scaladoc). */
def makeScalaInstance(
state: State,
version: String,
libraryJars: Array[File],
compilerJars: Array[File],
docJars: Array[File],
topLoader: ClassLoader
): ScalaInstance = {
// `extendedClassLoaderCache` is package private in package sbt
val cache = state.extendedClassLoaderCache

val libraryLoader = cache(libraryJars.toList, topLoader)
val compilerLoader = cache(compilerJars.toList, libraryLoader)
val fullLoader = cache(docJars.toList, compilerLoader)

new ScalaInstance(
version = version,
loader = fullLoader,
loader = compilerLoader,
loaderCompilerOnly = compilerLoader,
loaderLibraryOnly = libraryLoader,
libraryJars = libraryJars,
compilerJars = compilerJars,
allJars = libraryJars ++ compilerJars ++ docJars,
allJars = libraryJars ++ compilerJars,
explicitActual = Some(version)
)
}
}

/** A ScalaInstance identical to `base` but with additional jars for scaladoc. */
def makeDocScalaInstance(
state: State,
base: ScalaInstance,
docJars: Array[File]
): ScalaInstance = {
val cache = state.extendedClassLoaderCache

val fullLoader = cache(docJars.toList, base.loaderCompilerOnly)

new ScalaInstance(
version = base.version,
loader = fullLoader,
loaderCompilerOnly = base.loaderCompilerOnly,
loaderLibraryOnly = base.loaderLibraryOnly,
libraryJars = base.libraryJars,
compilerJars = base.compilerJars,
allJars = base.allJars ++ docJars,
explicitActual = base.explicitActual
)
Comment on lines +34 to +53
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adpi2 It'd be nice to have a withAllJars method in ScalaInstance to simplify that I think.

}
}
Loading