@@ -30,6 +30,7 @@ import scala.util.Properties.isJavaAtLeast
30
30
31
31
object Build {
32
32
val scalacVersion = " 2.12.8"
33
+ val referenceVersion = " 0.14.0-RC1"
33
34
34
35
val baseVersion = " 0.15.0"
35
36
val baseSbtDottyVersion = " 0.3.2"
@@ -182,21 +183,31 @@ object Build {
182
183
// Settings used for projects compiled only with Java
183
184
lazy val commonJavaSettings = commonSettings ++ Seq (
184
185
version := dottyVersion,
185
- scalaVersion := scalacVersion,
186
+ scalaVersion := referenceVersion,
187
+ // To be removed once we stop cross-compiling with Scala 2
188
+ crossScalaVersions := Seq (referenceVersion, scalacVersion),
186
189
// Do not append Scala versions to the generated artifacts
187
190
crossPaths := false ,
188
191
// Do not depend on the Scala library
189
192
autoScalaLibrary := false
190
193
)
191
194
192
- // Settings used when compiling dotty using Scala 2
193
- lazy val commonNonBootstrappedSettings = commonSettings ++ Seq (
195
+ // Settings used when compiling dotty (both non-boostrapped and bootstrapped)
196
+ lazy val commonDottySettings = commonSettings ++ Seq (
197
+ // Manually set the standard library to use
198
+ autoScalaLibrary := false
199
+ )
200
+
201
+ // Settings used when compiling dotty with the reference compiler
202
+ lazy val commonNonBootstrappedSettings = commonDottySettings ++ Seq (
194
203
version := dottyNonBootstrappedVersion,
195
- scalaVersion := scalacVersion
204
+ scalaVersion := referenceVersion,
205
+ // To be removed once we stop cross-compiling with Scala 2
206
+ crossScalaVersions := Seq (referenceVersion, scalacVersion)
196
207
)
197
208
198
209
// Settings used when compiling dotty with a non-bootstrapped dotty
199
- lazy val commonBootstrappedSettings = commonSettings ++ Seq (
210
+ lazy val commonBootstrappedSettings = commonDottySettings ++ Seq (
200
211
version := dottyVersion,
201
212
scalaVersion := dottyNonBootstrappedVersion,
202
213
@@ -219,11 +230,6 @@ object Build {
219
230
// sbt gets very unhappy if two projects use the same target
220
231
target := baseDirectory.value / " .." / " out" / " bootstrap" / name.value,
221
232
222
- // The non-bootstrapped dotty-library is not necessary when bootstrapping dotty
223
- autoScalaLibrary := false ,
224
- // ...but scala-library is
225
- libraryDependencies += " org.scala-lang" % " scala-library" % scalacVersion,
226
-
227
233
// Compile using the non-bootstrapped and non-published dotty
228
234
managedScalaInstance := false ,
229
235
scalaInstance := {
@@ -463,13 +469,20 @@ object Build {
463
469
List (" -XX:+TieredCompilation" , " -XX:TieredStopAtLevel=1" )
464
470
else List ()
465
471
472
+ val managedSrcDir = {
473
+ // Populate the directory
474
+ (managedSources in Compile ).value
475
+
476
+ (sourceManaged in Compile ).value
477
+ }
478
+
466
479
val jarOpts = List (
467
- " -Ddotty.tests.dottyCompilerManagedSources=" + (sourceManaged in Compile ).value ,
480
+ " -Ddotty.tests.dottyCompilerManagedSources=" + managedSrcDir ,
468
481
" -Ddotty.tests.classes.dottyInterfaces=" + jars(" dotty-interfaces" ),
469
482
" -Ddotty.tests.classes.dottyLibrary=" + jars(" dotty-library" ),
470
483
" -Ddotty.tests.classes.dottyCompiler=" + jars(" dotty-compiler" ),
471
484
" -Ddotty.tests.classes.compilerInterface=" + findLib(attList, " compiler-interface" ),
472
- " -Ddotty.tests.classes.scalaLibrary=" + findLib(attList, " scala-library" ),
485
+ " -Ddotty.tests.classes.scalaLibrary=" + findLib(attList, " scala-library- " ),
473
486
" -Ddotty.tests.classes.scalaAsm=" + findLib(attList, " scala-asm" ),
474
487
" -Ddotty.tests.classes.scalaXml=" + findLib(attList, " scala-xml" ),
475
488
" -Ddotty.tests.classes.jlineTerminal=" + findLib(attList, " jline-terminal" ),
@@ -527,9 +540,6 @@ object Build {
527
540
} else if (scalaLib == " " ) {
528
541
println(" Couldn't find scala-library on classpath, please run using script in bin dir instead" )
529
542
} else if (args.contains(" -with-compiler" )) {
530
- if (! isDotty.value) {
531
- throw new MessageOnlyException (" -with-compiler can only be used with a bootstrapped compiler" )
532
- }
533
543
val args1 = args.filter(_ != " -with-compiler" )
534
544
val asm = findLib(attList, " scala-asm" )
535
545
val dottyCompiler = jars(" dotty-compiler" )
@@ -580,7 +590,7 @@ object Build {
580
590
def runCompilerMain (repl : Boolean = false ) = Def .inputTaskDyn {
581
591
val attList = (dependencyClasspath in Runtime ).value
582
592
val jars = packageAll.value
583
- val scalaLib = findLib(attList, " scala-library" )
593
+ val scalaLib = findLib(attList, " scala-library- " )
584
594
val dottyLib = jars(" dotty-library" )
585
595
val dottyCompiler = jars(" dotty-compiler" )
586
596
val args0 : List [String ] = spaceDelimited(" <arg>" ).parsed.toList
@@ -598,12 +608,8 @@ object Build {
598
608
599
609
var extraClasspath = s " $scalaLib${File .pathSeparator}$dottyLib"
600
610
if ((decompile || printTasty) && ! args.contains(" -classpath" )) extraClasspath += s " ${File .pathSeparator}. "
601
- if (args0.contains(" -with-compiler" )) {
602
- if (! isDotty.value) {
603
- throw new MessageOnlyException (" -with-compiler can only be used with a bootstrapped compiler" )
604
- }
611
+ if (args0.contains(" -with-compiler" ))
605
612
extraClasspath += s " ${File .pathSeparator}$dottyCompiler"
606
- }
607
613
608
614
val fullArgs = main :: insertClasspathInArgs(args, extraClasspath)
609
615
@@ -664,15 +670,32 @@ object Build {
664
670
// Settings shared between dotty-library and dotty-library-bootstrapped
665
671
lazy val dottyLibrarySettings = Seq (
666
672
libraryDependencies += " org.scala-lang" % " scala-library" % scalacVersion,
673
+
674
+ // Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called
675
+ scalacOptions in Compile ++= Seq (" -sourcepath" , (scalaSource in Compile ).value.getAbsolutePath),
676
+
677
+ // To be removed once we stop cross-compiling with Scala 2
678
+ unmanagedSourceDirectories in Compile += {
679
+ val baseDir = baseDirectory.value
680
+ if (! isDotty.value)
681
+ baseDir / " src-2.x"
682
+ else
683
+ baseDir / " src-3.x"
684
+ },
685
+
667
686
// Add version-specific source directories:
668
- // - files in src-non-bootstrapped will only be compiled by the reference compiler (scalac)
687
+ // - files in src-non-bootstrapped will only be compiled by the reference compiler
669
688
// - files in src-bootstrapped will only be compiled by the current dotty compiler (non-bootstrapped and bootstrapped)
670
- unmanagedSourceDirectories in Compile += {
689
+ unmanagedSourceDirectories in Compile ++ = {
671
690
val baseDir = baseDirectory.value
672
- if (isDotty.value)
673
- baseDir / " src-bootstrapped"
691
+ if (isDotty.value) {
692
+ if (scalaVersion.value == referenceVersion)
693
+ Seq (baseDir / " src-non-bootstrapped" )
694
+ else
695
+ Seq (baseDir / " src-bootstrapped" )
696
+ }
674
697
else
675
- baseDir / " src-non-bootstrapped "
698
+ Seq ()
676
699
}
677
700
)
678
701
@@ -949,8 +972,12 @@ object Build {
949
972
val updateCommunityBuild = taskKey[Unit ](" Updates the community build." )
950
973
951
974
lazy val `community-build` = project.in(file(" community-build" )).
952
- settings(commonNonBootstrappedSettings ).
975
+ settings(commonSettings ).
953
976
settings(
977
+ scalaVersion := referenceVersion,
978
+ // To be removed once we stop cross-compiling with Scala 2
979
+ crossScalaVersions := Seq (referenceVersion, scalacVersion),
980
+
954
981
prepareCommunityBuild := {
955
982
(publishLocal in `dotty-sbt-bridge`).value
956
983
(publishLocal in `dotty-interfaces`).value
@@ -1095,11 +1122,7 @@ object Build {
1095
1122
settings(dottyCompilerSettings)
1096
1123
1097
1124
def asDottyLibrary (implicit mode : Mode ): Project = project.withCommonSettings.
1098
- settings(dottyLibrarySettings).
1099
- bootstrappedSettings(
1100
- // Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called.
1101
- scalacOptions in Compile ++= Seq (" -sourcepath" , (scalaSource in Compile ).value.getAbsolutePath)
1102
- )
1125
+ settings(dottyLibrarySettings)
1103
1126
1104
1127
def asDottyDoc (implicit mode : Mode ): Project = project.withCommonSettings.
1105
1128
dependsOn(dottyCompiler, dottyCompiler % " test->test" ).
0 commit comments