You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SIP 46 - read classpath from file, remove lib directory in distribution (#20631)
**This should be backported to the 3.5.0 line**
write classpath to file, and do not write the `lib` directory, this
saves duplicating the jars in the distribution.
In the distribution, we write `/etc/scala.classpath`,
`/etc/with_compiler.classpath`, and `/etc/scaladoc.classpath`. each of
these are formatted such that each line is a relative path from the
`/maven2` directory in the distribution.
To produce these files, I use the output of the same `cs fetch` command
that is used to populate the `maven2` directory - so the correspondence
is 1:1. This is a much better solution than the previous manual
resolution of classpath from within the bash/batch scripts - as the
classpath libraries actually change a lot between versions.
The contents look like the following:
**scala.classpath** (compiler classpath used by scalac)
```text
org/scala-lang/scala3-interfaces/3.5.1-RC1-bin-SNAPSHOT/scala3-interfaces-3.5.1-RC1-bin-SNAPSHOT.jar
org/scala-lang/scala3-compiler_3/3.5.1-RC1-bin-SNAPSHOT/scala3-compiler_3-3.5.1-RC1-bin-SNAPSHOT.jar
org/scala-lang/scala3-library_3/3.5.1-RC1-bin-SNAPSHOT/scala3-library_3-3.5.1-RC1-bin-SNAPSHOT.jar
org/scala-lang/tasty-core_3/3.5.1-RC1-bin-SNAPSHOT/tasty-core_3-3.5.1-RC1-bin-SNAPSHOT.jar
org/scala-lang/modules/scala-asm/9.6.0-scala-1/scala-asm-9.6.0-scala-1.jar
org/scala-sbt/compiler-interface/1.9.6/compiler-interface-1.9.6.jar
org/jline/jline-reader/3.25.1/jline-reader-3.25.1.jar
org/jline/jline-terminal/3.25.1/jline-terminal-3.25.1.jar
org/jline/jline-terminal-jna/3.25.1/jline-terminal-jna-3.25.1.jar
org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar
org/scala-sbt/util-interface/1.9.8/util-interface-1.9.8.jar
org/jline/jline-native/3.25.1/jline-native-3.25.1.jar
net/java/dev/jna/jna/5.14.0/jna-5.14.0.jar
```
**with_compiler.classpath** (concatenated to scala.classpath to run the
scalac command)
```
org/scala-lang/scala3-staging_3/3.5.1-RC1-bin-SNAPSHOT/scala3-staging_3-3.5.1-RC1-bin-SNAPSHOT.jar
org/scala-lang/scala3-tasty-inspector_3/3.5.1-RC1-bin-SNAPSHOT/scala3-tasty-inspector_3-3.5.1-RC1-bin-SNAPSHOT.jar
```
and **scaladoc.classpath**
```
org/scala-lang/scala3-interfaces/3.5.1-RC1-bin-SNAPSHOT/scala3-interfaces-3.5.1-RC1-bin-SNAPSHOT.jar
org/scala-lang/scala3-compiler_3/3.5.1-RC1-bin-SNAPSHOT/scala3-compiler_3-3.5.1-RC1-bin-SNAPSHOT.jar
org/scala-lang/scala3-library_3/3.5.1-RC1-bin-SNAPSHOT/scala3-library_3-3.5.1-RC1-bin-SNAPSHOT.jar
org/scala-lang/tasty-core_3/3.5.1-RC1-bin-SNAPSHOT/tasty-core_3-3.5.1-RC1-bin-SNAPSHOT.jar
org/scala-lang/modules/scala-asm/9.6.0-scala-1/scala-asm-9.6.0-scala-1.jar
org/scala-sbt/compiler-interface/1.9.6/compiler-interface-1.9.6.jar
org/jline/jline-reader/3.25.1/jline-reader-3.25.1.jar
org/jline/jline-terminal/3.25.1/jline-terminal-3.25.1.jar
org/jline/jline-terminal-jna/3.25.1/jline-terminal-jna-3.25.1.jar
org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar
org/scala-sbt/util-interface/1.9.8/util-interface-1.9.8.jar
org/jline/jline-native/3.25.1/jline-native-3.25.1.jar
net/java/dev/jna/jna/5.14.0/jna-5.14.0.jar
org/scala-lang/scala3-tasty-inspector_3/3.5.1-RC1-bin-SNAPSHOT/scala3-tasty-inspector_3-3.5.1-RC1-bin-SNAPSHOT.jar
org/scala-lang/scaladoc_3/3.5.1-RC1-bin-SNAPSHOT/scaladoc_3-3.5.1-RC1-bin-SNAPSHOT.jar
com/vladsch/flexmark/flexmark/0.62.2/flexmark-0.62.2.jar
com/vladsch/flexmark/flexmark-util-ast/0.62.2/flexmark-util-ast-0.62.2.jar
com/vladsch/flexmark/flexmark-util-data/0.62.2/flexmark-util-data-0.62.2.jar
com/vladsch/flexmark/flexmark-util-html/0.62.2/flexmark-util-html-0.62.2.jar
com/vladsch/flexmark/flexmark-ext-anchorlink/0.62.2/flexmark-ext-anchorlink-0.62.2.jar
com/vladsch/flexmark/flexmark-ext-autolink/0.62.2/flexmark-ext-autolink-0.62.2.jar
com/vladsch/flexmark/flexmark-ext-emoji/0.62.2/flexmark-ext-emoji-0.62.2.jar
com/vladsch/flexmark/flexmark-ext-gfm-strikethrough/0.62.2/flexmark-ext-gfm-strikethrough-0.62.2.jar
com/vladsch/flexmark/flexmark-ext-gfm-tasklist/0.62.2/flexmark-ext-gfm-tasklist-0.62.2.jar
com/vladsch/flexmark/flexmark-ext-wikilink/0.62.2/flexmark-ext-wikilink-0.62.2.jar
com/vladsch/flexmark/flexmark-ext-tables/0.62.2/flexmark-ext-tables-0.62.2.jar
com/vladsch/flexmark/flexmark-ext-yaml-front-matter/0.62.2/flexmark-ext-yaml-front-matter-0.62.2.jar
nl/big-o/liqp/0.8.2/liqp-0.8.2.jar
org/jsoup/jsoup/1.17.2/jsoup-1.17.2.jar
com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.15.1/jackson-dataformat-yaml-2.15.1.jar
com/vladsch/flexmark/flexmark-util-builder/0.62.2/flexmark-util-builder-0.62.2.jar
com/vladsch/flexmark/flexmark-util-collection/0.62.2/flexmark-util-collection-0.62.2.jar
com/vladsch/flexmark/flexmark-util-dependency/0.62.2/flexmark-util-dependency-0.62.2.jar
com/vladsch/flexmark/flexmark-util-format/0.62.2/flexmark-util-format-0.62.2.jar
com/vladsch/flexmark/flexmark-util-misc/0.62.2/flexmark-util-misc-0.62.2.jar
com/vladsch/flexmark/flexmark-util-sequence/0.62.2/flexmark-util-sequence-0.62.2.jar
com/vladsch/flexmark/flexmark-util-visitor/0.62.2/flexmark-util-visitor-0.62.2.jar
org/jetbrains/annotations/15.0/annotations-15.0.jar
com/vladsch/flexmark/flexmark-util/0.62.2/flexmark-util-0.62.2.jar
org/nibor/autolink/autolink/0.6.0/autolink-0.6.0.jar
com/vladsch/flexmark/flexmark-jira-converter/0.62.2/flexmark-jira-converter-0.62.2.jar
org/antlr/antlr4-runtime/4.7.2/antlr4-runtime-4.7.2.jar
com/fasterxml/jackson/core/jackson-annotations/2.15.1/jackson-annotations-2.15.1.jar
com/fasterxml/jackson/core/jackson-core/2.15.1/jackson-core-2.15.1.jar
com/fasterxml/jackson/core/jackson-databind/2.15.1/jackson-databind-2.15.1.jar
com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.12.1/jackson-datatype-jsr310-2.12.1.jar
ua/co/k/strftime4j/1.0.5/strftime4j-1.0.5.jar
org/yaml/snakeyaml/2.0/snakeyaml-2.0.jar
com/vladsch/flexmark/flexmark-util-options/0.62.2/flexmark-util-options-0.62.2.jar
com/vladsch/flexmark/flexmark-ext-ins/0.62.2/flexmark-ext-ins-0.62.2.jar
com/vladsch/flexmark/flexmark-ext-superscript/0.62.2/flexmark-ext-superscript-0.62.2.jar
```
the bash/batch scripts then read these files, concatenating each line to
the absolute path of the `maven2` directory, and joining with the
systems path separator (and replacing `/` with `\` in batch)
fixes#20711
0 commit comments