@@ -58,7 +58,6 @@ object MyScalaJSPlugin extends AutoPlugin {
58
58
}
59
59
60
60
object Build {
61
- val scalacVersion = " 2.12.8"
62
61
val referenceVersion = " 0.17.0-RC1"
63
62
64
63
val baseVersion = " 0.18.0"
@@ -71,6 +70,16 @@ object Build {
71
70
val publishedDottyVersion = referenceVersion
72
71
val publishedSbtDottyVersion = " 0.3.3"
73
72
73
+ /** scala-library version required to compile Dotty.
74
+ *
75
+ * Both the non-bootstrapped and bootstrapped version should match, unless
76
+ * we're in the process of upgrading to a new major version of
77
+ * scala-library.
78
+ */
79
+ def stdlibVersion (implicit mode : Mode ): String = mode match {
80
+ case NonBootstrapped => " 2.12.8"
81
+ case Bootstrapped => " 2.13.0"
82
+ }
74
83
75
84
val dottyOrganization = " ch.epfl.lamp"
76
85
val dottyGithubUrl = " https://github.com/lampepfl/dotty"
@@ -144,7 +153,8 @@ object Build {
144
153
" -feature" ,
145
154
" -deprecation" ,
146
155
" -unchecked" ,
147
- " -Xfatal-warnings" ,
156
+ // TODO: reenable once we've fixed all the deprecation warnings.
157
+ // "-Xfatal-warnings",
148
158
" -encoding" , " UTF8" ,
149
159
" -language:existentials,higherKinds,implicitConversions"
150
160
),
@@ -256,8 +266,8 @@ object Build {
256
266
// Enforce that the only Scala 2 classfiles we unpickle come from scala-library
257
267
/*
258
268
scalacOptions ++= {
259
- val attList = (dependencyClasspath in `dotty-library` in Compile).value
260
- val scalaLib = findLib(attList , "scala-library")
269
+ val cp = (dependencyClasspath in `dotty-library` in Compile).value
270
+ val scalaLib = findLib(cp , "scala-library")
261
271
Seq("-Yscala2-unpickler", scalaLib)
262
272
},
263
273
*/
@@ -268,10 +278,10 @@ object Build {
268
278
// Compile using the non-bootstrapped and non-published dotty
269
279
managedScalaInstance := false ,
270
280
scalaInstance := {
271
- val externalDeps = externalDependencyClasspath.in(`dotty-doc`, Compile ).value
281
+ val externalNonBootstrappedDeps = externalDependencyClasspath.in(`dotty-doc`, Compile ).value
272
282
def getExternalDep (name : String ): File =
273
- externalDeps .find(_.get(artifact.key).exists(_.name == name))
274
- .getOrElse(throw new MessageOnlyException (s " Artifact for $name not found in $externalDeps " ))
283
+ externalNonBootstrappedDeps .find(_.get(artifact.key).exists(_.name == name))
284
+ .getOrElse(throw new MessageOnlyException (s " Artifact for $name not found in $externalNonBootstrappedDeps " ))
275
285
.data
276
286
277
287
val scalaLibrary = getExternalDep(" scala-library" )
@@ -286,7 +296,7 @@ object Build {
286
296
val dottyCompiler = packageBin.in(`dotty-compiler`, Compile ).value
287
297
val dottyDoc = packageBin.in(`dotty-doc`, Compile ).value
288
298
289
- val allJars = Seq (dottyLibrary, dottyInterfaces, dottyCompiler, dottyDoc) ++ externalDeps .map(_.data)
299
+ val allJars = Seq (dottyLibrary, dottyInterfaces, dottyCompiler, dottyDoc) ++ externalNonBootstrappedDeps .map(_.data)
290
300
291
301
makeScalaInstance(
292
302
state.value,
@@ -322,6 +332,15 @@ object Build {
322
332
323
333
/** Projects -------------------------------------------------------------- */
324
334
335
+ val dottyCompilerBootstrappedRef = LocalProject (" dotty-compiler-bootstrapped" )
336
+
337
+ /** External dependencies we may want to put on the compiler classpath. */
338
+ def externalCompilerClasspathTask : Def .Initialize [Task [Def .Classpath ]] =
339
+ // Even if we're running the non-bootstrapped compiler, we want the
340
+ // dependencies of the bootstrapped compiler since we want to put them on
341
+ // the compiler classpath, not the JVM classpath.
342
+ externalDependencyClasspath.in(dottyCompilerBootstrappedRef, Runtime )
343
+
325
344
// The root project:
326
345
// - aggregates other projects so that "compile", "test", etc are run on all projects at once.
327
346
// - publishes its own empty artifact "dotty" that depends on "dotty-library" and "dotty-compiler",
@@ -337,8 +356,8 @@ object Build {
337
356
val dottyLib = jars(" dotty-library" )
338
357
val dottyInterfaces = jars(" dotty-interfaces" )
339
358
val otherDeps = (dependencyClasspath in Compile ).value.map(_.data).mkString(File .pathSeparator)
340
- val attList = (dependencyClasspath in Runtime ) .value
341
- dottyLib + File .pathSeparator + findLib(attList , " scala-library-" )
359
+ val externalDeps = externalCompilerClasspathTask .value
360
+ dottyLib + File .pathSeparator + findLib(externalDeps , " scala-library-" )
342
361
}
343
362
344
363
def dottyDocSettings (implicit mode : Mode ) = Seq (
@@ -407,7 +426,7 @@ object Build {
407
426
case Bootstrapped => `dotty-doc-bootstrapped`
408
427
}
409
428
410
- def findLib (attList : Seq [ Attributed [ File ]] , name : String ) = attList
429
+ def findLib (classpath : Def . Classpath , name : String ) = classpath
411
430
.map(_.data.getAbsolutePath)
412
431
.find(_.contains(name))
413
432
.toList.mkString(File .pathSeparator)
@@ -442,7 +461,6 @@ object Build {
442
461
// get libraries onboard
443
462
libraryDependencies ++= Seq (
444
463
" org.scala-lang.modules" % " scala-asm" % " 6.0.0-scala-1" , // used by the backend
445
- " org.scala-lang" % " scala-library" % scalacVersion % " test" ,
446
464
Dependencies .`compiler-interface`,
447
465
" org.jline" % " jline-reader" % " 3.9.0" , // used by the REPL
448
466
" org.jline" % " jline-terminal" % " 3.9.0" ,
@@ -472,7 +490,7 @@ object Build {
472
490
// http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
473
491
// packageAll should always be run before tests
474
492
javaOptions ++= {
475
- val attList = (dependencyClasspath in Runtime ) .value
493
+ val externalDeps = externalCompilerClasspathTask .value
476
494
val jars = packageAll.value
477
495
478
496
val ci_build = // propagate if this is a ci build
@@ -499,11 +517,11 @@ object Build {
499
517
" -Ddotty.tests.classes.dottyInterfaces=" + jars(" dotty-interfaces" ),
500
518
" -Ddotty.tests.classes.dottyLibrary=" + jars(" dotty-library" ),
501
519
" -Ddotty.tests.classes.dottyCompiler=" + jars(" dotty-compiler" ),
502
- " -Ddotty.tests.classes.compilerInterface=" + findLib(attList , " compiler-interface" ),
503
- " -Ddotty.tests.classes.scalaLibrary=" + findLib(attList , " scala-library-" ),
504
- " -Ddotty.tests.classes.scalaAsm=" + findLib(attList , " scala-asm" ),
505
- " -Ddotty.tests.classes.jlineTerminal=" + findLib(attList , " jline-terminal" ),
506
- " -Ddotty.tests.classes.jlineReader=" + findLib(attList , " jline-reader" )
520
+ " -Ddotty.tests.classes.compilerInterface=" + findLib(externalDeps , " compiler-interface" ),
521
+ " -Ddotty.tests.classes.scalaLibrary=" + findLib(externalDeps , " scala-library-" ),
522
+ " -Ddotty.tests.classes.scalaAsm=" + findLib(externalDeps , " scala-asm" ),
523
+ " -Ddotty.tests.classes.jlineTerminal=" + findLib(externalDeps , " jline-terminal" ),
524
+ " -Ddotty.tests.classes.jlineReader=" + findLib(externalDeps , " jline-reader" )
507
525
)
508
526
509
527
jarOpts ::: tuning ::: agentOptions ::: ci_build
@@ -541,10 +559,10 @@ object Build {
541
559
542
560
dotr := {
543
561
val args : List [String ] = spaceDelimited(" <arg>" ).parsed.toList
544
- val attList = (dependencyClasspath in Runtime ) .value
562
+ val externalDeps = externalCompilerClasspathTask .value
545
563
val jars = packageAll.value
546
564
547
- val scalaLib = findLib(attList , " scala-library" )
565
+ val scalaLib = findLib(externalDeps , " scala-library" )
548
566
val dottyLib = jars(" dotty-library" )
549
567
550
568
def run (args : List [String ]): Unit = {
@@ -558,7 +576,7 @@ object Build {
558
576
println(" Couldn't find scala-library on classpath, please run using script in bin dir instead" )
559
577
} else if (args.contains(" -with-compiler" )) {
560
578
val args1 = args.filter(_ != " -with-compiler" )
561
- val asm = findLib(attList , " scala-asm" )
579
+ val asm = findLib(externalDeps , " scala-asm" )
562
580
val dottyCompiler = jars(" dotty-compiler" )
563
581
val dottyInterfaces = jars(" dotty-interfaces" )
564
582
run(insertClasspathInArgs(args1, List (dottyCompiler, dottyInterfaces, asm).mkString(File .pathSeparator)))
@@ -577,7 +595,7 @@ object Build {
577
595
ivyConfigurations += SourceDeps .hide,
578
596
transitiveClassifiers := Seq (" sources" ),
579
597
libraryDependencies +=
580
- (" org.scala-js" %% " scalajs-ir " % scalaJSVersion % " sourcedeps" ).withDottyCompat(scalaVersion.value),
598
+ (" org.scala-js" % " scalajs-ir_2.13.0-RC2 " % scalaJSVersion % " sourcedeps" ).withDottyCompat(scalaVersion.value),
581
599
sourceGenerators in Compile += Def .task {
582
600
val s = streams.value
583
601
val cacheDir = s.cacheDirectory
@@ -606,9 +624,9 @@ object Build {
606
624
607
625
def runCompilerMain (repl : Boolean = false ) = Def .inputTaskDyn {
608
626
val log = streams.value.log
609
- val attList = (dependencyClasspath in Runtime ) .value
627
+ val externalDeps = externalCompilerClasspathTask .value
610
628
val jars = packageAll.value
611
- val scalaLib = findLib(attList , " scala-library-" )
629
+ val scalaLib = findLib(externalDeps , " scala-library-" )
612
630
val dottyLib = jars(" dotty-library" )
613
631
val dottyCompiler = jars(" dotty-compiler" )
614
632
val args0 : List [String ] = spaceDelimited(" <arg>" ).parsed.toList
@@ -634,7 +652,7 @@ object Build {
634
652
log.error(" -with-compiler should only be used with a bootstrapped compiler" )
635
653
}
636
654
val dottyInterfaces = jars(" dotty-interfaces" )
637
- val asm = findLib(attList , " scala-asm" )
655
+ val asm = findLib(externalDeps , " scala-asm" )
638
656
extraClasspath ++= Seq (dottyCompiler, dottyInterfaces, asm)
639
657
}
640
658
@@ -696,8 +714,6 @@ object Build {
696
714
697
715
// Settings shared between dotty-library and dotty-library-bootstrapped
698
716
lazy val dottyLibrarySettings = Seq (
699
- libraryDependencies += " org.scala-lang" % " scala-library" % scalacVersion,
700
-
701
717
// Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called
702
718
scalacOptions in Compile ++= Seq (" -sourcepath" , (scalaSource in Compile ).value.getAbsolutePath),
703
719
@@ -767,7 +783,10 @@ object Build {
767
783
scalaSource in Test := baseDirectory.value,
768
784
javaSource in Test := baseDirectory.value,
769
785
770
- libraryDependencies += (Dependencies .`zinc-api-info` % Test ).withDottyCompat(scalaVersion.value)
786
+ // Tests disabled until zinc-api-info cross-compiles with 2.13,
787
+ // alternatively we could just copy in sources the part of zinc-api-info we need.
788
+ sources in Test := Seq (),
789
+ // libraryDependencies += (Dependencies.`zinc-api-info` % Test).withDottyCompat(scalaVersion.value)
771
790
)
772
791
773
792
lazy val `dotty-language-server` = project.in(file(" language-server" )).
@@ -949,20 +968,20 @@ object Build {
949
968
// depend on it via dotty-library, because sbt may rewrite dependencies
950
969
// (see https://github.com/sbt/sbt/pull/2634), but won't rewrite the direct
951
970
// dependencies of scala-library (see https://github.com/sbt/sbt/pull/2897)
952
- libraryDependencies += " org.scala-lang" % " scala-library" % scalacVersion
971
+ libraryDependencies += " org.scala-lang" % " scala-library" % stdlibVersion( Bootstrapped )
953
972
)
954
973
955
974
lazy val `scala-compiler` = project.
956
975
settings(commonDummySettings)
957
976
lazy val `scala-reflect` = project.
958
977
settings(commonDummySettings).
959
978
settings(
960
- libraryDependencies := Seq (" org.scala-lang" % " scala-reflect" % scalacVersion )
979
+ libraryDependencies := Seq (" org.scala-lang" % " scala-reflect" % stdlibVersion( Bootstrapped ) )
961
980
)
962
981
lazy val scalap = project.
963
982
settings(commonDummySettings).
964
983
settings(
965
- libraryDependencies := Seq (" org.scala-lang" % " scalap" % scalacVersion )
984
+ libraryDependencies := Seq (" org.scala-lang" % " scalap" % stdlibVersion( Bootstrapped ) )
966
985
)
967
986
968
987
@@ -1210,6 +1229,9 @@ object Build {
1210
1229
settings(dottyCompilerSettings)
1211
1230
1212
1231
def asDottyLibrary (implicit mode : Mode ): Project = project.withCommonSettings.
1232
+ settings(
1233
+ libraryDependencies += " org.scala-lang" % " scala-library" % stdlibVersion
1234
+ ).
1213
1235
settings(dottyLibrarySettings)
1214
1236
1215
1237
def asDottyDoc (implicit mode : Mode ): Project = project.withCommonSettings.
0 commit comments