@@ -1968,7 +1968,7 @@ object Build {
19681968 // We add a dependency to the JVM library to have the classfile available
19691969 // (as they are not part of this artifact)
19701970 .dependsOn(`scala3-library-bootstrapped-new`)
1971- .enablePlugins(ScalaLibraryPlugin )
1971+ .enablePlugins(ScalaLibraryPlugin , DottyJSPlugin )
19721972 .settings(publishSettings)
19731973 .settings(
19741974 name := " scala-library-sjs" ,
@@ -2017,7 +2017,9 @@ object Build {
20172017 ))
20182018 .flatMap(_.relativeTo(baseDirectory.value / " src" )).toSet
20192019
2020- files.filterNot(file =>
2020+ files.filterNot(_.getPath().contains(" BoxesRunTime.scala" ))
2021+ .filterNot(_.getPath().contains(" ScalaNumber.scala" ))
2022+ .filterNot(file =>
20212023 file.relativeTo((`scala-library-bootstrapped` / baseDirectory).value / " src" )
20222024 .exists(overwrittenSources.contains))
20232025
@@ -2611,6 +2613,7 @@ object Build {
26112613 s " -Ddotty.tests.classes.tastyCore= ${(`tasty-core-bootstrapped-new` / Compile / packageBin).value}" ,
26122614 s " -Ddotty.tests.classes.compilerInterface= ${findArtifactPath(externalDeps, " compiler-interface" )}" ,
26132615 s " -Ddotty.tests.classes.scalaLibrary= ${(`scala-library-bootstrapped` / Compile / packageBin).value}" ,
2616+ s " -Ddotty.tests.classes.scalaJSScalalib= ${(`scala-library-sjs` / Compile / packageBin).value}" ,
26142617 s " -Ddotty.tests.classes.scalaAsm= ${findArtifactPath(externalDeps, " scala-asm" )}" ,
26152618 s " -Ddotty.tests.classes.jlineTerminal= ${findArtifactPath(externalDeps, " jline-terminal" )}" ,
26162619 s " -Ddotty.tests.classes.jlineReader= ${findArtifactPath(externalDeps, " jline-reader" )}" ,
@@ -3148,10 +3151,15 @@ object Build {
31483151 )
31493152
31503153 lazy val sjsCompilerTests = project.in(file(" sjs-compiler-tests" )).
3151- dependsOn(`scala3-compiler` % " test->test" ).
3154+ dependsOn(`scala3-compiler-bootstrapped-new ` % " test->test" ).
31523155 settings(
3153- commonNonBootstrappedSettings,
3154-
3156+ (Compile / scalaSource) := baseDirectory.value / " src" ,
3157+ (Test / scalaSource) := baseDirectory.value / " test" ,
3158+ (Compile / javaSource) := baseDirectory.value / " src" ,
3159+ (Test / javaSource) := baseDirectory.value / " test" ,
3160+ (Compile / resourceDirectory) := baseDirectory.value / " resources" ,
3161+ (Test / resourceDirectory) := baseDirectory.value / " test-resources" ,
3162+ scalaVersion := (`scala3-compiler-bootstrapped-new` / scalaVersion).value,
31553163 libraryDependencies ++= Seq (
31563164 " org.scala-js" %% " scalajs-linker" % scalaJSVersion % Test cross CrossVersion .for3Use2_13,
31573165 " org.scala-js" %% " scalajs-env-nodejs" % " 1.3.0" % Test cross CrossVersion .for3Use2_13,
@@ -3160,18 +3168,63 @@ object Build {
31603168 // Change the baseDirectory when running the tests
31613169 Test / baseDirectory := baseDirectory.value.getParentFile,
31623170
3163- javaOptions ++= (`scala3-compiler` / javaOptions).value,
3171+ javaOptions ++= (`scala3-compiler-bootstrapped-new ` / javaOptions).value,
31643172 javaOptions ++= {
3165- val externalJSDeps = (`scala3-library-bootstrappedJS` / Compile / externalDependencyClasspath).value
3166- val dottyLibraryJSJar = (`scala3-library-bootstrappedJS` / Compile / packageBin).value.getAbsolutePath
3173+ val externalJSDeps = (`scala-library-sjs` / Compile / externalDependencyClasspath).value
3174+
3175+ val managedSrcDir = {
3176+ // Populate the directory
3177+ (`scala3-compiler-bootstrapped-new` / Compile / managedSources).value
3178+
3179+ (`scala3-compiler-bootstrapped-new` / Compile / sourceManaged).value
3180+ }
3181+
3182+ val externalDeps = (`scala3-compiler-bootstrapped-new` / Runtime / externalDependencyClasspath).value
31673183
31683184 Seq (
3169- " -Ddotty.tests.classes.dottyLibraryJS=" + dottyLibraryJSJar,
3185+ s " -Ddotty.tests.dottyCompilerManagedSources= ${managedSrcDir}" ,
3186+ s " -Ddotty.tests.classes.dottyInterfaces= ${(`scala3-interfaces` / Compile / packageBin).value}" ,
3187+ s " -Ddotty.tests.classes.dottyCompiler= ${(ThisProject / Compile / packageBin).value}" ,
3188+ s " -Ddotty.tests.classes.tastyCore= ${(`tasty-core-nonbootstrapped` / Compile / packageBin).value}" ,
3189+ s " -Ddotty.tests.classes.compilerInterface= ${findArtifactPath(externalDeps, " compiler-interface" )}" ,
3190+ s " -Ddotty.tests.classes.scalaLibrary= ${(`scala-library-nonbootstrapped` / Compile / packageBin).value}" ,
3191+ s " -Ddotty.tests.classes.scalaAsm= ${findArtifactPath(externalDeps, " scala-asm" )}" ,
3192+ s " -Ddotty.tests.classes.jlineTerminal= ${findArtifactPath(externalDeps, " jline-terminal" )}" ,
3193+ s " -Ddotty.tests.classes.jlineReader= ${findArtifactPath(externalDeps, " jline-reader" )}" ,
3194+ s " -Ddotty.tools.dotc.semanticdb.test= ${(ThisBuild / baseDirectory).value/ " tests" / " semanticdb" }" ,
3195+ " -Ddotty.tests.classes.scalaJSScalalib=" + (`scala-library-sjs` / Compile / packageBin).value,
31703196 " -Ddotty.tests.classes.scalaJSJavalib=" + findArtifactPath(externalJSDeps, " scalajs-javalib" ),
3171- " -Ddotty.tests.classes.scalaJSScalalib=" + findArtifactPath(externalJSDeps, " scalajs-scalalib_2.13" ),
31723197 " -Ddotty.tests.classes.scalaJSLibrary=" + findArtifactPath(externalJSDeps, " scalajs-library_2.13" ),
31733198 )
31743199 },
3200+ // Configure to use the non-bootstrapped compiler
3201+ managedScalaInstance := false ,
3202+ scalaInstance := {
3203+ val externalCompilerDeps = (`scala3-compiler-nonbootstrapped` / Compile / externalDependencyClasspath).value.map(_.data).toSet
3204+
3205+ // IMPORTANT: We need to use actual jars to form the ScalaInstance and not
3206+ // just directories containing classfiles because sbt maintains a cache of
3207+ // compiler instances. This cache is invalidated based on timestamps
3208+ // however this is only implemented on jars, directories are never
3209+ // invalidated.
3210+ val tastyCore = (`tasty-core-nonbootstrapped` / Compile / packageBin).value
3211+ val scalaLibrary = (`scala-library-nonbootstrapped` / Compile / packageBin).value
3212+ val scala3Interfaces = (`scala3-interfaces` / Compile / packageBin).value
3213+ val scala3Compiler = (`scala3-compiler-nonbootstrapped` / Compile / packageBin).value
3214+
3215+ Defaults .makeScalaInstance(
3216+ dottyNonBootstrappedVersion,
3217+ libraryJars = Array (scalaLibrary),
3218+ allCompilerJars = Seq (tastyCore, scala3Interfaces, scala3Compiler) ++ externalCompilerDeps,
3219+ allDocJars = Seq .empty,
3220+ state.value,
3221+ scalaInstanceTopLoader.value
3222+ )
3223+ },
3224+ scalaCompilerBridgeBinaryJar := {
3225+ Some ((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
3226+ },
3227+ Test / forkOptions := (Test / forkOptions).value.withWorkingDirectory((ThisBuild / baseDirectory).value),
31753228 )
31763229
31773230 lazy val `scala3-bench` = project.in(file(" bench" )).asDottyBench(NonBootstrapped )
0 commit comments