Skip to content

Commit f0629f4

Browse files
Revert "Create legacy Scala 2/3 stdlib TASTy" (#18095)
This reverts commit 2faf77b and fixes #17964 agian Fixes #18094
2 parents f3787eb + d7f7694 commit f0629f4

File tree

3 files changed

+17
-74
lines changed

3 files changed

+17
-74
lines changed

build.sbt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ 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-legacy` = Build.`stdlib-bootstrapped-legacy`
1817
val `stdlib-bootstrapped` = Build.`stdlib-bootstrapped`
1918
val `stdlib-bootstrapped-tasty-tests` = Build.`stdlib-bootstrapped-tasty-tests`
2019
val `tasty-core` = Build.`tasty-core`

library/src/scala/quoted/ToExpr.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ object ToExpr {
422422
/** Default implementation of `ToExpr[BigDecimal using the default MathContext]` */
423423
given BigDecimalToExpr: ToExpr[BigDecimal] with {
424424
def apply(x: BigDecimal)(using Quotes): Expr[BigDecimal] =
425-
'{ BigDecimal(${Expr(x.toString)}) }
425+
val bigDecimal: String = "" + x // workaround "method toString in class BigDecimal does not take parameters" in scaladoc/generateScalaDocumentation
426+
'{ BigDecimal(${Expr(bigDecimal)}) }
426427
}
427428

428429
/** Default implementation of `ToExpr[StringContext]` */

project/Build.scala

Lines changed: 15 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -926,59 +926,6 @@ object Build {
926926
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value
927927
)
928928

929-
/** Version of stdlib-bootstrapped that compiles both Scala 2 and Scala 3 libraries
930-
* This is only used as a temporary solution until the docs can be generated using
931-
* stdlib-bootstrapped and scala3-library-bootstrapped.
932-
*/
933-
lazy val `stdlib-bootstrapped-legacy` = project.in(file("stdlib-bootstrapped-legacy")).
934-
withCommonSettings(Bootstrapped).
935-
dependsOn(dottyCompiler(Bootstrapped) % "provided; compile->runtime; test->test").
936-
settings(commonBootstrappedSettings).
937-
settings(stdlibBootstrappedCommonSettings).
938-
settings(
939-
scalacOptions -= "-Yscala2-stdlib",
940-
Compile/scalacOptions ++= {
941-
Seq(
942-
"-sourcepath",
943-
Seq(
944-
(Compile/sourceManaged).value / "scala-library-src",
945-
(Compile/sourceManaged).value / "dotty-library-src",
946-
).mkString(File.pathSeparator),
947-
)
948-
},
949-
(Compile / sourceGenerators) += Def.task {
950-
val s = streams.value
951-
val cacheDir = s.cacheDirectory
952-
val trgDir = (Compile / sourceManaged).value / "dotty-library-src"
953-
954-
// NOTE `sourceDirectory` is used for actual copying,
955-
// but `sources` are used as cache keys
956-
val dottyLibSourceDirs = (`scala3-library-bootstrapped`/Compile/unmanagedSourceDirectories).value
957-
def dottyLibSources = dottyLibSourceDirs.foldLeft(PathFinder.empty) { (pf, dir) =>
958-
if (!dir.exists) pf else pf +++ (dir ** "*.scala") +++ (dir ** "*.java")
959-
}
960-
961-
val cachedFun = FileFunction.cached(
962-
cacheDir / s"copyDottyLibrarySrc",
963-
FilesInfo.lastModified,
964-
FilesInfo.exists,
965-
) { _ =>
966-
if (trgDir.exists) IO.delete(trgDir)
967-
dottyLibSourceDirs.foreach { dir =>
968-
if (dir.exists) {
969-
s.log.info(s"Copying scala3-library sources from $dir to $trgDir...")
970-
IO.copyDirectory(dir, trgDir)
971-
}
972-
}
973-
974-
((trgDir ** "*.scala") +++ (trgDir ** "*.java")).get.toSet
975-
}
976-
977-
cachedFun(dottyLibSources.get.toSet).toSeq
978-
}.taskValue,
979-
mimaCheckDirection := "none",
980-
)
981-
982929
/** Scala 2 library compiled by dotty using the latest published sources of the library.
983930
*
984931
* This version of the library is not (yet) TASTy/binary compatible with the Scala 2 compiled library.
@@ -987,15 +934,7 @@ object Build {
987934
withCommonSettings(Bootstrapped).
988935
dependsOn(dottyCompiler(Bootstrapped) % "provided; compile->runtime; test->test").
989936
settings(commonBootstrappedSettings).
990-
settings(stdlibBootstrappedCommonSettings).
991937
settings(
992-
Compile / scalacOptions ++= {
993-
Seq("-sourcepath", ((Compile/sourceManaged).value / "scala-library-src").toString)
994-
},
995-
)
996-
997-
lazy val stdlibBootstrappedCommonSettings =
998-
Seq(
999938
moduleName := "scala-library",
1000939
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
1001940
Compile / scalacOptions ++= {
@@ -2019,11 +1958,11 @@ object ScaladocConfigs {
20191958

20201959
def defaultSourceLinks(version: String = dottyNonBootstrappedVersion, refVersion: String = dottyVersion) = Def.task {
20211960
def stdLibVersion = stdlibVersion(NonBootstrapped)
2022-
def srcManaged(v: String, s: String) = s"out/bootstrap/stdlib-bootstrapped-legacy/scala-$v/src_managed/main/$s-library-src"
1961+
def srcManaged(v: String, s: String) = s"out/bootstrap/stdlib-bootstrapped/scala-$v/src_managed/main/$s-library-src"
20231962
SourceLinks(
20241963
List(
20251964
scalaSrcLink(stdLibVersion, srcManaged(version, "scala") + "="),
2026-
dottySrcLink(refVersion, srcManaged(version, "dotty") + "=", "#library/src"),
1965+
dottySrcLink(refVersion, "library/src=", "#library/src"),
20271966
dottySrcLink(refVersion),
20281967
"docs=github://lampepfl/dotty/main#docs"
20291968
)
@@ -2107,21 +2046,22 @@ object ScaladocConfigs {
21072046

21082047
lazy val Scala3 = Def.task {
21092048
val dottyJars: Seq[java.io.File] = Seq(
2110-
(`stdlib-bootstrapped-legacy`/Compile/products).value,
2049+
(`stdlib-bootstrapped`/Compile/products).value,
2050+
(`scala3-library-bootstrapped`/Compile/products).value,
21112051
(`scala3-interfaces`/Compile/products).value,
21122052
(`tasty-core-bootstrapped`/Compile/products).value,
21132053
).flatten
21142054

21152055
val roots = dottyJars.map(_.getAbsolutePath)
21162056

21172057
val managedSources =
2118-
(`stdlib-bootstrapped-legacy`/Compile/sourceManaged).value / "scala-library-src"
2058+
(`stdlib-bootstrapped`/Compile/sourceManaged).value / "scala-library-src"
21192059
val projectRoot = (ThisBuild/baseDirectory).value.toPath
21202060
val stdLibRoot = projectRoot.relativize(managedSources.toPath.normalize())
21212061
val docRootFile = stdLibRoot.resolve("rootdoc.txt")
21222062

21232063
val dottyManagesSources =
2124-
(`stdlib-bootstrapped-legacy`/Compile/sourceManaged).value / "dotty-library-src"
2064+
(`scala3-library-bootstrapped`/Compile/sourceDirectory).value
21252065

21262066
val tastyCoreSources = projectRoot.relativize((`tasty-core-bootstrapped`/Compile/scalaSource).value.toPath().normalize())
21272067

@@ -2149,24 +2089,27 @@ object ScaladocConfigs {
21492089
}
21502090

21512091
def stableScala3(version: String) = Def.task {
2092+
val scalaLibrarySrc = s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed"
2093+
val dottyLibrarySrc = "library/src"
21522094
Scala3.value
21532095
.add(defaultSourceLinks(version + "-bin-SNAPSHOT-nonbootstrapped", version).value)
21542096
.add(ProjectVersion(version))
21552097
.add(SnippetCompiler(
21562098
List(
2157-
s"out/bootstrap/stdlib-bootstrapped-legacy/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src/scala/quoted=compile",
2158-
s"out/bootstrap/stdlib-bootstrapped-legacy/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src/scala/compiletime=compile"
2099+
s"$dottyLibrarySrc/scala/quoted=compile",
2100+
s"$dottyLibrarySrc/scala/compiletime=compile"
21592101
)
21602102
))
21612103
.add(CommentSyntax(List(
2162-
s"out/bootstrap/stdlib-bootstrapped-legacy/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/dotty-library-src=markdown",
2163-
s"out/bootstrap/stdlib-bootstrapped-legacy/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/scala-library-src=wiki",
2104+
s"$dottyLibrarySrc=markdown",
2105+
s"$scalaLibrarySrc=wiki",
21642106
"wiki"
21652107
)))
2166-
.add(DocRootContent(s"out/bootstrap/stdlib-bootstrapped-legacy/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed/main/scala-library-src/rootdoc.txt"))
2108+
.add(DocRootContent(s"$scalaLibrarySrc/rootdoc.txt"))
21672109
.withTargets(
21682110
Seq(
2169-
s"out/bootstrap/stdlib-bootstrapped-legacy/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes",
2111+
s"out/bootstrap/stdlib-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes",
2112+
s"out/bootstrap/scala3-library-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes",
21702113
s"tmp/interfaces/target/classes",
21712114
s"out/bootstrap/tasty-core-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes"
21722115
)

0 commit comments

Comments
 (0)