Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions modules/build/src/main/scala/scala/build/ReplArtifacts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,28 @@ object ReplArtifacts {
addScalapy: Option[String],
javaVersion: Int
): Either[BuildException, ReplArtifacts] = either {
val isScala2 = scalaParams.scalaVersion.startsWith("2.")
val replDep =
if isScala2 then dep"org.scala-lang:scala-compiler:${scalaParams.scalaVersion}"
else dep"org.scala-lang::scala3-compiler:${scalaParams.scalaVersion}"
val isScala2 = scalaParams.scalaVersion.startsWith("2.")
val firstNewReplNightly = "3.8.0-RC1-bin-20251101-389483e-NIGHTLY".coursierVersion
val firstNewReplRc = "3.8.0-RC1".coursierVersion
val firstNewReplStable = "3.8.0".coursierVersion
val scalaCoursierVersion = scalaParams.scalaVersion.coursierVersion
val shouldUseNewRepl =
!isScala2 &&
((scalaCoursierVersion >= firstNewReplNightly) || (scalaCoursierVersion >= firstNewReplRc) || scalaCoursierVersion >= firstNewReplStable)
val replDeps =
if isScala2 then Seq(dep"org.scala-lang:scala-compiler:${scalaParams.scalaVersion}")
else if shouldUseNewRepl then
Seq(
dep"org.scala-lang::scala3-compiler:${scalaParams.scalaVersion}",
dep"org.scala-lang::scala3-repl:${scalaParams.scalaVersion}"
)
else Seq(dep"org.scala-lang::scala3-compiler:${scalaParams.scalaVersion}")
val scalapyDeps =
addScalapy.map(ver => dep"${Artifacts.scalaPyOrganization(ver)}::scalapy-core::$ver").toSeq
val externalDeps = dependencies ++ scalapyDeps
val replArtifacts: Seq[(String, os.Path)] = value {
Artifacts.artifacts(
Seq(replDep).map(Positioned.none),
replDeps.map(Positioned.none),
repositories,
Some(scalaParams),
logger,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
package scala.cli.integration

class ReplTests3NextRc extends ReplTestDefinitions with Test3NextRc
import com.eed3si9n.expecty.Expecty.expect

class ReplTests3NextRc extends ReplTestDefinitions with Test3NextRc {
test("run hello world from the 3.8 REPL") {
TestInputs.empty.fromRoot { root =>
val expectedMessage = "1337"
val code = s"""println($expectedMessage)"""
val r = os.proc(
TestUtil.cli,
"repl",
"--repl-quit-after-init",
"--repl-init-script",
code,
"-S",
// TODO: switch this test to 3.8.0-RC1 once it's out
"3.8.0-RC1-bin-20251104-b83b3d9-NIGHTLY",
TestUtil.extraOptions
)
.call(cwd = root)
expect(r.out.trim() == expectedMessage)
}
}
}