@@ -2936,6 +2936,48 @@ object Build {
2936
2936
BuildInfoPlugin .buildInfoDefaultSettings
2937
2937
)
2938
2938
2939
+ /** Common settings for sjsSandbox and sjsJUnitTests */
2940
+ lazy val regularScalaJSProjectSettings : Seq [Setting [_]] = Def .settings(
2941
+ version := dottyVersion,
2942
+ scalaVersion := referenceVersion,
2943
+ crossPaths := true ,
2944
+ autoScalaLibrary := false , // do not add a dependency to stdlib, we depend on it with dependsOn
2945
+ // Add the source directories
2946
+ Compile / unmanagedSourceDirectories := Seq (baseDirectory.value / " src" ),
2947
+ Test / unmanagedSourceDirectories := Seq (baseDirectory.value / " test" ),
2948
+ // NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
2949
+ Compile / scalacOptions := Seq (" -deprecation" , " -feature" , " -unchecked" , " -encoding" , " UTF8" , " -language:implicitConversions" ),
2950
+ Compile / scalacOptions += " -scalajs" , // we really need this one for Scala.js projects
2951
+ // Don't publish
2952
+ publish / skip := false ,
2953
+ // Configure to use the non-bootstrapped compiler
2954
+ scalaInstance := {
2955
+ val externalCompilerDeps = (`scala3-compiler-nonbootstrapped` / Compile / externalDependencyClasspath).value.map(_.data).toSet
2956
+
2957
+ // IMPORTANT: We need to use actual jars to form the ScalaInstance and not
2958
+ // just directories containing classfiles because sbt maintains a cache of
2959
+ // compiler instances. This cache is invalidated based on timestamps
2960
+ // however this is only implemented on jars, directories are never
2961
+ // invalidated.
2962
+ val tastyCore = (`tasty-core-nonbootstrapped` / Compile / packageBin).value
2963
+ val scalaLibrary = (`scala-library-nonbootstrapped` / Compile / packageBin).value
2964
+ val scala3Interfaces = (`scala3-interfaces` / Compile / packageBin).value
2965
+ val scala3Compiler = (`scala3-compiler-nonbootstrapped` / Compile / packageBin).value
2966
+
2967
+ Defaults .makeScalaInstance(
2968
+ dottyNonBootstrappedVersion,
2969
+ libraryJars = Array (scalaLibrary),
2970
+ allCompilerJars = Seq (tastyCore, scala3Interfaces, scala3Compiler) ++ externalCompilerDeps,
2971
+ allDocJars = Seq .empty,
2972
+ state.value,
2973
+ scalaInstanceTopLoader.value
2974
+ )
2975
+ },
2976
+ scalaCompilerBridgeBinaryJar := {
2977
+ Some ((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
2978
+ },
2979
+ )
2980
+
2939
2981
/** A sandbox to play with the Scala.js back-end of dotty.
2940
2982
*
2941
2983
* This sandbox is compiled with dotty with support for Scala.js. It can be
@@ -2947,9 +2989,9 @@ object Build {
2947
2989
*/
2948
2990
lazy val sjsSandbox = project.in(file(" sandbox/scalajs" )).
2949
2991
enablePlugins(DottyJSPlugin ).
2950
- dependsOn(`scala3 -library-bootstrappedJS `).
2992
+ dependsOn(`scala -library-sjs `).
2951
2993
settings(
2952
- commonBootstrappedSettings ,
2994
+ regularScalaJSProjectSettings ,
2953
2995
// Required to run Scala.js tests.
2954
2996
Test / fork := false ,
2955
2997
@@ -2965,9 +3007,9 @@ object Build {
2965
3007
*/
2966
3008
lazy val sjsJUnitTests = project.in(file(" tests/sjs-junit" )).
2967
3009
enablePlugins(DottyJSPlugin ).
2968
- dependsOn(`scala3 -library-bootstrappedJS `).
3010
+ dependsOn(`scala -library-sjs `).
2969
3011
settings(
2970
- commonBootstrappedSettings ,
3012
+ regularScalaJSProjectSettings ,
2971
3013
bspEnabled := false ,
2972
3014
scalacOptions --= Seq (" -Werror" , " -deprecation" ),
2973
3015
0 commit comments