@@ -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,7 @@ 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
+ lazy val dottyCompilerSettings = Seq (
163
160
// set system in/out for repl
164
161
connectInput in run := true ,
165
162
outputStrategy := Some (StdoutOutput ),
@@ -178,28 +175,18 @@ object DottyBuild extends Build {
178
175
179
176
// get libraries onboard
180
177
partestDeps := Seq (scalaCompiler,
181
- " org.scala-lang" % " scala-reflect" % scalaVersion.value ,
182
- " org.scala-lang" % " scala-library" % scalaVersion.value % " test" ),
178
+ " org.scala-lang" % " scala-reflect" % scalacVersion ,
179
+ " org.scala-lang" % " scala-library" % scalacVersion % " test" ),
183
180
libraryDependencies ++= partestDeps.value,
184
181
libraryDependencies ++= Seq (" org.scala-lang.modules" %% " scala-xml" % " 1.0.1" ,
185
182
" org.scala-lang.modules" %% " scala-partest" % " 1.0.11" % " test" ,
186
- " ch.epfl.lamp " % " dottydoc-client" % " 0.1.0" ,
183
+ dottyOrganization % " dottydoc-client" % " 0.1.0" ,
187
184
" com.novocode" % " junit-interface" % " 0.11" % " test" ,
188
185
" com.github.spullara.mustache.java" % " compiler" % " 0.9.3" ,
189
186
" com.typesafe.sbt" % " sbt-interface" % sbtVersion.value),
190
187
// enable improved incremental compilation algorithm
191
188
incOptions := incOptions.value.withNameHashing(true ),
192
189
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
190
// For convenience, change the baseDirectory when running the compiler
204
191
baseDirectory in (Compile , run) := baseDirectory.value / " .." ,
205
192
// .. but not when running partest
@@ -274,8 +261,8 @@ object DottyBuild extends Build {
274
261
val args = Def .spaceDelimited(" <arg>" ).parsed
275
262
val jars = List (
276
263
(packageBin in Compile ).value.getAbsolutePath,
277
- (packageBin in (` dotty-library`, Compile )).value.getAbsolutePath ,
278
- (packageBin in (` dotty-interfaces`, Compile )).value.getAbsolutePath
264
+ packageAll.value( " dotty-library" ) ,
265
+ packageAll.value( " dotty-interfaces" )
279
266
) ++ getJarPaths(partestDeps.value, ivyPaths.value.ivyHome)
280
267
val dottyJars =
281
268
s """ -dottyJars ${jars.length + 2 } dotty.jar dotty-lib.jar ${jars.mkString(" " )}"""
@@ -364,9 +351,60 @@ object DottyBuild extends Build {
364
351
365
352
(" -DpartestParentID=" + pid) :: jars ::: tuning ::: agentOptions ::: ci_build ::: path.toList
366
353
}
354
+ )
355
+
356
+ lazy val `dotty-compiler` = project.in(file(" compiler" )).
357
+ dependsOn(`dotty-interfaces`).
358
+ dependsOn(`dotty-library`).
359
+ settings(sourceStructure).
360
+ settings(dottyCompilerSettings).
361
+ settings(
362
+ overrideScalaVersionSetting,
363
+
364
+ // necessary evil: dottydoc currently needs to be included in the dotty
365
+ // project, for sbt integration
366
+ // FIXME: note part of dottyCompilerSettings because the doc-tool does not
367
+ // compile with dotty
368
+ unmanagedSourceDirectories in Compile := Seq ((scalaSource in Compile ).value),
369
+ unmanagedSourceDirectories in Compile += baseDirectory.value / " .." / " doc-tool" / " src" ,
370
+ unmanagedSourceDirectories in Test := Seq ((scalaSource in Test ).value),
371
+ unmanagedSourceDirectories in Test += baseDirectory.value / " .." / " doc-tool" / " test" ,
372
+
373
+ // Disable scaladoc generation, it's way too slow and we'll replace it
374
+ // by dottydoc anyway. We still publish an empty -javadoc.jar to make
375
+ // sonatype happy.
376
+ sources in (Compile , doc) := Seq (),
377
+
378
+ // packageAll packages all and then returns a map with the abs location
379
+ packageAll := {
380
+ Map (
381
+ " dotty-interfaces" -> (packageBin in (`dotty-interfaces`, Compile )).value,
382
+ " dotty-compiler" -> (packageBin in Compile ).value,
383
+ " dotty-library" -> (packageBin in (`dotty-library`, Compile )).value,
384
+ " dotty-compiler-test" -> (packageBin in Test ).value
385
+ ) map { case (k, v) => (k, v.getAbsolutePath) }
386
+ }
367
387
).
368
388
settings(publishing)
369
389
390
+ lazy val `dotty-compiler-bootstrapped` = project.in(file(" compiler" )).
391
+ dependsOn(`dotty-library-bootstrapped`).
392
+ settings(sourceStructure).
393
+ settings(commonBootstrappedSettings).
394
+ settings(dottyCompilerSettings).
395
+ settings(
396
+ // Used instead of "dependsOn(`dotty-interfaces`)" because the latter breaks sbt somehow
397
+ libraryDependencies += scalaOrganization.value % " dotty-interfaces" % version.value
398
+ ).
399
+ settings(
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