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

Conversation

smarter
Copy link
Member

@smarter smarter commented May 3, 2021

Previously, we had both a non-bootstrapped and bootstrapped version of
that project as well as its dependencies (scala3-library-js,
scala3-tasty-inspector, scaladoc-testcases, scaladoc-js), the main
reason for this is that it allowed the non-boostrapped scaladoc to be
part of the scalaInstance of all bootstrapped projects, allowing us to
run scala3-library-bootstrapped/doc for example. But this also meant
that simply trying to run the compiler would compiler scaladoc as well
as its dependencies even if no documentation needed to be generated, and
since scaladoc-js runs the Scala.js optimizer this could be quite slow.

This commit fixes that by using a separate scalaInstance for the doc
task, which means the regular scalaInstance no longer needs to depend
on scaladoc and also allows us to remove all the non-bootstrapped
projects related to scaladoc (thus simplifying the build a lot) since we
can safely use the bootstrapped version in doc / scalaInstance without
running into a loop.

Comment on lines +34 to +53
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
)
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.

Copy link
Contributor

@BarkingBad BarkingBad left a comment

Choose a reason for hiding this comment

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

LGTM

Previously, we had both a non-bootstrapped and bootstrapped version of
that project as well as its dependencies (scala3-library-js,
scala3-tasty-inspector, scaladoc-testcases, scaladoc-js), the main
reason for this is that it allowed the non-boostrapped scaladoc to be
part of the `scalaInstance` of all bootstrapped projects, allowing us to
run `scala3-library-bootstrapped/doc` for example. But this also meant
that simply trying to run the compiler would compiler scaladoc as well
as its dependencies even if no documentation needed to be generated, and
since `scaladoc-js` runs the Scala.js optimizer this could be quite slow.

This commit fixes that by using a separate `scalaInstance` for the `doc`
task, which means the regular `scalaInstance` no longer needs to depend
on scaladoc and also allows us to remove all the non-bootstrapped
projects related to scaladoc (thus simplifying the build a lot) since we
can safely use the bootstrapped version in `doc / scalaInstance` without
running into a loop.
@smarter smarter force-pushed the scaladoc-bootstrapped-only branch from cf467bc to 96c3957 Compare May 5, 2021 15:50
@smarter smarter merged commit 5411298 into scala:master May 10, 2021
@smarter smarter deleted the scaladoc-bootstrapped-only branch May 10, 2021 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants