@@ -724,9 +724,6 @@ object Build {
724724 libraryDependencies ++= Seq (
725725 " org.scala-lang.modules" % " scala-asm" % " 9.8.0-scala-1" , // used by the backend
726726 Dependencies .compilerInterface,
727- " org.jline" % " jline-reader" % " 3.29.0" , // used by the REPL
728- " org.jline" % " jline-terminal" % " 3.29.0" ,
729- " org.jline" % " jline-terminal-jni" % " 3.29.0" , // needed for Windows
730727 (" io.get-coursier" %% " coursier" % " 2.0.16" % Test ).cross(CrossVersion .for3Use2_13),
731728 ),
732729
@@ -1773,6 +1770,164 @@ object Build {
17731770 },
17741771 )
17751772
1773+ lazy val `scala3-repl-nonbootstrapped` = project.in(file(" repl" ))
1774+ .dependsOn(`scala3-compiler-nonbootstrapped` % " compile->compile;test->test" )
1775+ .settings(publishSettings)
1776+ .settings(
1777+ name := " scala3-repl" ,
1778+ moduleName := " scala3-repl" ,
1779+ version := dottyVersion,
1780+ versionScheme := Some (" semver-spec" ),
1781+ scalaVersion := referenceVersion,
1782+ crossPaths := true , // org.scala-lang:scala3-tasty-inspector has a crosspath
1783+ autoScalaLibrary := false , // do not add a dependency to stdlib, we depend transitively on the stdlib from `scala3-compiler-bootstrapped`
1784+ // Add the source directories for the sbt-bridge (boostrapped)
1785+ Compile / unmanagedSourceDirectories := Seq (baseDirectory.value / " src" ),
1786+ Test / unmanagedSourceDirectories := Seq (baseDirectory.value / " test" ),
1787+ // NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
1788+ Compile / scalacOptions := Seq (" -deprecation" , " -feature" , " -unchecked" , " -encoding" , " UTF8" , " -language:implicitConversions" ),
1789+ // Make sure that the produced artifacts have the minimum JVM version in the bytecode
1790+ Compile / javacOptions ++= Seq (" --release" , Versions .minimumJVMVersion),
1791+ Compile / scalacOptions ++= Seq (" --java-output-version" , Versions .minimumJVMVersion),
1792+ // Packaging configuration of `scala3-staging`
1793+ Compile / packageBin / publishArtifact := true ,
1794+ Compile / packageDoc / publishArtifact := false ,
1795+ Compile / packageSrc / publishArtifact := true ,
1796+ // Only publish compilation artifacts, no test artifacts
1797+ Test / publishArtifact := false ,
1798+ publish / skip := false ,
1799+ libraryDependencies ++= Seq (
1800+ " com.github.sbt" % " junit-interface" % " 0.13.3" % Test ,
1801+ ),
1802+ // Project specific target folder. sbt doesn't like having two projects using the same target folder
1803+ target := target.value / " scala3-repl-nonbootstrapped" ,
1804+ // Configure to use the non-bootstrapped compiler
1805+ scalaInstance := {
1806+ val lm = dependencyResolution.value
1807+ val log = streams.value.log
1808+ val retrieveDir = streams.value.cacheDirectory / " scala3-compiler" / scalaVersion.value
1809+ val comp = lm.retrieve(" org.scala-lang" % " scala3-compiler_3" %
1810+ scalaVersion.value, scalaModuleInfo = None , retrieveDir, log)
1811+ .fold(w => throw w.resolveException, identity)
1812+ Defaults .makeScalaInstance(
1813+ scalaVersion.value,
1814+ Array .empty,
1815+ comp.toSeq,
1816+ Seq .empty,
1817+ state.value,
1818+ scalaInstanceTopLoader.value,
1819+ )},
1820+ scalaCompilerBridgeBinaryJar := {
1821+ Some ((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
1822+ },
1823+ Test / javaOptions ++= {
1824+ val log = streams.value.log
1825+ val managedSrcDir = {
1826+ // Populate the directory
1827+ (Compile / managedSources).value
1828+
1829+ (Compile / sourceManaged).value
1830+ }
1831+ val externalDeps = (ThisProject / Runtime / externalDependencyClasspath).value
1832+ Seq (
1833+ s " -Ddotty.tests.dottyCompilerManagedSources= ${managedSrcDir}" ,
1834+ s " -Ddotty.tests.classes.dottyInterfaces= ${(`scala3-interfaces` / Compile / packageBin).value}" ,
1835+ s " -Ddotty.tests.classes.dottyCompiler= ${(`scala3-compiler-nonbootstrapped` / Compile / packageBin).value}" ,
1836+ s " -Ddotty.tests.classes.tastyCore= ${(`tasty-core-nonbootstrapped` / Compile / packageBin).value}" ,
1837+ s " -Ddotty.tests.classes.compilerInterface= ${findArtifactPath(externalDeps, " compiler-interface" )}" ,
1838+ s " -Ddotty.tests.classes.scalaLibrary= ${(`scala-library-nonbootstrapped` / Compile / packageBin).value}" ,
1839+ s " -Ddotty.tools.dotc.semanticdb.test= ${(ThisBuild / baseDirectory).value/ " tests" / " semanticdb" }" ,
1840+ )
1841+ },
1842+ Test / forkOptions :=
1843+ (Test / forkOptions).value.withWorkingDirectory((ThisBuild / baseDirectory).value),
1844+ )
1845+
1846+ lazy val `scala3-repl-bootstrapped` = project.in(file(" repl" ))
1847+ .dependsOn(`scala3-compiler-bootstrapped-new` % " compile->compile;test->test" )
1848+ .settings(publishSettings)
1849+ .settings(
1850+ name := " scala3-repl" ,
1851+ moduleName := " scala3-repl" ,
1852+ version := dottyVersion,
1853+ versionScheme := Some (" semver-spec" ),
1854+ scalaVersion := referenceVersion,
1855+ crossPaths := true , // org.scala-lang:scala3-tasty-inspector has a crosspath
1856+ autoScalaLibrary := false , // do not add a dependency to stdlib, we depend transitively on the stdlib from `scala3-compiler-bootstrapped`
1857+ // Add the source directories for the sbt-bridge (boostrapped)
1858+ Compile / unmanagedSourceDirectories := Seq (baseDirectory.value / " src" ),
1859+ Test / unmanagedSourceDirectories := Seq (baseDirectory.value / " test" ),
1860+ // NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
1861+ Compile / scalacOptions := Seq (" -deprecation" , " -feature" , " -unchecked" , " -encoding" , " UTF8" , " -language:implicitConversions" ),
1862+ // Make sure that the produced artifacts have the minimum JVM version in the bytecode
1863+ Compile / javacOptions ++= Seq (" --release" , Versions .minimumJVMVersion),
1864+ Compile / scalacOptions ++= Seq (" --java-output-version" , Versions .minimumJVMVersion),
1865+ // Packaging configuration of `scala3-staging`
1866+ Compile / packageBin / publishArtifact := true ,
1867+ Compile / packageDoc / publishArtifact := false ,
1868+ Compile / packageSrc / publishArtifact := true ,
1869+ // Only publish compilation artifacts, no test artifacts
1870+ Test / publishArtifact := false ,
1871+ publish / skip := false ,
1872+ libraryDependencies ++= Seq (
1873+ " com.github.sbt" % " junit-interface" % " 0.13.3" % Test ,
1874+ ),
1875+ target := target.value / " scala3-repl-bootstrapped" ,
1876+ // Configure to use the non-bootstrapped compiler
1877+ scalaInstance := {
1878+ val externalCompilerDeps = (`scala3-compiler-nonbootstrapped` / Compile / externalDependencyClasspath).value.map(_.data).toSet
1879+
1880+ // IMPORTANT: We need to use actual jars to form the ScalaInstance and not
1881+ // just directories containing classfiles because sbt maintains a cache of
1882+ // compiler instances. This cache is invalidated based on timestamps
1883+ // however this is only implemented on jars, directories are never
1884+ // invalidated.
1885+ val tastyCore = (`tasty-core-nonbootstrapped` / Compile / packageBin).value
1886+ val scalaLibrary = (`scala-library-nonbootstrapped` / Compile / packageBin).value
1887+ val scala3Interfaces = (`scala3-interfaces` / Compile / packageBin).value
1888+ val scala3Compiler = (`scala3-compiler-nonbootstrapped` / Compile / packageBin).value
1889+
1890+ Defaults .makeScalaInstance(
1891+ dottyNonBootstrappedVersion,
1892+ libraryJars = Array (scalaLibrary),
1893+ allCompilerJars = Seq (tastyCore, scala3Interfaces, scala3Compiler) ++ externalCompilerDeps,
1894+ allDocJars = Seq .empty,
1895+ state.value,
1896+ scalaInstanceTopLoader.value
1897+ )
1898+ },
1899+ scalaCompilerBridgeBinaryJar := {
1900+ Some ((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
1901+ },
1902+ Test / javaOptions ++= {
1903+ val log = streams.value.log
1904+ val managedSrcDir = {
1905+ // Populate the directory
1906+ (Compile / managedSources).value
1907+
1908+ (Compile / sourceManaged).value
1909+ }
1910+ val externalDeps = (ThisProject / Runtime / externalDependencyClasspath).value
1911+ Seq (
1912+ s " -Ddotty.tests.dottyCompilerManagedSources= ${managedSrcDir}" ,
1913+ s " -Ddotty.tests.classes.dottyInterfaces= ${(`scala3-interfaces` / Compile / packageBin).value}" ,
1914+ s " -Ddotty.tests.classes.dottyCompiler= ${(ThisProject / Compile / packageBin).value}" ,
1915+ s " -Ddotty.tests.classes.tastyCore= ${(`tasty-core-bootstrapped-new` / Compile / packageBin).value}" ,
1916+ s " -Ddotty.tests.classes.compilerInterface= ${findArtifactPath(externalDeps, " compiler-interface" )}" ,
1917+ s " -Ddotty.tests.classes.scalaLibrary= ${(`scala-library-bootstrapped` / Compile / packageBin).value}" ,
1918+ s " -Ddotty.tests.classes.scalaJSScalalib= ${(`scala-library-sjs` / Compile / packageBin).value}" ,
1919+ s " -Ddotty.tests.classes.scalaAsm= ${findArtifactPath(externalDeps, " scala-asm" )}" ,
1920+ s " -Ddotty.tests.classes.jlineTerminal= ${findArtifactPath(externalDeps, " jline-terminal" )}" ,
1921+ s " -Ddotty.tests.classes.jlineReader= ${findArtifactPath(externalDeps, " jline-reader" )}" ,
1922+ s " -Ddotty.tests.classes.dottyStaging= ${(LocalProject (" scala3-staging-new" ) / Compile / packageBin).value}" ,
1923+ s " -Ddotty.tests.classes.dottyTastyInspector= ${(LocalProject (" scala3-tasty-inspector-new" ) / Compile / packageBin).value}" ,
1924+ s " -Ddotty.tools.dotc.semanticdb.test= ${(ThisBuild / baseDirectory).value/ " tests" / " semanticdb" }" ,
1925+ )
1926+ },
1927+ Test / forkOptions :=
1928+ (Test / forkOptions).value.withWorkingDirectory((ThisBuild / baseDirectory).value),
1929+ )
1930+
17761931 // ==============================================================================================
17771932 // =================================== SCALA STANDARD LIBRARY ===================================
17781933 // ==============================================================================================
0 commit comments