Skip to content

Commit 48bb59c

Browse files
authored
Rename stdlib-bootstrapped-tasty to scala2-library-tasty (#18615)
Align with the `scala-library` and `dotty-library` nomenclature. Note that the name of the project/jar is already `scala2-library`. * `stdlib-bootstrapped` -> `scala2-library-bootstrapped` * `stdlib-bootstrapped-tasty` -> `scala2-library-tasty` * `stdlib-bootstrapped-tasty-tests` -> `scala2-library-tasty-tests` Based on #18613
2 parents ebb3a11 + f104cb9 commit 48bb59c

File tree

10 files changed

+49
-39
lines changed

10 files changed

+49
-39
lines changed

.github/workflows/ci.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ jobs:
134134

135135
- name: Cmd Tests
136136
run: |
137-
./project/scripts/sbt ";dist/pack; scala3-bootstrapped/compile; scala3-bootstrapped/test ;sbt-test/scripted scala2-compat/* ;stdlib-bootstrapped-tasty-tests/run ;stdlib-bootstrapped-tasty-tests/test; scala3-compiler-bootstrapped/scala3CompilerCoursierTest:test"
137+
./project/scripts/sbt ";dist/pack; scala3-bootstrapped/compile; scala3-bootstrapped/test ;sbt-test/scripted scala2-compat/* ;scala2-library-tasty-tests/run ;scala2-library-tasty-tests/test; scala3-compiler-bootstrapped/scala3CompilerCoursierTest:test"
138138
./project/scripts/cmdTests
139139
./project/scripts/bootstrappedOnlyCmdTests
140140
@@ -253,12 +253,12 @@ jobs:
253253

254254
- name: MiMa
255255
run: |
256-
./project/scripts/sbt ";scala3-interfaces/mimaReportBinaryIssues ;scala3-library-bootstrapped/mimaReportBinaryIssues ;scala3-library-bootstrappedJS/mimaReportBinaryIssues; tasty-core-bootstrapped/mimaReportBinaryIssues; stdlib-bootstrapped/mimaReportBinaryIssues"
256+
./project/scripts/sbt ";scala3-interfaces/mimaReportBinaryIssues ;scala3-library-bootstrapped/mimaReportBinaryIssues ;scala3-library-bootstrappedJS/mimaReportBinaryIssues; tasty-core-bootstrapped/mimaReportBinaryIssues; scala2-library-bootstrapped/mimaReportBinaryIssues"
257257
258258
- name: TASTy MiMa
259259
run: |
260260
# This script cleans the compiler and recompiles it from scratch (keep as last run)
261-
./project/scripts/stdlib-bootstrapped-tasty-mima.sh
261+
./project/scripts/scala2-library-tasty-mima.sh
262262
263263
community_build_a:
264264
runs-on: [self-hosted, Linux]
@@ -493,7 +493,7 @@ jobs:
493493

494494
- name: Test
495495
run: |
496-
./project/scripts/sbt ";dist/pack ;scala3-bootstrapped/compile ;scala3-bootstrapped/test ;sbt-test/scripted scala2-compat/* ;stdlib-bootstrapped-tasty-tests/run ;stdlib-bootstrapped-tasty-tests/test"
496+
./project/scripts/sbt ";dist/pack ;scala3-bootstrapped/compile ;scala3-bootstrapped/test ;sbt-test/scripted scala2-compat/* ;scala2-library-tasty-tests/run ;scala2-library-tasty-tests/test"
497497
./project/scripts/cmdTests
498498
./project/scripts/bootstrappedOnlyCmdTests
499499

build.sbt

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ val `scala3-language-server` = Build.`scala3-language-server`
1414
val `scala3-bench` = Build.`scala3-bench`
1515
val `scala3-bench-bootstrapped` = Build.`scala3-bench-bootstrapped`
1616
val `scala3-bench-micro` = Build.`scala3-bench-micro`
17-
val `stdlib-bootstrapped` = Build.`stdlib-bootstrapped`
18-
val `stdlib-bootstrapped-tasty` = Build.`stdlib-bootstrapped-tasty`
19-
val `stdlib-bootstrapped-tasty-tests` = Build.`stdlib-bootstrapped-tasty-tests`
17+
val `scala2-library-bootstrapped` = Build.`scala2-library-bootstrapped`
18+
val `scala2-library-tasty` = Build.`scala2-library-tasty`
19+
val `scala2-library-tasty-tests` = Build.`scala2-library-tasty-tests`
2020
val `tasty-core` = Build.`tasty-core`
2121
val `tasty-core-bootstrapped` = Build.`tasty-core-bootstrapped`
2222
val `tasty-core-scala2` = Build.`tasty-core-scala2`

compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ class DependencyRecorder {
476476
* we should have called `cb.generatedNonLocalClass` with the same class file name.
477477
*
478478
* FIXME: we still need a way to resolve the correct classfile when we split tasty and classes between
479-
* different outputs (e.g. stdlib-bootstrapped).
479+
* different outputs (e.g. scala2-library-bootstrapped).
480480
*/
481481
def cachedSiblingClass(pf: PlainFile): Path =
482482
siblingClassfiles.getOrElseUpdate(pf, {

project/Build.scala

+35-25
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ object Build {
271271
Keys.scalaSource, Keys.javaSource
272272
),
273273

274-
// This is used to download nightly builds of the Scala 2 library in `stdlib-bootstrapped`
274+
// This is used to download nightly builds of the Scala 2 library in `scala2-library-bootstrapped`
275275
resolvers += "scala-integration" at "https://scala-ci.typesafe.com/artifactory/scala-integration/",
276276
)
277277

@@ -723,22 +723,31 @@ object Build {
723723
val externalDeps = externalCompilerClasspathTask.value
724724
val jars = packageAll.value
725725
val scalaLib = findArtifactPath(externalDeps, "scala-library")
726+
val scalaLibTastyOpt = jars.get("scala2-library-tasty")
726727
val dottyLib = jars("scala3-library")
727728
val dottyCompiler = jars("scala3-compiler")
728729
val args0: List[String] = spaceDelimited("<arg>").parsed.toList
729730
val decompile = args0.contains("-decompile")
730731
val printTasty = args0.contains("-print-tasty")
732+
val useScala2LibraryTasty = args0.contains("-Yscala2-library-tasty")
731733
val debugFromTasty = args0.contains("-Ythrough-tasty")
732734
val args = args0.filter(arg => arg != "-repl" && arg != "-decompile" &&
733-
arg != "-with-compiler" && arg != "-Ythrough-tasty" && arg != "-print-tasty")
734-
735+
arg != "-with-compiler" && arg != "-Ythrough-tasty" && arg != "-print-tasty"
736+
&& arg != "-Yscala2-library-tasty")
735737
val main =
736738
if (decompile) "dotty.tools.dotc.decompiler.Main"
737739
else if (printTasty) "dotty.tools.dotc.core.tasty.TastyPrinter"
738740
else if (debugFromTasty) "dotty.tools.dotc.fromtasty.Debug"
739741
else "dotty.tools.dotc.Main"
740742

741-
var extraClasspath = Seq(scalaLib, dottyLib)
743+
var extraClasspath =
744+
scalaLibTastyOpt match {
745+
case Some(scalaLibTasty) if useScala2LibraryTasty =>
746+
Seq(scalaLibTasty, scalaLib, dottyLib)
747+
case _ =>
748+
if (useScala2LibraryTasty) log.error("-Yscala2-library-tasty can only be used with a bootstrapped compiler")
749+
Seq(scalaLib, dottyLib)
750+
}
742751

743752
if (decompile && !args.contains("-classpath"))
744753
extraClasspath ++= Seq(".")
@@ -848,6 +857,7 @@ object Build {
848857
"scala3-staging" -> (LocalProject("scala3-staging") / Compile / packageBin).value.getAbsolutePath,
849858
"scala3-tasty-inspector" -> (LocalProject("scala3-tasty-inspector") / Compile / packageBin).value.getAbsolutePath,
850859
"tasty-core" -> (LocalProject("tasty-core-bootstrapped") / Compile / packageBin).value.getAbsolutePath,
860+
"scala2-library-tasty" -> (LocalProject("scala2-library-tasty") / Compile / packageBin).value.getAbsolutePath,
851861
)
852862
},
853863

@@ -972,7 +982,7 @@ object Build {
972982
*
973983
* This version of the library is not (yet) TASTy/binary compatible with the Scala 2 compiled library.
974984
*/
975-
lazy val `stdlib-bootstrapped` = project.in(file("stdlib-bootstrapped")).
985+
lazy val `scala2-library-bootstrapped` = project.in(file("scala2-library-bootstrapped")).
976986
withCommonSettings(Bootstrapped).
977987
dependsOn(dottyCompiler(Bootstrapped) % "provided; compile->runtime; test->test").
978988
settings(commonBootstrappedSettings).
@@ -1061,7 +1071,7 @@ object Build {
10611071
| - final val MinorVersion = $minorVersion
10621072
| - final val ExperimentalVersion = 0
10631073
| * Clean everiting to generate a compiler with those new TASTy vesrions
1064-
| * Run stdlib-bootstrapped/tastyMiMaReportIssues
1074+
| * Run scala2-library-bootstrapped/tastyMiMaReportIssues
10651075
|""".stripMargin)
10661076

10671077
}).value,
@@ -1105,56 +1115,56 @@ object Build {
11051115
println(
11061116
s"""Usage:
11071117
|> $projectName/run list
1108-
| -- lists all files that are not overriden in stdlib-bootstrapped/src
1118+
| -- lists all files that are not overriden in scala2-library-bootstrapped/src
11091119
|
11101120
|> $projectName/run clone <sources>*
1111-
| -- clones the specified sources from the stdlib-bootstrapped/src
1121+
| -- clones the specified sources from the scala2-library-bootstrapped/src
11121122
| -- example: $projectName/run clone scala/Option.scala
11131123
|
11141124
|> $projectName/run overwrite <sources>*
1115-
| -- (danger) overwrites the specified sources from the stdlib-bootstrapped/src
1125+
| -- (danger) overwrites the specified sources from the scala2-library-bootstrapped/src
11161126
|""".stripMargin)
11171127
}
11181128
}
11191129
)
11201130

1121-
/** Packages the TASTy files of `stdlib-bootstrapped` in a jar */
1122-
lazy val `stdlib-bootstrapped-tasty` = project.in(file("stdlib-bootstrapped-tasty")).
1131+
/** Packages the TASTy files of `scala2-library-bootstrapped` in a jar */
1132+
lazy val `scala2-library-tasty` = project.in(file("scala2-library-tasty")).
11231133
withCommonSettings(Bootstrapped).
11241134
settings(
11251135
exportJars := true,
11261136
Compile / packageBin / mappings := {
1127-
(`stdlib-bootstrapped` / Compile / packageBin / mappings).value
1137+
(`scala2-library-bootstrapped` / Compile / packageBin / mappings).value
11281138
.filter(_._2.endsWith(".tasty"))
11291139
},
11301140
)
11311141

1132-
/** Test the tasty generated by `stdlib-bootstrapped`
1142+
/** Test the tasty generated by `scala2-library-bootstrapped`
11331143
*
1134-
* The sources in src are compiled using TASTy from stdlib-bootstrapped-tasty but then run
1144+
* The sources in src are compiled using TASTy from scala2-library-tasty but then run
11351145
* with the scala-library compiled be Scala 2.
11361146
*
11371147
* The tests are run with the bootstrapped compiler and the tasty inpector on the classpath.
1138-
* The classpath has the default `scala-library` and not `stdlib-bootstrapped`.
1148+
* The classpath has the default `scala-library` and not `scala2-library-bootstrapped`.
11391149
*
1140-
* The jar of `stdlib-bootstrapped` is provided for to the tests.
1150+
* The jar of `scala2-library-bootstrapped` is provided for to the tests.
11411151
* - inspector: test that we can load the contents of the jar using the tasty inspector
11421152
* - from-tasty: test that we can recompile the contents of the jar using `dotc -from-tasty`
11431153
*/
1144-
lazy val `stdlib-bootstrapped-tasty-tests` = project.in(file("stdlib-bootstrapped-tasty-tests")).
1154+
lazy val `scala2-library-tasty-tests` = project.in(file("scala2-library-tasty-tests")).
11451155
withCommonSettings(Bootstrapped).
11461156
dependsOn(dottyCompiler(Bootstrapped) % "compile->compile").
11471157
dependsOn(`scala3-tasty-inspector` % "test->test").
1148-
dependsOn(`stdlib-bootstrapped-tasty`).
1158+
dependsOn(`scala2-library-tasty`).
11491159
settings(commonBootstrappedSettings).
11501160
settings(
11511161
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
1152-
Test / javaOptions += "-Ddotty.scala.library=" + (`stdlib-bootstrapped` / Compile / packageBin).value.getAbsolutePath,
1162+
Test / javaOptions += "-Ddotty.scala.library=" + (`scala2-library-bootstrapped` / Compile / packageBin).value.getAbsolutePath,
11531163
Compile / compile / fullClasspath ~= {
11541164
_.filterNot(file => file.data.getName == s"scala-library-$stdlibBootstrappedVersion.jar")
11551165
},
11561166
Compile / compile / dependencyClasspath := {
1157-
// make sure that the scala2-library (tasty of `stdlib-bootstrapped-tasty`) is listed before the scala-library (classfiles)
1167+
// make sure that the scala2-library (tasty of `scala2-library-tasty`) is listed before the scala-library (classfiles)
11581168
val (bootstrappedLib, otherLibs) =
11591169
(Compile / compile / dependencyClasspath).value
11601170
.partition(_.data.getName == s"scala2-library-${dottyVersion}.jar")
@@ -2106,7 +2116,7 @@ object ScaladocConfigs {
21062116

21072117
def defaultSourceLinks(version: String = dottyNonBootstrappedVersion, refVersion: String = dottyVersion) = Def.task {
21082118
def stdLibVersion = stdlibVersion(NonBootstrapped)
2109-
def srcManaged(v: String, s: String) = s"out/bootstrap/stdlib-bootstrapped/scala-$v/src_managed/main/$s-library-src"
2119+
def srcManaged(v: String, s: String) = s"out/bootstrap/scala2-library-bootstrapped/scala-$v/src_managed/main/$s-library-src"
21102120
SourceLinks(
21112121
List(
21122122
scalaSrcLink(stdLibVersion, srcManaged(version, "scala") + "="),
@@ -2194,7 +2204,7 @@ object ScaladocConfigs {
21942204

21952205
lazy val Scala3 = Def.task {
21962206
val dottyJars: Seq[java.io.File] = Seq(
2197-
(`stdlib-bootstrapped`/Compile/products).value,
2207+
(`scala2-library-bootstrapped`/Compile/products).value,
21982208
(`scala3-library-bootstrapped`/Compile/products).value,
21992209
(`scala3-interfaces`/Compile/products).value,
22002210
(`tasty-core-bootstrapped`/Compile/products).value,
@@ -2203,7 +2213,7 @@ object ScaladocConfigs {
22032213
val roots = dottyJars.map(_.getAbsolutePath)
22042214

22052215
val managedSources =
2206-
(`stdlib-bootstrapped`/Compile/sourceManaged).value / "scala-library-src"
2216+
(`scala2-library-bootstrapped`/Compile/sourceManaged).value / "scala-library-src"
22072217
val projectRoot = (ThisBuild/baseDirectory).value.toPath
22082218
val stdLibRoot = projectRoot.relativize(managedSources.toPath.normalize())
22092219
val docRootFile = stdLibRoot.resolve("rootdoc.txt")
@@ -2236,7 +2246,7 @@ object ScaladocConfigs {
22362246
}
22372247

22382248
def stableScala3(version: String) = Def.task {
2239-
val scalaLibrarySrc = s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed"
2249+
val scalaLibrarySrc = s"out/bootstrap/scala2-library-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed"
22402250
val dottyLibrarySrc = "library/src"
22412251
Scala3.value
22422252
.add(defaultSourceLinks(version + "-bin-SNAPSHOT-nonbootstrapped", version).value)
@@ -2255,7 +2265,7 @@ object ScaladocConfigs {
22552265
.add(DocRootContent(s"$scalaLibrarySrc/rootdoc.txt"))
22562266
.withTargets(
22572267
Seq(
2258-
s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes",
2268+
s"out/bootstrap/scala2-library-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes",
22592269
s"out/bootstrap/scala3-library-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes",
22602270
s"tmp/interfaces/target/classes",
22612271
s"out/bootstrap/tasty-core-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes"

project/TastyMiMaFilters.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ object TastyMiMaFilters {
1111

1212
// Probably OK: ConstantType for `null` versus `scala.Null`
1313
// Calls to the default getter seem to link correctly.
14-
// Tested in stdlib-bootstrapped/test/scala/collection/UnrolledBufferTest.scala
14+
// Tested in scala2-library-bootstrapped/test/scala/collection/UnrolledBufferTest.scala
1515
ProblemMatcher.make(ProblemKind.IncompatibleTypeChange, "scala.collection.mutable.UnrolledBuffer.Unrolled.<init>$default$4"),
1616

1717
// Probably OK: Overriding java method (`public abstract Object underlying();` with `def underlying: Object`)
1818
// Calls to the underlying seem to link correctly.
19-
// Tested in stdlib-bootstrapped/test/Main.scala
19+
// Tested in scala2-library-bootstrapped/test/Main.scala
2020
ProblemMatcher.make(ProblemKind.MissingTermMember, "scala.math.Big*.underlying"),
2121
ProblemMatcher.make(ProblemKind.NewAbstractMember, "scala.math.ScalaNumericConversions.underlying"),
2222

project/scripts/cmdScaladocTests

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ SOURCE_LINKS_VERSION="${GITHUB_SHA:-$DOTTY_BOOTSTRAPPED_VERSION}"
2323
dist/target/pack/bin/scaladoc \
2424
-d "$OUT1" \
2525
-project "scaladoc testcases" \
26-
-source-links:out/bootstrap/stdlib-bootstrapped/scala-"${DOTTY_NONBOOTSTRAPPED_VERSION}"/src_managed/main/scala-library-src=github://scala/scala/v"${STDLIB_VERSION}"#src/library \
27-
-source-links:out/bootstrap/stdlib-bootstrapped/scala-"${DOTTY_NONBOOTSTRAPPED_VERSION}"/src_managed/main/dotty-library-src=github://"${SOURCE_LINKS_REPOSITORY}"/"${SOURCE_LINKS_VERSION}"\#library/src \
26+
-source-links:out/bootstrap/scala2-library-bootstrapped/scala-"${DOTTY_NONBOOTSTRAPPED_VERSION}"/src_managed/main/scala-library-src=github://scala/scala/v"${STDLIB_VERSION}"#src/library \
27+
-source-links:out/bootstrap/scala2-library-bootstrapped/scala-"${DOTTY_NONBOOTSTRAPPED_VERSION}"/src_managed/main/dotty-library-src=github://"${SOURCE_LINKS_REPOSITORY}"/"${SOURCE_LINKS_VERSION}"\#library/src \
2828
-source-links:github://"${SOURCE_LINKS_REPOSITORY}"/"${SOURCE_LINKS_VERSION}" \
2929
"-external-mappings:.*scala/.*::scaladoc3::https://dotty.epfl.ch/api/,.*java/.*::javadoc::https://docs.oracle.com/javase/8/docs/api/" \
3030
"-skip-by-regex:.+\.internal($|\..+)" \

project/scripts/stdlib-bootstrapped-tasty-mima.sh renamed to project/scripts/scala2-library-tasty-mima.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ setTastyVersion() {
1414

1515
setTastyVersion $MINOR_TASTY_VERSION_SUPPORTED_BY_TASTY_MIMA 0
1616

17-
# Run stdlib-bootstrapped/tastyMiMaReportIssues using a custom TASTy version.
17+
# Run scala2-library-bootstrapped/tastyMiMaReportIssues using a custom TASTy version.
1818
# We clean before to make sure all sources are recompiled using the new TASTY version.
1919
# We clean after to make sure no other test will use the TASTy generated with this version.
20-
"$SBT" "clean; stdlib-bootstrapped/clean; reload; stdlib-bootstrapped/tastyMiMaReportIssues; clean; stdlib-bootstrapped/clean"
20+
"$SBT" "clean; scala2-library-bootstrapped/clean; reload; scala2-library-bootstrapped/tastyMiMaReportIssues; clean; scala2-library-bootstrapped/clean"
2121

2222
setTastyVersion $MINOR_TASTY_VERSION $EXPERIMENTAL_TASTY_VERSION

0 commit comments

Comments
 (0)