@@ -227,12 +227,6 @@ object Build {
227
227
// Bootstrap with -optimise
228
228
lazy val commonOptimisedSettings = commonBootstrappedSettings ++ Seq (scalacOptions ++= Seq (" -optimise" ))
229
229
230
- def commonDottySettings (implicit mode : Mode ): Seq [sbt.Def .Setting [_]] = mode match {
231
- case NonBootstrapped => commonNonBootstrappedSettings
232
- case Bootstrapped => commonBootstrappedSettings
233
- case BootstrappedOptimised => commonOptimisedSettings
234
- }
235
-
236
230
lazy val commonBenchmarkSettings = Seq (
237
231
mainClass in (Jmh , run) := Some (" dotty.tools.benchmarks.Bench" ), // custom main for jmh:run
238
232
javaOptions += " -DBENCH_CLASS_PATH=" + Attributed .data((fullClasspath in Compile ).value).mkString(" " , " :" , " " )
@@ -245,7 +239,7 @@ object Build {
245
239
// This means that we need to provide dummy artefacts for these projects,
246
240
// otherwise users will get compilation errors if they happen to transitively
247
241
// depend on one of these projects.
248
- lazy val commonDummySettings = commonDottySettings( Bootstrapped ) ++ Seq (
242
+ lazy val commonDummySettings = commonBootstrappedSettings ++ Seq (
249
243
crossPaths := false ,
250
244
libraryDependencies := Seq ()
251
245
)
@@ -726,7 +720,7 @@ object Build {
726
720
727
721
lazy val `dotty-language-server` = project.in(file(" language-server" )).
728
722
dependsOn(dottyCompiler(Bootstrapped )).
729
- settings(commonDottySettings( Bootstrapped ) ).
723
+ settings(commonBootstrappedSettings ).
730
724
settings(
731
725
// Sources representing the shared configuration file used to communicate between the sbt-dotty
732
726
// plugin and the language server
@@ -770,7 +764,7 @@ object Build {
770
764
*/
771
765
lazy val sjsSandbox = project.in(file(" sandbox/scalajs" )).
772
766
enablePlugins(ScalaJSPlugin ).
773
- settings(commonDottySettings( NonBootstrapped ) ).
767
+ settings(commonNonBootstrappedSettings ).
774
768
settings(
775
769
/* Remove the Scala.js compiler plugin for scalac, and enable the
776
770
* Scala.js back-end of dotty instead.
@@ -1112,12 +1106,11 @@ object Build {
1112
1106
implicit class ProjectDefinitions (val project : Project ) extends AnyVal {
1113
1107
1114
1108
// FIXME: we do not aggregate `bin` because its tests delete jars, thus breaking other tests
1115
- def asDottyRoot (implicit mode : Mode ): Project = project.
1109
+ def asDottyRoot (implicit mode : Mode ): Project = project.withCommonSettings.
1116
1110
aggregate(`dotty-interfaces`, dottyLibrary, dottyCompiler, dottyDoc, `dotty-language-server`, dottySbtBridgeReference).
1117
1111
bootstrappedAggregate(`scala-library`, `scala-compiler`, `scala-reflect`, scalap).
1118
1112
dependsOn(dottyCompiler).
1119
1113
dependsOn(dottyLibrary).
1120
- settings(commonDottySettings).
1121
1114
nonBootstrappedSettings(
1122
1115
triggeredMessage in ThisBuild := Watched .clearWhenTriggered,
1123
1116
dottyProjectFolderChecks,
@@ -1126,45 +1119,45 @@ object Build {
1126
1119
addCommandAlias(" legacyTests" , " dotty-compiler/testOnly dotc.tests" )
1127
1120
)
1128
1121
1129
- def asDottyCompiler (implicit mode : Mode ): Project = project.
1122
+ def asDottyCompiler (implicit mode : Mode ): Project = project.withCommonSettings.
1130
1123
dependsOn(`dotty-interfaces`).
1131
1124
dependsOn(dottyLibrary).
1132
- settings(commonDottySettings).
1133
1125
settings(dottyCompilerSettings)
1134
1126
1135
- def asDottyLibrary (implicit mode : Mode ): Project = project.
1136
- settings(commonDottySettings).
1127
+ def asDottyLibrary (implicit mode : Mode ): Project = project.withCommonSettings.
1137
1128
settings(dottyLibrarySettings).
1138
1129
bootstrappedSettings(
1139
1130
// Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called.
1140
1131
scalacOptions in Compile ++= Seq (" -sourcepath" , (scalaSource in Compile ).value.getAbsolutePath)
1141
1132
)
1142
1133
1143
- def asDottyDoc (implicit mode : Mode ): Project = project.
1134
+ def asDottyDoc (implicit mode : Mode ): Project = project.withCommonSettings.
1144
1135
dependsOn(dottyCompiler, dottyCompiler % " test->test" ).
1145
- settings(commonDottySettings).
1146
1136
settings(dottyDocSettings)
1147
1137
1148
- def asDottySbtBridge (implicit mode : Mode ): Project = project.
1138
+ def asDottySbtBridge (implicit mode : Mode ): Project = project.withCommonSettings.
1149
1139
dependsOn(dottyCompiler).
1150
- settings(commonDottySettings).
1151
1140
settings(dottySbtBridgeSettings)
1152
1141
1153
- def asDottyBench (implicit mode : Mode ): Project = project.
1142
+ def asDottyBench (implicit mode : Mode ): Project = project.withCommonSettings.
1154
1143
dependsOn(dottyCompiler).
1155
- settings(commonDottySettings).
1156
1144
settings(commonBenchmarkSettings).
1157
1145
bootstrappedSettings(unmanagedSourceDirectories in Compile ++= Seq (baseDirectory.value / " .." / " bench" / " src" )).
1158
1146
enablePlugins(JmhPlugin )
1159
1147
1160
- def asDist (implicit mode : Mode ): Project = project.
1148
+ def asDist (implicit mode : Mode ): Project = project.withCommonSettings.
1161
1149
dependsOn(`dotty-interfaces`).
1162
1150
dependsOn(dottyCompiler).
1163
1151
dependsOn(dottyLibrary).
1164
1152
dependsOn(dottyDoc).
1165
- settings(commonDottySettings).
1166
1153
settings(commonDistSettings).
1167
- bootstrappedSettings(target := baseDirectory.value / " target" ) // override setting in commonDottySettings)
1154
+ bootstrappedSettings(target := baseDirectory.value / " target" ) // override setting in commonBootstrappedSettings
1155
+
1156
+ def withCommonSettings (implicit mode : Mode ): Project = project.settings(mode match {
1157
+ case NonBootstrapped => commonNonBootstrappedSettings
1158
+ case Bootstrapped => commonBootstrappedSettings
1159
+ case BootstrappedOptimised => commonOptimisedSettings
1160
+ })
1168
1161
}
1169
1162
1170
1163
}
0 commit comments