@@ -1821,7 +1821,7 @@ object Build {
18211821 // We add a dependency to the JVM library to have the classfile available
18221822 // (as they are not part of this artifact)
18231823 .dependsOn(`scala3-library-bootstrapped-new`)
1824- .enablePlugins(ScalaLibraryPlugin )
1824+ .enablePlugins(ScalaLibraryPlugin , DottyJSPlugin )
18251825 .settings(publishSettings)
18261826 .settings(
18271827 name := " scala-library-sjs" ,
@@ -1870,7 +1870,9 @@ object Build {
18701870 ))
18711871 .flatMap(_.relativeTo(baseDirectory.value / " src" )).toSet
18721872
1873- files.filterNot(file =>
1873+ files.filterNot(_.getPath().contains(" BoxesRunTime.scala" ))
1874+ .filterNot(_.getPath().contains(" ScalaNumber.scala" ))
1875+ .filterNot(file =>
18741876 file.relativeTo((`scala-library-bootstrapped` / baseDirectory).value / " src" )
18751877 .exists(overwrittenSources.contains))
18761878
@@ -2460,6 +2462,7 @@ object Build {
24602462 s " -Ddotty.tests.classes.tastyCore= ${(`tasty-core-bootstrapped-new` / Compile / packageBin).value}" ,
24612463 s " -Ddotty.tests.classes.compilerInterface= ${findArtifactPath(externalDeps, " compiler-interface" )}" ,
24622464 s " -Ddotty.tests.classes.scalaLibrary= ${(`scala-library-bootstrapped` / Compile / packageBin).value}" ,
2465+ s " -Ddotty.tests.classes.scalaJSScalalib= ${(`scala-library-sjs` / Compile / packageBin).value}" ,
24632466 s " -Ddotty.tests.classes.scalaAsm= ${findArtifactPath(externalDeps, " scala-asm" )}" ,
24642467 s " -Ddotty.tests.classes.jlineTerminal= ${findArtifactPath(externalDeps, " jline-terminal" )}" ,
24652468 s " -Ddotty.tests.classes.jlineReader= ${findArtifactPath(externalDeps, " jline-reader" )}" ,
@@ -2997,10 +3000,15 @@ object Build {
29973000 )
29983001
29993002 lazy val sjsCompilerTests = project.in(file(" sjs-compiler-tests" )).
3000- dependsOn(`scala3-compiler` % " test->test" ).
3003+ dependsOn(`scala3-compiler-bootstrapped-new ` % " test->test" ).
30013004 settings(
3002- commonNonBootstrappedSettings,
3003-
3005+ (Compile / scalaSource) := baseDirectory.value / " src" ,
3006+ (Test / scalaSource) := baseDirectory.value / " test" ,
3007+ (Compile / javaSource) := baseDirectory.value / " src" ,
3008+ (Test / javaSource) := baseDirectory.value / " test" ,
3009+ (Compile / resourceDirectory) := baseDirectory.value / " resources" ,
3010+ (Test / resourceDirectory) := baseDirectory.value / " test-resources" ,
3011+ scalaVersion := (`scala3-compiler-bootstrapped-new` / scalaVersion).value,
30043012 libraryDependencies ++= Seq (
30053013 " org.scala-js" %% " scalajs-linker" % scalaJSVersion % Test cross CrossVersion .for3Use2_13,
30063014 " org.scala-js" %% " scalajs-env-nodejs" % " 1.3.0" % Test cross CrossVersion .for3Use2_13,
@@ -3009,18 +3017,63 @@ object Build {
30093017 // Change the baseDirectory when running the tests
30103018 Test / baseDirectory := baseDirectory.value.getParentFile,
30113019
3012- javaOptions ++= (`scala3-compiler` / javaOptions).value,
3020+ javaOptions ++= (`scala3-compiler-bootstrapped-new ` / javaOptions).value,
30133021 javaOptions ++= {
3014- val externalJSDeps = (`scala3-library-bootstrappedJS` / Compile / externalDependencyClasspath).value
3015- val dottyLibraryJSJar = (`scala3-library-bootstrappedJS` / Compile / packageBin).value.getAbsolutePath
3022+ val externalJSDeps = (`scala-library-sjs` / Compile / externalDependencyClasspath).value
3023+
3024+ val managedSrcDir = {
3025+ // Populate the directory
3026+ (`scala3-compiler-bootstrapped-new` / Compile / managedSources).value
3027+
3028+ (`scala3-compiler-bootstrapped-new` / Compile / sourceManaged).value
3029+ }
3030+
3031+ val externalDeps = (`scala3-compiler-bootstrapped-new` / Runtime / externalDependencyClasspath).value
30163032
30173033 Seq (
3018- " -Ddotty.tests.classes.dottyLibraryJS=" + dottyLibraryJSJar,
3034+ s " -Ddotty.tests.dottyCompilerManagedSources= ${managedSrcDir}" ,
3035+ s " -Ddotty.tests.classes.dottyInterfaces= ${(`scala3-interfaces` / Compile / packageBin).value}" ,
3036+ s " -Ddotty.tests.classes.dottyCompiler= ${(ThisProject / Compile / packageBin).value}" ,
3037+ s " -Ddotty.tests.classes.tastyCore= ${(`tasty-core-nonbootstrapped` / Compile / packageBin).value}" ,
3038+ s " -Ddotty.tests.classes.compilerInterface= ${findArtifactPath(externalDeps, " compiler-interface" )}" ,
3039+ s " -Ddotty.tests.classes.scalaLibrary= ${(`scala-library-nonbootstrapped` / Compile / packageBin).value}" ,
3040+ s " -Ddotty.tests.classes.scalaAsm= ${findArtifactPath(externalDeps, " scala-asm" )}" ,
3041+ s " -Ddotty.tests.classes.jlineTerminal= ${findArtifactPath(externalDeps, " jline-terminal" )}" ,
3042+ s " -Ddotty.tests.classes.jlineReader= ${findArtifactPath(externalDeps, " jline-reader" )}" ,
3043+ s " -Ddotty.tools.dotc.semanticdb.test= ${(ThisBuild / baseDirectory).value/ " tests" / " semanticdb" }" ,
3044+ " -Ddotty.tests.classes.scalaJSScalalib=" + (`scala-library-sjs` / Compile / packageBin).value,
30193045 " -Ddotty.tests.classes.scalaJSJavalib=" + findArtifactPath(externalJSDeps, " scalajs-javalib" ),
3020- " -Ddotty.tests.classes.scalaJSScalalib=" + findArtifactPath(externalJSDeps, " scalajs-scalalib_2.13" ),
30213046 " -Ddotty.tests.classes.scalaJSLibrary=" + findArtifactPath(externalJSDeps, " scalajs-library_2.13" ),
30223047 )
30233048 },
3049+ // Configure to use the non-bootstrapped compiler
3050+ managedScalaInstance := false ,
3051+ scalaInstance := {
3052+ val externalCompilerDeps = (`scala3-compiler-nonbootstrapped` / Compile / externalDependencyClasspath).value.map(_.data).toSet
3053+
3054+ // IMPORTANT: We need to use actual jars to form the ScalaInstance and not
3055+ // just directories containing classfiles because sbt maintains a cache of
3056+ // compiler instances. This cache is invalidated based on timestamps
3057+ // however this is only implemented on jars, directories are never
3058+ // invalidated.
3059+ val tastyCore = (`tasty-core-nonbootstrapped` / Compile / packageBin).value
3060+ val scalaLibrary = (`scala-library-nonbootstrapped` / Compile / packageBin).value
3061+ val scala3Interfaces = (`scala3-interfaces` / Compile / packageBin).value
3062+ val scala3Compiler = (`scala3-compiler-nonbootstrapped` / Compile / packageBin).value
3063+
3064+ Defaults .makeScalaInstance(
3065+ dottyNonBootstrappedVersion,
3066+ libraryJars = Array (scalaLibrary),
3067+ allCompilerJars = Seq (tastyCore, scala3Interfaces, scala3Compiler) ++ externalCompilerDeps,
3068+ allDocJars = Seq .empty,
3069+ state.value,
3070+ scalaInstanceTopLoader.value
3071+ )
3072+ },
3073+ scalaCompilerBridgeBinaryJar := {
3074+ Some ((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
3075+ },
3076+ Test / forkOptions := (Test / forkOptions).value.withWorkingDirectory((ThisBuild / baseDirectory).value),
30243077 )
30253078
30263079 lazy val `scala3-bench` = project.in(file(" bench" )).asDottyBench(NonBootstrapped )
0 commit comments