question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ScalaBuildTarget: split `jars` into `scalacJars` and `scaladocExtraJars`

See original GitHub issue

In Scala 2 jars contains compiler jars which can also be used to generate scaladoc (because it’s built-in into scala-compiler.jar). In Scala 3 the set of jars required for ScalaDoc includes 42 jars. Only 13 of those jars are required to create a scala compiler instance.

Currently ScalaBuildTarget.jars returns all 42 jars for Scala 3. This leads to compiler classpath pollution. image

see related: IntellIJ: sbt projects: Scala3 SDK compiler classpath contains redundant jar files Add ScalaInstance.loaderCompilerOnly

I already have a local fix for sbt projects (https://youtrack.jetbrains.com/issue/SCL-19086) via patching sbt-structure-extractor plugin

We could replace ScalaBuildTarget.jars field with scalacJars (13 jars) and scaladocExtraJars (29 jars). add methods getScalacJars, getScaladocExtraJars, getScaladocJars = getScaladocJars ++ getScaladocExtraJars

deprecate methods getJars, setJars getJars would by default return getScaladocJars setJars would set scalacJars, but probably would set scaladocExtraJars to an empty list

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
olafurpgcommented, Oct 10, 2021

This is a good observation. How about adding scaladocJars and keeping jars unchanged? We should try to avoid breaking changes at all cost. It would have no effect in Scala 2. I assume most BSP clients will only use the compiler jars anyways.

0reactions
jasticecommented, Oct 11, 2021

BTW is there a list of known BSP clients or is it just IntelliJ and Metals?

It’s pretty much just those two right now, yes.

So that implies that BSP implementations need to fix their implementation not to include redundant classpath jars to ScalaBuildTarget.jars?

Yes

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scala build process
Hi I am trying to understand the build file for the scala source, ... The jar files are a bit different, I havent...
Read more >
com-lihaoyi/mill: Your shiny new Java/Scala build tool! - GitHub
This creates a standalone assembly at target/mill-release you can use, which references jars published locally in your ~/.ivy2/local cache.
Read more >
Release notes | Scala CLI
It is now possible to export scalac options from a Scala CLI project to Mill with the ... -O -classpath -O path/to/classpath now...
Read more >
sbt Reference Manual — Combined Pages
Ultimately, the installation of sbt boils down to a launcher JAR and a shell ... adds/removes extra builds to the session. project Displays...
Read more >
How to create an executable JAR file with `scalac` (and run it ...
If you're ever working on a really small Scala project — something that contains only a few source code files — and don't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found