Skip to content

Commit 2489d73

Browse files
committed
Add stdlib-full-bootstrapped/run
It is the same as `stdlib-bootstrapped/run`.
1 parent 2cbfffb commit 2489d73

File tree

2 files changed

+43
-42
lines changed

2 files changed

+43
-42
lines changed

project/Build.scala

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -939,47 +939,6 @@ object Build {
939939
},
940940
mimaCheckDirection := "both",
941941
mimaBinaryIssueFilters ++= MiMaFilters.LibraryBootstrappedForward,
942-
run := {
943-
val args: Seq[String] = spaceDelimited("<arg>").parsed
944-
val reference = (Compile/sourceManaged).value / "scala-library-src"
945-
args match {
946-
case Seq("list") =>
947-
println(s"List of non-overriden files in $reference")
948-
reference.allPaths.get()
949-
.flatMap(_.relativeTo(reference))
950-
.filter(_.ext == "scala")
951-
.sorted
952-
.foreach(println)
953-
case Seq(cmd @ ("clone" | "overwrite"), files*) =>
954-
println("Cloning scala-library sources: " + files.mkString(", "))
955-
for (file <- files) {
956-
val referenceStdlibPaths = reference / file
957-
val destination = baseDirectory.value / "src" / file
958-
if (!referenceStdlibPaths.exists) {
959-
println("Not found " + referenceStdlibPaths)
960-
} else if (destination.exists && cmd == "clone") {
961-
println(s"Already exists $file. (use `overwrite` command to overwrite)")
962-
} else {
963-
val action = if (cmd == "clone") "Cloning" else "Overwriting"
964-
println(s"$action $file")
965-
IO.copyFile(referenceStdlibPaths, destination)
966-
}
967-
}
968-
case _ =>
969-
println(
970-
"""Usage:
971-
|> stdlib-bootstrapped/run list
972-
| -- lists all files that are not overriden in stdlib-bootstrapped/src
973-
|
974-
|> stdlib-bootstrapped/run clone <sources>*
975-
| -- clones the specified sources from the stdlib-bootstrapped/src
976-
| -- example: stdlib-bootstrapped/run clone scala/Option.scala
977-
|
978-
|> stdlib-bootstrapped/run overwrite <sources>*
979-
| -- (danger) overwrites the specified sources from the stdlib-bootstrapped/src
980-
|""".stripMargin)
981-
}
982-
}
983942
)
984943

985944
/** Scala library compiled by dotty using the latest published sources of the library
@@ -1096,6 +1055,48 @@ object Build {
10961055
),
10971056
mimaCheckDirection := "backward",
10981057
mimaBinaryIssueFilters ++= MiMaFilters.LibraryBootstrapped,
1058+
run := {
1059+
val args: Seq[String] = spaceDelimited("<arg>").parsed
1060+
val reference = (Compile/sourceManaged).value / "scala-library-src"
1061+
args match {
1062+
case Seq("list") =>
1063+
println(s"List of non-overriden files in $reference")
1064+
reference.allPaths.get()
1065+
.flatMap(_.relativeTo(reference))
1066+
.filter(_.ext == "scala")
1067+
.sorted
1068+
.foreach(println)
1069+
case Seq(cmd @ ("clone" | "overwrite"), files*) =>
1070+
println("Cloning scala-library sources: " + files.mkString(", "))
1071+
for (file <- files) {
1072+
val referenceStdlibPaths = reference / file
1073+
val destination = baseDirectory.value / "src" / file
1074+
if (!referenceStdlibPaths.exists) {
1075+
println("Not found " + referenceStdlibPaths)
1076+
} else if (destination.exists && cmd == "clone") {
1077+
println(s"Already exists $file. (use `overwrite` command to overwrite)")
1078+
} else {
1079+
val action = if (cmd == "clone") "Cloning" else "Overwriting"
1080+
println(s"$action $file")
1081+
IO.copyFile(referenceStdlibPaths, destination)
1082+
}
1083+
}
1084+
case _ =>
1085+
val projectName = projectInfo.value.nameFormal
1086+
println(
1087+
s"""Usage:
1088+
|> $projectName/run list
1089+
| -- lists all files that are not overriden in stdlib-bootstrapped/src
1090+
|
1091+
|> $projectName/run clone <sources>*
1092+
| -- clones the specified sources from the stdlib-bootstrapped/src
1093+
| -- example: $projectName/run clone scala/Option.scala
1094+
|
1095+
|> $projectName/run overwrite <sources>*
1096+
| -- (danger) overwrites the specified sources from the stdlib-bootstrapped/src
1097+
|""".stripMargin)
1098+
}
1099+
}
10991100
)
11001101

11011102
/** Test the tasty generated by `stdlib-bootstrapped`

stdlib-full-bootstrapped/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ from `org.scala-lang" % "scala-library" % stdlibVersion(Bootstrapped) % "sourced
77
This implies that files in `stdlib-bootstrapped/src` override files override the Scala (2/3)
88
sources. Currently we can not override files from `library/src`.
99

10-
To clone or list non-overridden sources execute `stdlib-bootstrapped/run`.
10+
To clone or list non-overridden sources execute `stdlib-full-bootstrapped/run`.
1111

1212
This project generates a version of the Scala 3 library that contains the full library with
1313
TASTy files. The compiled library is located in `out/bootstrap/stdlib-full-bootstrapped/`.

0 commit comments

Comments
 (0)