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
8 changes: 0 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ jobs:
./project/scripts/cmdTests
./project/scripts/bootstrappedOnlyCmdTests

- name: Scala.js Test
run: |
./project/scripts/sbt ";sjsSandbox/run ;sjsSandbox/test ;sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test"

test_windows_fast:
runs-on: [self-hosted, Windows]
if: "(
Expand Down Expand Up @@ -148,10 +144,6 @@ jobs:
run: './project/scripts/winCmdTests.bat'
shell: cmd

- name: Scala.js Test
run: sbt ";sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test"
shell: cmd

test_windows_full:
runs-on: [self-hosted, Windows]
if: "github.event_name == 'schedule' && github.repository == 'scala/scala3'
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/stdlib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -532,5 +532,10 @@ jobs:
java-version: 17
cache: 'sbt'
- uses: sbt/setup-sbt@v1
- name: Test Scala.js
run: ./project/scripts/sbt sjsCompilerTests/test
- name: Scala.js compiler tests
run: ./project/scripts/sbt "sjsCompilerTests/test"
- name: Scala.js sandbox
run: ./project/scripts/sbt ";sjsSandbox/run ;sjsSandbox/test"
- name: Scala.js JUnit tests
run: ./project/scripts/sbt ";sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test"
# TODO Scala.js on Windows
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ class SpecializeApplyMethods extends MiniPhase with InfoTransformer {

override def description: String = SpecializeApplyMethods.description

override def isEnabled(using Context): Boolean =
!ctx.settings.scalajs.value && !Feature.shouldBehaveAsScala2

private def specApplySymbol(sym: Symbol, args: List[Type], ret: Type)(using Context): Symbol = {
val name = nme.apply.specializedFunction(ret, args)
// Create the symbol at the next phase, so that it is a valid member of the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ class SpecializeFunctions extends MiniPhase {

override def runsAfter = Set(ElimByName.name)

override def isEnabled(using Context): Boolean =
!ctx.settings.scalajs.value

/** Create forwarders from the generic applys to the specialized ones.
*/
override def transformDefDef(ddef: DefDef)(using Context) = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class SpecializeTuples extends MiniPhase:

override def phaseName: String = SpecializeTuples.name
override def description: String = SpecializeTuples.description
override def isEnabled(using Context): Boolean = !ctx.settings.scalajs.value

override def transformApply(tree: Apply)(using Context): Tree = tree match
case Apply(TypeApply(fun: NameTree, targs), args)
Expand Down
50 changes: 46 additions & 4 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2936,6 +2936,48 @@ object Build {
BuildInfoPlugin.buildInfoDefaultSettings
)

/** Common settings for sjsSandbox and sjsJUnitTests */
lazy val regularScalaJSProjectSettings: Seq[Setting[_]] = Def.settings(
version := dottyVersion,
scalaVersion := referenceVersion,
crossPaths := true,
autoScalaLibrary := false, // do not add a dependency to stdlib, we depend on it with dependsOn
// Add the source directories
Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src"),
Test / unmanagedSourceDirectories := Seq(baseDirectory.value / "test"),
// NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
Compile / scalacOptions := Seq("-deprecation", "-feature", "-unchecked", "-encoding", "UTF8", "-language:implicitConversions"),
Compile / scalacOptions += "-scalajs", // we really need this one for Scala.js projects
// Don't publish
publish / skip := false,
// Configure to use the non-bootstrapped compiler
scalaInstance := {
val externalCompilerDeps = (`scala3-compiler-nonbootstrapped` / Compile / externalDependencyClasspath).value.map(_.data).toSet

// IMPORTANT: We need to use actual jars to form the ScalaInstance and not
// just directories containing classfiles because sbt maintains a cache of
// compiler instances. This cache is invalidated based on timestamps
// however this is only implemented on jars, directories are never
// invalidated.
val tastyCore = (`tasty-core-nonbootstrapped` / Compile / packageBin).value
val scalaLibrary = (`scala-library-nonbootstrapped` / Compile / packageBin).value
val scala3Interfaces = (`scala3-interfaces` / Compile / packageBin).value
val scala3Compiler = (`scala3-compiler-nonbootstrapped` / Compile / packageBin).value

Defaults.makeScalaInstance(
dottyNonBootstrappedVersion,
libraryJars = Array(scalaLibrary),
allCompilerJars = Seq(tastyCore, scala3Interfaces, scala3Compiler) ++ externalCompilerDeps,
allDocJars = Seq.empty,
state.value,
scalaInstanceTopLoader.value
)
},
scalaCompilerBridgeBinaryJar := {
Some((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
},
)

/** A sandbox to play with the Scala.js back-end of dotty.
*
* This sandbox is compiled with dotty with support for Scala.js. It can be
Expand All @@ -2947,9 +2989,9 @@ object Build {
*/
lazy val sjsSandbox = project.in(file("sandbox/scalajs")).
enablePlugins(DottyJSPlugin).
dependsOn(`scala3-library-bootstrappedJS`).
dependsOn(`scala-library-sjs`).
settings(
commonBootstrappedSettings,
regularScalaJSProjectSettings,
// Required to run Scala.js tests.
Test / fork := false,

Expand All @@ -2965,9 +3007,9 @@ object Build {
*/
lazy val sjsJUnitTests = project.in(file("tests/sjs-junit")).
enablePlugins(DottyJSPlugin).
dependsOn(`scala3-library-bootstrappedJS`).
dependsOn(`scala-library-sjs`).
settings(
commonBootstrappedSettings,
regularScalaJSProjectSettings,
bspEnabled := false,
scalacOptions --= Seq("-Werror", "-deprecation"),

Expand Down
Loading