@@ -121,10 +121,17 @@ object Build {
121
121
// Change this to true if you want to bootstrap using a published non-bootstrapped compiler
122
122
bootstrapFromPublishedJars := false ,
123
123
124
+ // enable improved incremental compilation algorithm
125
+ incOptions := incOptions.value.withNameHashing(true ),
126
+
124
127
// Override `runCode` from sbt-dotty to use the language-server and
125
128
// vscode extension from the source repository of dotty instead of a
126
129
// published version.
127
- runCode := (run in `dotty-language-server`).toTask(" " ).value
130
+ runCode := (run in `dotty-language-server`).toTask(" " ).value,
131
+
132
+ // include sources in eclipse (downloads source code for all dependencies)
133
+ // http://stackoverflow.com/questions/10472840/how-to-attach-sources-to-sbt-managed-dependencies-in-scala-ide#answer-11683728
134
+ EclipseKeys .withSource := true
128
135
)
129
136
130
137
// Settings shared globally (scoped in Global). Used in build.sbt
@@ -180,7 +187,22 @@ object Build {
180
187
resourceDirectory in Test := baseDirectory.value / " test-resources" ,
181
188
182
189
// Prevent sbt from rewriting our dependencies
183
- ivyScala ~= (_ map (_ copy (overrideScalaVersion = false )))
190
+ ivyScala ~= (_ map (_ copy (overrideScalaVersion = false ))),
191
+
192
+ test in Test := {
193
+ // Exclude legacy tests by default
194
+ (testOnly in Test ).toTask(" -- --exclude-categories=dotty.LegacyTests,dotty.SlowTests" ).value
195
+ },
196
+
197
+ testAll in Test := {
198
+ // Exclude legacy tests by default
199
+ (testOnly in Test ).toTask(" -- --exclude-categories=dotty.LegacyTests" ).value
200
+ },
201
+
202
+ libraryDependencies += " com.novocode" % " junit-interface" % " 0.11" % Test ,
203
+
204
+ // enable verbose exception messages for JUnit
205
+ testOptions in Test += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" )
184
206
)
185
207
186
208
// Settings used for projects compiled only with Scala 2
@@ -345,9 +367,6 @@ object Build {
345
367
connectInput in run := true ,
346
368
outputStrategy := Some (StdoutOutput ),
347
369
348
- // enable verbose exception messages for JUnit
349
- testOptions in Test += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" ),
350
-
351
370
javaOptions ++= (javaOptions in `dotty-compiler`).value,
352
371
fork in run := true ,
353
372
fork in Test := true ,
@@ -387,7 +406,6 @@ object Build {
387
406
}.evaluated,
388
407
389
408
libraryDependencies ++= Seq (
390
- " com.novocode" % " junit-interface" % " 0.11" % " test" ,
391
409
" com.vladsch.flexmark" % " flexmark" % " 0.11.1" ,
392
410
" com.vladsch.flexmark" % " flexmark-ext-gfm-tasklist" % " 0.11.1" ,
393
411
" com.vladsch.flexmark" % " flexmark-ext-gfm-tables" % " 0.11.1" ,
@@ -455,9 +473,6 @@ object Build {
455
473
pairs.map(_._2)
456
474
}.taskValue,
457
475
458
- // Used by the backend
459
- libraryDependencies += " org.scala-lang.modules" % " scala-asm" % " 6.0.0-scala-1" ,
460
-
461
476
// set system in/out for repl
462
477
connectInput in run := true ,
463
478
outputStrategy := Some (StdoutOutput ),
@@ -483,32 +498,73 @@ object Build {
483
498
Seq (file)
484
499
}.taskValue,
485
500
486
- // include sources in eclipse (downloads source code for all dependencies)
487
- // http://stackoverflow.com/questions/10472840/how-to-attach-sources-to-sbt-managed-dependencies-in-scala-ide#answer-11683728
488
- com.typesafe.sbteclipse.plugin.EclipsePlugin .EclipseKeys .withSource := true ,
489
-
490
501
// get libraries onboard
491
- libraryDependencies ++= Seq (" com.typesafe.sbt" % " sbt-interface" % sbtVersion.value,
492
- (" org.scala-lang.modules" %% " scala-xml" % " 1.0.6" ).withDottyCompat(),
493
- " com.novocode" % " junit-interface" % " 0.11" % " test" ,
494
- " org.scala-lang" % " scala-library" % scalacVersion % " test" ),
495
-
496
- // enable improved incremental compilation algorithm
497
- incOptions := incOptions.value.withNameHashing(true ),
502
+ libraryDependencies ++= Seq (
503
+ " org.scala-lang.modules" % " scala-asm" % " 6.0.0-scala-1" , // used by the backend
504
+ " com.typesafe.sbt" % " sbt-interface" % sbtVersion.value,
505
+ (" org.scala-lang.modules" %% " scala-xml" % " 1.0.6" ).withDottyCompat(),
506
+ " org.scala-lang" % " scala-library" % scalacVersion % " test"
507
+ ),
498
508
499
509
// For convenience, change the baseDirectory when running the compiler
500
510
baseDirectory in (Compile , run) := baseDirectory.value / " .." ,
501
511
// .. but not when running test
502
512
baseDirectory in (Test , run) := baseDirectory.value,
503
513
504
- test in Test := {
505
- // Exclude legacy tests by default
506
- (testOnly in Test ).toTask(" -- --exclude-categories=dotty.LegacyTests,dotty.SlowTests" ).value
507
- },
514
+ testOptions in Test += Tests .Argument (
515
+ TestFrameworks .JUnit , " --run-listener=dotty.tools.ContextEscapeDetector"
516
+ ),
517
+
518
+ // Spawn new JVM in run and test
519
+ fork in run := true ,
520
+ fork in Test := true ,
521
+ parallelExecution in Test := false ,
522
+
523
+ // Add git-hash used to package the distribution to the manifest to know it in runtime and report it in REPL
524
+ packageOptions += ManifestAttributes ((" Git-Hash" , VersionUtil .gitHash)),
525
+
526
+ // http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
527
+ // packageAll should always be run before tests
528
+ javaOptions ++= {
529
+ val attList = (dependencyClasspath in Runtime ).value
530
+ val pA = packageAll.value
531
+
532
+ // put needed dependencies on classpath:
533
+ val path = for {
534
+ file <- attList.map(_.data)
535
+ path = file.getAbsolutePath
536
+ // FIXME: when we snip the cord, this should go bye-bye
537
+ if path.contains(" scala-library" ) ||
538
+ // FIXME: currently needed for tests referencing scalac internals
539
+ path.contains(" scala-reflect" ) ||
540
+ // FIXME: should go away when xml literal parsing is removed
541
+ path.contains(" scala-xml" ) ||
542
+ // used for tests that compile dotty
543
+ path.contains(" scala-asm" ) ||
544
+ // needed for the xsbti interface
545
+ path.contains(" sbt-interface" )
546
+ } yield " -Xbootclasspath/p:" + path
547
+
548
+ val ci_build = // propagate if this is a ci build
549
+ if (sys.props.isDefinedAt(JENKINS_BUILD ))
550
+ List (s " -D $JENKINS_BUILD= ${sys.props(JENKINS_BUILD )}" ) ::: jenkinsMemLimit
551
+ else if (sys.props.isDefinedAt(DRONE_MEM ))
552
+ List (" -Xmx" + sys.props(DRONE_MEM ))
553
+ else List ()
554
+
555
+ val tuning =
556
+ if (sys.props.isDefinedAt(" Oshort" ))
557
+ // Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
558
+ List (" -XX:+TieredCompilation" , " -XX:TieredStopAtLevel=1" )
559
+ else List ()
560
+
561
+ val jars = List (
562
+ " -Ddotty.tests.classes.interfaces=" + pA(" dotty-interfaces" ),
563
+ " -Ddotty.tests.classes.library=" + pA(" dotty-library" ),
564
+ " -Ddotty.tests.classes.compiler=" + pA(" dotty-compiler" )
565
+ )
508
566
509
- testAll in Test := {
510
- // Exclude legacy tests by default
511
- (testOnly in Test ).toTask(" -- --exclude-categories=dotty.LegacyTests" ).value
567
+ jars ::: tuning ::: agentOptions ::: ci_build ::: path.toList
512
568
},
513
569
514
570
vulpix := Def .inputTaskDyn {
@@ -545,13 +601,7 @@ object Build {
545
601
},
546
602
run := dotc.evaluated,
547
603
dotc := runCompilerMain().evaluated,
548
- repl := runCompilerMain(repl = true ).evaluated,
549
-
550
- // enable verbose exception messages for JUnit
551
- testOptions in Test += Tests .Argument (
552
- TestFrameworks .JUnit , " -a" , " -v" ,
553
- " --run-listener=dotty.tools.ContextEscapeDetector"
554
- ),
604
+ repl := runCompilerMain(repl = true ).evaluated
555
605
556
606
/* Add the sources of scalajs-ir.
557
607
* To guarantee that dotty can bootstrap without depending on a version
@@ -584,59 +634,7 @@ object Build {
584
634
// IO.unzip(scalaJSIRSourcesJar, trgDir)
585
635
// (trgDir ** "*.scala").get.toSet
586
636
// } (Set(scalaJSIRSourcesJar)).toSeq
587
- // }.taskValue,
588
-
589
- // Spawn new JVM in run and test
590
- fork in run := true ,
591
- fork in Test := true ,
592
- parallelExecution in Test := false ,
593
-
594
- // Add git-hash used to package the distribution to the manifest to know it in runtime and report it in REPL
595
- packageOptions += ManifestAttributes ((" Git-Hash" , VersionUtil .gitHash)),
596
-
597
- // http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
598
- // packageAll should always be run before tests
599
- javaOptions ++= {
600
- val attList = (dependencyClasspath in Runtime ).value
601
- val pA = packageAll.value
602
-
603
- // put needed dependencies on classpath:
604
- val path = for {
605
- file <- attList.map(_.data)
606
- path = file.getAbsolutePath
607
- // FIXME: when we snip the cord, this should go bye-bye
608
- if path.contains(" scala-library" ) ||
609
- // FIXME: currently needed for tests referencing scalac internals
610
- path.contains(" scala-reflect" ) ||
611
- // FIXME: should go away when xml literal parsing is removed
612
- path.contains(" scala-xml" ) ||
613
- // used for tests that compile dotty
614
- path.contains(" scala-asm" ) ||
615
- // needed for the xsbti interface
616
- path.contains(" sbt-interface" )
617
- } yield " -Xbootclasspath/p:" + path
618
-
619
- val ci_build = // propagate if this is a ci build
620
- if (sys.props.isDefinedAt(JENKINS_BUILD ))
621
- List (s " -D $JENKINS_BUILD= ${sys.props(JENKINS_BUILD )}" ) ::: jenkinsMemLimit
622
- else if (sys.props.isDefinedAt(DRONE_MEM ))
623
- List (" -Xmx" + sys.props(DRONE_MEM ))
624
- else List ()
625
-
626
- val tuning =
627
- if (sys.props.isDefinedAt(" Oshort" ))
628
- // Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
629
- List (" -XX:+TieredCompilation" , " -XX:TieredStopAtLevel=1" )
630
- else List ()
631
-
632
- val jars = List (
633
- " -Ddotty.tests.classes.interfaces=" + pA(" dotty-interfaces" ),
634
- " -Ddotty.tests.classes.library=" + pA(" dotty-library" ),
635
- " -Ddotty.tests.classes.compiler=" + pA(" dotty-compiler" )
636
- )
637
-
638
- jars ::: tuning ::: agentOptions ::: ci_build ::: path.toList
639
- }
637
+ // }.taskValue
640
638
)
641
639
642
640
def runCompilerMain (repl : Boolean = false ) = Def .inputTaskDyn {
@@ -678,7 +676,7 @@ object Build {
678
676
" dotty-compiler" -> (packageBin in Compile ).value,
679
677
" dotty-library" -> (packageBin in (`dotty-library`, Compile )).value,
680
678
" dotty-compiler-test" -> (packageBin in Test ).value
681
- ) map { case (k, v) => (k, v .getAbsolutePath) }
679
+ ).mapValues(_ .getAbsolutePath)
682
680
}
683
681
)
684
682
@@ -706,10 +704,7 @@ object Build {
706
704
707
705
// Settings shared between dotty-library and dotty-library-bootstrapped
708
706
lazy val dottyLibrarySettings = Seq (
709
- libraryDependencies ++= Seq (
710
- " org.scala-lang" % " scala-library" % scalacVersion,
711
- " com.novocode" % " junit-interface" % " 0.11" % " test"
712
- )
707
+ libraryDependencies += " org.scala-lang" % " scala-library" % scalacVersion
713
708
)
714
709
715
710
lazy val `dotty-library` = project.in(file(" library" )).asDottyLibrary(NonBootstrapped )
0 commit comments