Skip to content

Commit 7185eed

Browse files
committed
wip
1 parent 8993ec1 commit 7185eed

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

project/Build.scala

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ import dotty.tools.sbtplugin.DottyPlugin.autoImport._
1919
import dotty.tools.sbtplugin.DottyIDEPlugin.{ installCodeExtension, prepareCommand, runProcess }
2020
import dotty.tools.sbtplugin.DottyIDEPlugin.autoImport._
2121

22+
import org.scalajs.sbtplugin.ScalaJSPlugin
23+
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
24+
2225
import sbtbuildinfo.BuildInfoPlugin
2326
import sbtbuildinfo.BuildInfoPlugin.autoImport._
2427

@@ -633,14 +636,14 @@ object Build {
633636

634637
run := dotc.evaluated,
635638
dotc := runCompilerMain().evaluated,
636-
repl := runCompilerMain(repl = true).evaluated
639+
repl := runCompilerMain(repl = true).evaluated,
637640

638641
// FIXME: Adding the sources of scala-js ir doesn't work anymore because scalajs-ir has a few
639642
// compilation errors when compiled by Dotty:
640643
// - inline is now a keyword
641644
// - methods defined with () need to be called with ()
642645
// Until they're fixed, we rely on scalajs-ir compiled by Scala 2:
643-
libraryDependencies += ("org.scala-js" %% "scalajs-ir" % scalaJSVersion).withDottyCompat(),
646+
libraryDependencies += ("org.scala-js" %% "scalajs-ir" % scalaJSVersion).withDottyCompat(scalaVersion.value),
644647
/*
645648
/* Add the sources of scalajs-ir.
646649
* To guarantee that dotty can bootstrap without depending on a version
@@ -650,7 +653,7 @@ object Build {
650653
ivyConfigurations += config("sourcedeps").hide,
651654
transitiveClassifiers := Seq("sources"),
652655
libraryDependencies +=
653-
("org.scala-js" %% "scalajs-ir" % scalaJSVersion % "sourcedeps").withDottyCompat(),
656+
("org.scala-js" %% "scalajs-ir" % scalaJSVersion % "sourcedeps").withDottyCompat(scalaVersion.value),
654657
sourceGenerators in Compile += Def.task {
655658
val s = streams.value
656659
val cacheDir = s.cacheDirectory
@@ -925,30 +928,25 @@ object Build {
925928
/* Remove the Scala.js compiler plugin for scalac, and enable the
926929
* Scala.js back-end of dotty instead.
927930
*/
928-
libraryDependencies ~= { deps =>
929-
deps.filterNot(_.name.startsWith("scalajs-compiler")).map(_.withDottyCompat())
931+
libraryDependencies := {
932+
val deps = libraryDependencies.value
933+
deps.filterNot(_.name.startsWith("scalajs-compiler")).map(_.withDottyCompat(scalaVersion.value))
930934
},
931935
scalacOptions += "-scalajs",
932936

933937
// The main class cannot be found automatically due to the empty inc.Analysis
934-
mainClass in Compile := Some("hello.world"),
938+
mainClass in Compile := Some("hello.HelloWorld"),
935939

936940
scalaJSUseMainModuleInitializer := true,
937941

938942
/* Debug-friendly Scala.js optimizer options.
939943
* In particular, typecheck the Scala.js IR found on the classpath.
940944
*/
941-
scalaJSOptimizerOptions ~= {
942-
_.withCheckScalaJSIR(true).withParallel(false)
945+
scalaJSLinkerConfig ~= {
946+
_.withCheckIR(true).withParallel(false)
943947
}
944948
).
945-
settings(compileWithDottySettings).
946-
settings(inConfig(Compile)(Seq(
947-
/* Make sure jsDependencyManifest runs after compile, otherwise compile
948-
* might remove the entire directory afterwards.
949-
*/
950-
jsDependencyManifest := jsDependencyManifest.dependsOn(compile).value
951-
)))
949+
settings(compileWithDottySettings)
952950

953951
lazy val `dotty-bench` = project.in(file("bench")).asDottyBench(NonBootstrapped)
954952
lazy val `dotty-bench-bootstrapped` = project.in(file("bench")).asDottyBench(Bootstrapped)

sandbox/scalajs/src/hello.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ trait MyTrait {
77
def foo(y: Int) = x
88
}
99

10-
object world extends MyTrait {
10+
object HelloWorld extends MyTrait {
1111
def main(): Unit = {
1212
println("hello dotty.js!")
1313
println(foo(4))

0 commit comments

Comments
 (0)