@@ -72,14 +72,11 @@ object Build {
72
72
lazy val packageAll =
73
73
taskKey[Map [String , String ]](" Package everything needed to run tests" )
74
74
75
- // Spawns a repl with the correct classpath
76
- lazy val repl = inputKey[Unit ](" run the REPL with correct classpath" )
77
-
78
75
// Run tests with filter through vulpix test suite
79
- lazy val vulpix = inputKey[Unit ](" runs integration test with the supplied filter" )
76
+ lazy val testCompilation = inputKey[Unit ](" runs integration test with the supplied filter" )
80
77
81
- // Run all tests including tests marked with SlowTests
82
- lazy val testAll = inputKey[Unit ](" runs all tests including SlowTests " )
78
+ // Spawns a repl with the correct classpath
79
+ lazy val repl = inputKey[Unit ](" run the REPL with correct classpath " )
83
80
84
81
// Used to compile files similar to ./bin/dotc script
85
82
lazy val dotc =
@@ -124,7 +121,11 @@ object Build {
124
121
// Override `runCode` from sbt-dotty to use the language-server and
125
122
// vscode extension from the source repository of dotty instead of a
126
123
// published version.
127
- runCode := (run in `dotty-language-server`).toTask(" " ).value
124
+ runCode := (run in `dotty-language-server`).toTask(" " ).value,
125
+
126
+ // include sources in eclipse (downloads source code for all dependencies)
127
+ // http://stackoverflow.com/questions/10472840/how-to-attach-sources-to-sbt-managed-dependencies-in-scala-ide#answer-11683728
128
+ EclipseKeys .withSource := true
128
129
)
129
130
130
131
// Settings shared globally (scoped in Global). Used in build.sbt
@@ -180,7 +181,12 @@ object Build {
180
181
resourceDirectory in Test := baseDirectory.value / " test-resources" ,
181
182
182
183
// Prevent sbt from rewriting our dependencies
183
- ivyScala ~= (_ map (_ copy (overrideScalaVersion = false )))
184
+ ivyScala ~= (_ map (_ copy (overrideScalaVersion = false ))),
185
+
186
+ libraryDependencies += " com.novocode" % " junit-interface" % " 0.11" % Test ,
187
+
188
+ // enable verbose exception messages for JUnit
189
+ testOptions in Test += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" )
184
190
)
185
191
186
192
// Settings used for projects compiled only with Scala 2
@@ -345,9 +351,6 @@ object Build {
345
351
connectInput in run := true ,
346
352
outputStrategy := Some (StdoutOutput ),
347
353
348
- // enable verbose exception messages for JUnit
349
- testOptions in Test += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" ),
350
-
351
354
javaOptions ++= (javaOptions in `dotty-compiler`).value,
352
355
fork in run := true ,
353
356
fork in Test := true ,
@@ -387,7 +390,6 @@ object Build {
387
390
}.evaluated,
388
391
389
392
libraryDependencies ++= Seq (
390
- " com.novocode" % " junit-interface" % " 0.11" % " test" ,
391
393
" com.vladsch.flexmark" % " flexmark" % " 0.11.1" ,
392
394
" com.vladsch.flexmark" % " flexmark-ext-gfm-tasklist" % " 0.11.1" ,
393
395
" com.vladsch.flexmark" % " flexmark-ext-gfm-tables" % " 0.11.1" ,
@@ -455,9 +457,6 @@ object Build {
455
457
pairs.map(_._2)
456
458
}.taskValue,
457
459
458
- // Used by the backend
459
- libraryDependencies += " org.scala-lang.modules" % " scala-asm" % " 6.0.0-scala-1" ,
460
-
461
460
// set system in/out for repl
462
461
connectInput in run := true ,
463
462
outputStrategy := Some (StdoutOutput ),
@@ -483,18 +482,13 @@ object Build {
483
482
Seq (file)
484
483
}.taskValue,
485
484
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
485
// 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 ),
486
+ libraryDependencies ++= Seq (
487
+ " org.scala-lang.modules" % " scala-asm" % " 6.0.0-scala-1" , // used by the backend
488
+ " com.typesafe.sbt" % " sbt-interface" % sbtVersion.value,
489
+ (" org.scala-lang.modules" %% " scala-xml" % " 1.0.6" ).withDottyCompat(),
490
+ " org.scala-lang" % " scala-library" % scalacVersion % " test"
491
+ ),
498
492
499
493
// For convenience, change the baseDirectory when running the compiler
500
494
baseDirectory in (Compile , run) := baseDirectory.value / " .." ,
@@ -503,15 +497,66 @@ object Build {
503
497
504
498
test in Test := {
505
499
// Exclude legacy tests by default
506
- (testOnly in Test ).toTask(" -- --exclude-categories=dotty.LegacyTests,dotty.SlowTests " ).value
500
+ (testOnly in Test ).toTask(" -- --exclude-categories=dotty.LegacyTests" ).value
507
501
},
508
502
509
- testAll in Test := {
510
- // Exclude legacy tests by default
511
- (testOnly in Test ).toTask(" -- --exclude-categories=dotty.LegacyTests" ).value
503
+ testOptions in Test += Tests .Argument (
504
+ TestFrameworks .JUnit , " --run-listener=dotty.tools.ContextEscapeDetector"
505
+ ),
506
+
507
+ // Spawn new JVM in run and test
508
+ fork in run := true ,
509
+ fork in Test := true ,
510
+ parallelExecution in Test := false ,
511
+
512
+ // Add git-hash used to package the distribution to the manifest to know it in runtime and report it in REPL
513
+ packageOptions += ManifestAttributes ((" Git-Hash" , VersionUtil .gitHash)),
514
+
515
+ // http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
516
+ // packageAll should always be run before tests
517
+ javaOptions ++= {
518
+ val attList = (dependencyClasspath in Runtime ).value
519
+ val pA = packageAll.value
520
+
521
+ // put needed dependencies on classpath:
522
+ val path = for {
523
+ file <- attList.map(_.data)
524
+ path = file.getAbsolutePath
525
+ // FIXME: when we snip the cord, this should go bye-bye
526
+ if path.contains(" scala-library" ) ||
527
+ // FIXME: currently needed for tests referencing scalac internals
528
+ path.contains(" scala-reflect" ) ||
529
+ // FIXME: should go away when xml literal parsing is removed
530
+ path.contains(" scala-xml" ) ||
531
+ // used for tests that compile dotty
532
+ path.contains(" scala-asm" ) ||
533
+ // needed for the xsbti interface
534
+ path.contains(" sbt-interface" )
535
+ } yield " -Xbootclasspath/p:" + path
536
+
537
+ val ci_build = // propagate if this is a ci build
538
+ if (sys.props.isDefinedAt(JENKINS_BUILD ))
539
+ List (s " -D $JENKINS_BUILD= ${sys.props(JENKINS_BUILD )}" ) ::: jenkinsMemLimit
540
+ else if (sys.props.isDefinedAt(DRONE_MEM ))
541
+ List (" -Xmx" + sys.props(DRONE_MEM ))
542
+ else List ()
543
+
544
+ val tuning =
545
+ if (sys.props.isDefinedAt(" Oshort" ))
546
+ // Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
547
+ List (" -XX:+TieredCompilation" , " -XX:TieredStopAtLevel=1" )
548
+ else List ()
549
+
550
+ val jars = List (
551
+ " -Ddotty.tests.classes.interfaces=" + pA(" dotty-interfaces" ),
552
+ " -Ddotty.tests.classes.library=" + pA(" dotty-library" ),
553
+ " -Ddotty.tests.classes.compiler=" + pA(" dotty-compiler" )
554
+ )
555
+
556
+ jars ::: tuning ::: agentOptions ::: ci_build ::: path.toList
512
557
},
513
558
514
- vulpix := Def .inputTaskDyn {
559
+ testCompilation := Def .inputTaskDyn {
515
560
val args : Seq [String ] = spaceDelimited(" <arg>" ).parsed
516
561
val cmd = " dotty.tools.dotc.CompilationTests -- --exclude-categories=dotty.SlowTests" + {
517
562
if (args.nonEmpty) " -Ddotty.tests.filter=" + args.mkString(" " )
@@ -545,13 +590,7 @@ object Build {
545
590
},
546
591
run := dotc.evaluated,
547
592
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
- ),
593
+ repl := runCompilerMain(repl = true ).evaluated
555
594
556
595
/* Add the sources of scalajs-ir.
557
596
* To guarantee that dotty can bootstrap without depending on a version
@@ -584,59 +623,7 @@ object Build {
584
623
// IO.unzip(scalaJSIRSourcesJar, trgDir)
585
624
// (trgDir ** "*.scala").get.toSet
586
625
// } (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
- }
626
+ // }.taskValue
640
627
)
641
628
642
629
def runCompilerMain (repl : Boolean = false ) = Def .inputTaskDyn {
@@ -678,7 +665,7 @@ object Build {
678
665
" dotty-compiler" -> (packageBin in Compile ).value,
679
666
" dotty-library" -> (packageBin in (`dotty-library`, Compile )).value,
680
667
" dotty-compiler-test" -> (packageBin in Test ).value
681
- ) map { case (k, v) => (k, v .getAbsolutePath) }
668
+ ).mapValues(_ .getAbsolutePath)
682
669
}
683
670
)
684
671
@@ -706,10 +693,7 @@ object Build {
706
693
707
694
// Settings shared between dotty-library and dotty-library-bootstrapped
708
695
lazy val dottyLibrarySettings = Seq (
709
- libraryDependencies ++= Seq (
710
- " org.scala-lang" % " scala-library" % scalacVersion,
711
- " com.novocode" % " junit-interface" % " 0.11" % " test"
712
- )
696
+ libraryDependencies += " org.scala-lang" % " scala-library" % scalacVersion
713
697
)
714
698
715
699
lazy val `dotty-library` = project.in(file(" library" )).asDottyLibrary(NonBootstrapped )
0 commit comments