-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
binary distribution: package information about jars required for scalac classpath in a separate file #20413
Comments
I also notice that the classpath used in those scripts has one suspicious extra jar What is that jar? Is it indeed required for scalac classpath? |
we were proposing to heavily change the lib directory currently in #20351 (e.g. removing it or perhaps converting the contents to alias links) - so would be good to know if its actually used by other tooling - it seems it is - it would be good to work together on this |
@bishabosha
Alias links to where?
Is there anything else we can provide from our side? |
I updated the PR description of #20351. otherwise you can download the zip from 3.5.0-RC1 release |
there is also a |
@unkarjedy what do you think of the change in #20631 which would add files which provide the classpath? |
@bishabosha Looks good. Do you already have some nightly/rc build to try it our on our side? |
@unkarjedy no but you can build it yourself with |
I think we can close this one. So far it's in 2024.3 Nightly Scala Plugin channel. |
Context:
In IntelliJ IDEA, you can use a plain IntelliJ project without build system SBT/Maven/Gradle/BSP.
In Scala Plugin we have a concept of "Scala SDK" which simply represents the scala compiler (classpath) and scala version.
In case the user already has Scala "installed" (whatever that means) IntelliJ has some logic to detect it.
We have multiple kinds of detectors for Brew, SDKMAN, Coursier, Maven, Ivy.
We also have a "System" detector which can detect Scala SDK from the unzipped binary Scala distribution (see Assets at github)
To construct Scala Compiler classpath, we read some jars from
lib
directory.In Scala2 the code of constructing the classpath was quite simple. We just search for a fixed set of compiler jars:
scala-compiler-2.X.Y.jar
,scala-library-2.X.Y.jar
,scala-reflect-2.X.Y.jar
:Issue
In Scala3 things get different. Scala 3 compiler classpath has more dependencies on more libraries.
In general, each minor/major Scala 3 version can have dependencies on different libraries with different versions.
We can't just include all jars from
lib
folder. We need an explicit list of compiler classpath dependencies becauselib
folder contains a lot of other jar files, not required for the compiler. AFAIU most of them are needed for scaladoc, not scalac.With Maven/Coursier/Ivy detectors, we can live with it because we can resolve transitive dependencies for
scala3-compiler_3
and get the classpath.However, with System detector we can't do it.
Three years ago I provided a hardcoded solution for Scala 3.0.0 (see the code)
It worked up to Scala 3.3.1 but shot back in 3.3.2 & 3.4.x (see https://youtrack.jetbrains.com/issue/SCL-22510).
Proposal
I think the only reliable solution is that along with the jar files, scala compiler publishes the classpath required for scalac.
For consistency, it could also publish the classpath for Scaladoc.
For example, it could be just two files:
lib/scalac-classpath
lib/scaladoc-classpath
Those files could contain a list of jar names or even jar name patterns on every line.
Then in IntelliJ we could simply read that file content.
If you have better ideas on the file names/format, we can discuss it.
Notes
Note that the information about scalac/scaladoc classpath is already known to the code which does the binary distribution packaging. It's already present in
bin/common
,bin/common.bat
,bin/scaladoc
,bin/scaladoc.bat
.However, it would be a too fragile solution to rely on those files as their structure can change and our parsing logic can break.
The text was updated successfully, but these errors were encountered: