@@ -11,8 +11,17 @@ import sbt.Package.ManifestAttributes
11
11
12
12
object DottyBuild extends Build {
13
13
14
- val baseVersion = " 0.1.1"
15
- val isNightly = sys.env.get(" NIGHTLYBUILD" ) == Some (" yes" )
14
+ val scalacVersion = " 2.11.5"
15
+
16
+ val dottyOrganization = " ch.epfl.lamp"
17
+ val dottyVersion = {
18
+ val baseVersion = " 0.1.1"
19
+ val isNightly = sys.env.get(" NIGHTLYBUILD" ) == Some (" yes" )
20
+ if (isNightly)
21
+ baseVersion + " -" + VersionUtil .commitDate + " -" + VersionUtil .gitHash + " -NIGHTLY"
22
+ else
23
+ baseVersion + " -SNAPSHOT"
24
+ }
16
25
17
26
val jenkinsMemLimit = List (" -Xmx1500m" )
18
27
@@ -45,14 +54,9 @@ object DottyBuild extends Build {
45
54
46
55
override def settings : Seq [Setting [_]] = {
47
56
super .settings ++ Seq (
48
- scalaVersion in Global := " 2.11.5" ,
49
- version in Global := {
50
- if (isNightly)
51
- baseVersion + " -" + VersionUtil .commitDate + " -" + VersionUtil .gitHash + " -NIGHTLY"
52
- else
53
- baseVersion + " -SNAPSHOT"
54
- },
55
- organization in Global := " ch.epfl.lamp" ,
57
+ scalaVersion in Global := scalacVersion,
58
+ version in Global := dottyVersion,
59
+ organization in Global := dottyOrganization,
56
60
organizationName in Global := " LAMP/EPFL" ,
57
61
organizationHomepage in Global := Some (url(" http://lamp.epfl.ch" )),
58
62
homepage in Global := Some (url(" https://github.com/lampepfl/dotty" )),
@@ -82,6 +86,17 @@ object DottyBuild extends Build {
82
86
resourceDirectory in Compile := baseDirectory.value / " resources"
83
87
)
84
88
89
+ // Settings used by all dotty-compiled projects
90
+ lazy val commonBootstrappedSettings = Seq (
91
+ scalaOrganization := dottyOrganization,
92
+ scalaVersion := dottyVersion,
93
+ scalaBinaryVersion := " 2.11" ,
94
+ scalaCompilerBridgeSource :=
95
+ (dottyOrganization % " dotty-sbt-bridge" % scalaVersion.value % " component" ).sources(),
96
+
97
+ // sbt gets very unhappy if two projects use the same target
98
+ target := baseDirectory.value / " .." / " out" / name.value
99
+ )
85
100
86
101
/** Projects -------------------------------------------------------------- */
87
102
@@ -141,25 +156,8 @@ object DottyBuild extends Build {
141
156
).
142
157
settings(publishing)
143
158
144
- lazy val `dotty-compiler` = project.in(file(" compiler" )).
145
- dependsOn(`dotty-interfaces`).
146
- dependsOn(`dotty-library`).
147
- settings(sourceStructure).
148
- settings(
149
- overrideScalaVersionSetting,
150
-
151
- // Disable scaladoc generation, it's way too slow and we'll replace it
152
- // by dottydoc anyway. We still publish an empty -javadoc.jar to make
153
- // sonatype happy.
154
- sources in (Compile , doc) := Seq (),
155
-
156
- // necessary evil: dottydoc currently needs to be included in the dotty
157
- // project, for sbt integration
158
- unmanagedSourceDirectories in Compile := Seq ((scalaSource in Compile ).value),
159
- unmanagedSourceDirectories in Compile += baseDirectory.value / " .." / " doc-tool" / " src" ,
160
- unmanagedSourceDirectories in Test := Seq ((scalaSource in Test ).value),
161
- unmanagedSourceDirectories in Test += baseDirectory.value / " .." / " doc-tool" / " test" ,
162
-
159
+ // Settings shared between dotty-compiler and dotty-compiler-bootstrapped
160
+ lazy val dottyCompilerSettings = Seq (
163
161
// set system in/out for repl
164
162
connectInput in run := true ,
165
163
outputStrategy := Some (StdoutOutput ),
@@ -178,28 +176,18 @@ object DottyBuild extends Build {
178
176
179
177
// get libraries onboard
180
178
partestDeps := Seq (scalaCompiler,
181
- " org.scala-lang" % " scala-reflect" % scalaVersion.value ,
182
- " org.scala-lang" % " scala-library" % scalaVersion.value % " test" ),
179
+ " org.scala-lang" % " scala-reflect" % scalacVersion ,
180
+ " org.scala-lang" % " scala-library" % scalacVersion % " test" ),
183
181
libraryDependencies ++= partestDeps.value,
184
182
libraryDependencies ++= Seq (" org.scala-lang.modules" %% " scala-xml" % " 1.0.1" ,
185
183
" org.scala-lang.modules" %% " scala-partest" % " 1.0.11" % " test" ,
186
- " ch.epfl.lamp " % " dottydoc-client" % " 0.1.0" ,
184
+ dottyOrganization % " dottydoc-client" % " 0.1.0" ,
187
185
" com.novocode" % " junit-interface" % " 0.11" % " test" ,
188
186
" com.github.spullara.mustache.java" % " compiler" % " 0.9.3" ,
189
187
" com.typesafe.sbt" % " sbt-interface" % sbtVersion.value),
190
188
// enable improved incremental compilation algorithm
191
189
incOptions := incOptions.value.withNameHashing(true ),
192
190
193
- // packageAll packages all and then returns a map with the abs location
194
- packageAll := {
195
- Map (
196
- " dotty-interfaces" -> (packageBin in (`dotty-interfaces`, Compile )).value,
197
- " dotty-compiler" -> (packageBin in Compile ).value,
198
- " dotty-library" -> (packageBin in (`dotty-library`, Compile )).value,
199
- " dotty-compiler-test" -> (packageBin in Test ).value
200
- ) map { case (k, v) => (k, v.getAbsolutePath) }
201
- },
202
-
203
191
// For convenience, change the baseDirectory when running the compiler
204
192
baseDirectory in (Compile , run) := baseDirectory.value / " .." ,
205
193
// .. but not when running partest
@@ -274,8 +262,8 @@ object DottyBuild extends Build {
274
262
val args = Def .spaceDelimited(" <arg>" ).parsed
275
263
val jars = List (
276
264
(packageBin in Compile ).value.getAbsolutePath,
277
- (packageBin in (` dotty-library`, Compile )).value.getAbsolutePath ,
278
- (packageBin in (` dotty-interfaces`, Compile )).value.getAbsolutePath
265
+ packageAll.value( " dotty-library" ) ,
266
+ packageAll.value( " dotty-interfaces" )
279
267
) ++ getJarPaths(partestDeps.value, ivyPaths.value.ivyHome)
280
268
val dottyJars =
281
269
s """ -dottyJars ${jars.length + 2 } dotty.jar dotty-lib.jar ${jars.mkString(" " )}"""
@@ -364,9 +352,59 @@ object DottyBuild extends Build {
364
352
365
353
(" -DpartestParentID=" + pid) :: jars ::: tuning ::: agentOptions ::: ci_build ::: path.toList
366
354
}
355
+ )
356
+
357
+ lazy val `dotty-compiler` = project.in(file(" compiler" )).
358
+ dependsOn(`dotty-interfaces`).
359
+ dependsOn(`dotty-library`).
360
+ settings(sourceStructure).
361
+ settings(dottyCompilerSettings).
362
+ settings(
363
+ overrideScalaVersionSetting,
364
+
365
+ // necessary evil: dottydoc currently needs to be included in the dotty
366
+ // project, for sbt integration
367
+ // FIXME: note part of dottyCompilerSettings because the doc-tool does not
368
+ // compile with dotty
369
+ unmanagedSourceDirectories in Compile := Seq ((scalaSource in Compile ).value),
370
+ unmanagedSourceDirectories in Compile += baseDirectory.value / " .." / " doc-tool" / " src" ,
371
+ unmanagedSourceDirectories in Test := Seq ((scalaSource in Test ).value),
372
+ unmanagedSourceDirectories in Test += baseDirectory.value / " .." / " doc-tool" / " test" ,
373
+
374
+ // Disable scaladoc generation, it's way too slow and we'll replace it
375
+ // by dottydoc anyway. We still publish an empty -javadoc.jar to make
376
+ // sonatype happy.
377
+ sources in (Compile , doc) := Seq (),
378
+
379
+ // packageAll packages all and then returns a map with the abs location
380
+ packageAll := {
381
+ Map (
382
+ " dotty-interfaces" -> (packageBin in (`dotty-interfaces`, Compile )).value,
383
+ " dotty-compiler" -> (packageBin in Compile ).value,
384
+ " dotty-library" -> (packageBin in (`dotty-library`, Compile )).value,
385
+ " dotty-compiler-test" -> (packageBin in Test ).value
386
+ ) map { case (k, v) => (k, v.getAbsolutePath) }
387
+ }
367
388
).
368
389
settings(publishing)
369
390
391
+ lazy val `dotty-compiler-bootstrapped` = project.in(file(" compiler" )).
392
+ dependsOn(`dotty-library-bootstrapped`).
393
+ settings(sourceStructure).
394
+ settings(commonBootstrappedSettings).
395
+ settings(dottyCompilerSettings).
396
+ settings(
397
+ // Used instead of "dependsOn(`dotty-interfaces`)" because the latter breaks sbt somehow
398
+ libraryDependencies += scalaOrganization.value % " dotty-interfaces" % version.value,
399
+
400
+ packageAll := {
401
+ (packageAll in `dotty-compiler`).value ++ Seq (
402
+ (" dotty-compiler" -> (packageBin in Compile ).value.getAbsolutePath),
403
+ (" dotty-library" -> (packageBin in (`dotty-library-bootstrapped`, Compile )).value.getAbsolutePath)
404
+ )
405
+ }
406
+ )
407
+
370
408
/* Contains unit tests for the scripts */
371
409
lazy val `dotty-bin-tests` = project.in(file(" bin" )).
372
410
settings(sourceStructure).
@@ -377,17 +415,25 @@ object DottyBuild extends Build {
377
415
" com.novocode" % " junit-interface" % " 0.11" % " test"
378
416
)
379
417
380
- lazy val `dotty-library` = project.in(file(" library" )).
381
- settings(sourceStructure).
382
- settings(
418
+ // Settings shared between dotty-library and dotty-library-bootstrapped
419
+ lazy val dottyLibrarySettings = Seq (
383
420
libraryDependencies ++= Seq (
384
- " org.scala-lang" % " scala-reflect" % scalaVersion.value ,
385
- " org.scala-lang" % " scala-library" % scalaVersion.value ,
421
+ " org.scala-lang" % " scala-reflect" % scalacVersion ,
422
+ " org.scala-lang" % " scala-library" % scalacVersion ,
386
423
" com.novocode" % " junit-interface" % " 0.11" % " test"
387
424
)
388
- ).
425
+ )
426
+
427
+ lazy val `dotty-library` = project.in(file(" library" )).
428
+ settings(sourceStructure).
429
+ settings(dottyLibrarySettings).
389
430
settings(publishing)
390
431
432
+ lazy val `dotty-library-bootstrapped` = project.in(file(" library" )).
433
+ settings(sourceStructure).
434
+ settings(commonBootstrappedSettings).
435
+ settings(dottyLibrarySettings)
436
+
391
437
// until sbt/sbt#2402 is fixed (https://github.com/sbt/sbt/issues/2402)
392
438
lazy val cleanSbtBridge = TaskKey [Unit ](" cleanSbtBridge" , " delete dotty-sbt-bridge cache" )
393
439
0 commit comments