@@ -19,167 +19,158 @@ object DottyBuild extends Build {
19
19
// "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1g", "-Xss2m"
20
20
)
21
21
22
- val defaults = Defaults .coreDefaultSettings ++ Seq (
23
- scalaVersion in Global := " 2.11.5" ,
24
- version in Global := " 0.1-SNAPSHOT" ,
25
- organization in Global := " org.scala-lang" ,
26
- organizationName in Global := " LAMP/EPFL" ,
27
- organizationHomepage in Global := Some (url(" http://lamp.epfl.ch" )),
28
- homepage in Global := Some (url(" https://github.com/lampepfl/dotty" )),
29
-
30
- // set sources to src/, tests to test/ and resources to resources/
31
- scalaSource in Compile := baseDirectory.value / " src" ,
32
- javaSource in Compile := baseDirectory.value / " src" ,
33
- scalaSource in Test := baseDirectory.value / " test" ,
34
- javaSource in Test := baseDirectory.value / " test" ,
35
- resourceDirectory in Compile := baseDirectory.value / " resources" ,
36
- unmanagedSourceDirectories in Compile := Seq ((scalaSource in Compile ).value),
37
- unmanagedSourceDirectories in Test := Seq ((scalaSource in Test ).value),
38
-
39
- // Generate compiler.properties, used by sbt
40
- resourceGenerators in Compile += Def .task {
41
- val file = (resourceManaged in Compile ).value / " compiler.properties"
42
- val contents = s " version.number= ${version.value}"
43
- IO .write(file, contents)
44
- Seq (file)
45
- }.taskValue,
46
-
47
- // include sources in eclipse (downloads source code for all dependencies)
48
- // http://stackoverflow.com/questions/10472840/how-to-attach-sources-to-sbt-managed-dependencies-in-scala-ide#answer-11683728
49
- com.typesafe.sbteclipse.plugin.EclipsePlugin .EclipseKeys .withSource := true ,
50
-
51
- // to get Scala 2.11
52
- resolvers += Resolver .sonatypeRepo(" releases" ),
53
-
54
- // get libraries onboard
55
- partestDeps := Seq (" me.d-d" % " scala-compiler" % " 2.11.5-20151022-113908-7fb0e653fd" ,
56
- " org.scala-lang" % " scala-reflect" % scalaVersion.value,
57
- " org.scala-lang" % " scala-library" % scalaVersion.value % " test" ),
58
- libraryDependencies ++= partestDeps.value,
59
- libraryDependencies ++= Seq (" org.scala-lang.modules" %% " scala-xml" % " 1.0.1" ,
60
- " org.scala-lang.modules" %% " scala-partest" % " 1.0.11" % " test" ,
61
- " com.novocode" % " junit-interface" % " 0.11" % " test" ,
62
- " jline" % " jline" % " 2.12" ),
63
-
64
- // scalac options
65
- scalacOptions in Global ++= Seq (" -feature" , " -deprecation" , " -language:existentials,higherKinds,implicitConversions" ),
66
-
67
- javacOptions ++= Seq (" -Xlint:unchecked" , " -Xlint:deprecation" ),
68
-
69
- // enable improved incremental compilation algorithm
70
- incOptions := incOptions.value.withNameHashing(true ),
71
-
72
- // enable verbose exception messages for JUnit
73
- testOptions in Test += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" , " --run-listener=test.ContextEscapeDetector" ),
74
- testOptions in Test += Tests .Cleanup ({ () => partestLockFile.delete }),
75
-
76
- lockPartestFile := {
77
- // When this file is present, running `test` generates the files for
78
- // partest. Otherwise it just executes the tests directly.
79
- val lockDir = partestLockFile.getParentFile
80
- lockDir.mkdirs
81
- // Cannot have concurrent partests as they write to the same directory.
82
- if (lockDir.list.size > 0 )
83
- throw new RuntimeException (" ERROR: sbt partest: another partest is already running, pid in lock file: " + lockDir.list.toList.mkString(" " ))
84
- partestLockFile.createNewFile
85
- partestLockFile.deleteOnExit
86
- },
87
- runPartestRunner <<= Def .inputTaskDyn {
88
- // Magic! This is both an input task and a dynamic task. Apparently
89
- // command line arguments get passed to the last task in an aliased
90
- // sequence (see partest alias below), so this works.
91
- val args = Def .spaceDelimited(" <arg>" ).parsed
92
- val jars = Seq ((packageBin in Compile ).value.getAbsolutePath) ++
93
- getJarPaths(partestDeps.value, ivyPaths.value.ivyHome)
94
- val dottyJars = " -dottyJars " + (jars.length + 1 ) + " dotty.jar" + " " + jars.mkString(" " )
95
- // Provide the jars required on the classpath of run tests
96
- runTask(Test , " dotty.partest.DPConsoleRunner" , dottyJars + " " + args.mkString(" " ))
97
- },
98
-
99
- // Adjust classpath for running dotty
100
- mainClass in (Compile , run) := Some (" dotty.tools.dotc.Main" ),
101
- fork in run := true ,
102
- fork in Test := true ,
103
- parallelExecution in Test := false ,
104
-
105
- // http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
106
- javaOptions <++= (managedClasspath in Runtime , packageBin in Compile ) map { (attList, bin) =>
107
- // put the Scala {library, reflect} in the classpath
108
- val path = for {
109
- file <- attList.map(_.data)
110
- path = file.getAbsolutePath
111
- } yield " -Xbootclasspath/p:" + path
112
- // dotty itself needs to be in the bootclasspath
113
- val fullpath = (" -Xbootclasspath/a:" + bin) :: path.toList
114
- // System.err.println("BOOTPATH: " + fullpath)
115
-
116
- val travis_build = // propagate if this is a travis build
117
- if (sys.props.isDefinedAt(JENKINS_BUILD ))
118
- List (s " -D $JENKINS_BUILD= ${sys.props(JENKINS_BUILD )}" ) ::: travisMemLimit
119
- else
120
- List ()
121
-
122
- val tuning =
123
- if (sys.props.isDefinedAt(" Oshort" ))
124
- // Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
125
- List (" -XX:+TieredCompilation" , " -XX:TieredStopAtLevel=1" )
126
- else
127
- List ()
128
-
129
- (" -DpartestParentID=" + pid) :: tuning ::: agentOptions ::: travis_build ::: fullpath
130
- }
131
- ) ++ addCommandAlias(" partest" , " ;test:package;package;test:runMain dotc.build;lockPartestFile;test:test;runPartestRunner" ) ++
132
- addCommandAlias(" partest-only" , " ;test:package;package;test:runMain dotc.build;lockPartestFile;test:test-only dotc.tests;runPartestRunner" ) ++
133
- addCommandAlias(" partest-only-no-bootstrap" , " ;test:package;package; lockPartestFile;test:test-only dotc.tests;runPartestRunner" )
134
-
135
- lazy val dotty = Project (id = " dotty" , base = file(" ." ), settings = defaults)
136
-
137
- lazy val benchmarkSettings = Defaults .coreDefaultSettings ++ Seq (
138
-
139
- // to get Scala 2.11
140
- resolvers += Resolver .sonatypeRepo(" releases" ),
141
-
142
- baseDirectory in (Test ,run) := (baseDirectory in dotty).value,
143
-
144
-
145
- libraryDependencies ++= Seq (" com.storm-enroute" %% " scalameter" % " 0.6" % Test ,
146
- " com.novocode" % " junit-interface" % " 0.11" ),
147
- testFrameworks += new TestFramework (" org.scalameter.ScalaMeterFramework" ),
148
-
149
- // scalac options
150
- scalacOptions in Global ++= Seq (" -feature" , " -deprecation" , " -language:existentials,higherKinds,implicitConversions" ),
151
-
152
- javacOptions ++= Seq (" -Xlint:unchecked" , " -Xlint:deprecation" ),
153
-
154
- fork in Test := true ,
155
- parallelExecution in Test := false ,
156
-
157
- // http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
158
- javaOptions <++= (dependencyClasspath in Runtime , packageBin in Compile ) map { (attList, bin) =>
159
- // put the Scala {library, reflect, compiler} in the classpath
160
- val path = for {
161
- file <- attList.map(_.data)
162
- path = file.getAbsolutePath
163
- prefix = if (path.endsWith(" .jar" )) " p" else " a"
164
- } yield " -Xbootclasspath/" + prefix + " :" + path
165
- // dotty itself needs to be in the bootclasspath
166
- val fullpath = (" -Xbootclasspath/a:" + bin) :: path.toList
167
- // System.err.println("BOOTPATH: " + fullpath)
168
-
169
- val travis_build = // propagate if this is a travis build
170
- if (sys.props.isDefinedAt(JENKINS_BUILD ))
171
- List (s " -D $JENKINS_BUILD= ${sys.props(JENKINS_BUILD )}" )
172
- else
173
- List ()
174
- val res = agentOptions ::: travis_build ::: fullpath
175
- println(" Running with javaOptions: " + res)
176
- res
177
- }
178
- )
179
-
22
+ override def settings : Seq [Setting [_]] = {
23
+ super .settings ++ Seq (
24
+ scalaVersion in Global := " 2.11.5" ,
25
+ version in Global := " 0.1-SNAPSHOT" ,
26
+ organization in Global := " org.scala-lang" ,
27
+ organizationName in Global := " LAMP/EPFL" ,
28
+ organizationHomepage in Global := Some (url(" http://lamp.epfl.ch" )),
29
+ homepage in Global := Some (url(" https://github.com/lampepfl/dotty" )),
30
+
31
+ // scalac options
32
+ scalacOptions in Global ++= Seq (" -feature" , " -deprecation" , " -language:existentials,higherKinds,implicitConversions" ),
33
+
34
+ javacOptions in Global ++= Seq (" -Xlint:unchecked" , " -Xlint:deprecation" )
35
+ )
36
+ }
180
37
181
- lazy val benchmarks = Project (id = " dotty-bench" , settings = benchmarkSettings,
182
- base = file(" bench" )) dependsOn(dotty % " compile->test" )
38
+ lazy val dotty = project.in(file(" ." )).
39
+ settings(
40
+ // set sources to src/, tests to test/ and resources to resources/
41
+ scalaSource in Compile := baseDirectory.value / " src" ,
42
+ javaSource in Compile := baseDirectory.value / " src" ,
43
+ scalaSource in Test := baseDirectory.value / " test" ,
44
+ javaSource in Test := baseDirectory.value / " test" ,
45
+ resourceDirectory in Compile := baseDirectory.value / " resources" ,
46
+ unmanagedSourceDirectories in Compile := Seq ((scalaSource in Compile ).value),
47
+ unmanagedSourceDirectories in Test := Seq ((scalaSource in Test ).value),
48
+
49
+ // Generate compiler.properties, used by sbt
50
+ resourceGenerators in Compile += Def .task {
51
+ val file = (resourceManaged in Compile ).value / " compiler.properties"
52
+ val contents = s " version.number= ${version.value}"
53
+ IO .write(file, contents)
54
+ Seq (file)
55
+ }.taskValue,
56
+
57
+ // include sources in eclipse (downloads source code for all dependencies)
58
+ // http://stackoverflow.com/questions/10472840/how-to-attach-sources-to-sbt-managed-dependencies-in-scala-ide#answer-11683728
59
+ com.typesafe.sbteclipse.plugin.EclipsePlugin .EclipseKeys .withSource := true ,
60
+
61
+ // get libraries onboard
62
+ partestDeps := Seq (" me.d-d" % " scala-compiler" % " 2.11.5-20151022-113908-7fb0e653fd" ,
63
+ " org.scala-lang" % " scala-reflect" % scalaVersion.value,
64
+ " org.scala-lang" % " scala-library" % scalaVersion.value % " test" ),
65
+ libraryDependencies ++= partestDeps.value,
66
+ libraryDependencies ++= Seq (" org.scala-lang.modules" %% " scala-xml" % " 1.0.1" ,
67
+ " org.scala-lang.modules" %% " scala-partest" % " 1.0.11" % " test" ,
68
+ " com.novocode" % " junit-interface" % " 0.11" % " test" ,
69
+ " jline" % " jline" % " 2.12" ),
70
+
71
+ // enable improved incremental compilation algorithm
72
+ incOptions := incOptions.value.withNameHashing(true ),
73
+
74
+ // enable verbose exception messages for JUnit
75
+ testOptions in Test += Tests .Argument (TestFrameworks .JUnit , " -a" , " -v" , " --run-listener=test.ContextEscapeDetector" ),
76
+ testOptions in Test += Tests .Cleanup ({ () => partestLockFile.delete }),
77
+
78
+ lockPartestFile := {
79
+ // When this file is present, running `test` generates the files for
80
+ // partest. Otherwise it just executes the tests directly.
81
+ val lockDir = partestLockFile.getParentFile
82
+ lockDir.mkdirs
83
+ // Cannot have concurrent partests as they write to the same directory.
84
+ if (lockDir.list.size > 0 )
85
+ throw new RuntimeException (" ERROR: sbt partest: another partest is already running, pid in lock file: " + lockDir.list.toList.mkString(" " ))
86
+ partestLockFile.createNewFile
87
+ partestLockFile.deleteOnExit
88
+ },
89
+ runPartestRunner <<= Def .inputTaskDyn {
90
+ // Magic! This is both an input task and a dynamic task. Apparently
91
+ // command line arguments get passed to the last task in an aliased
92
+ // sequence (see partest alias below), so this works.
93
+ val args = Def .spaceDelimited(" <arg>" ).parsed
94
+ val jars = Seq ((packageBin in Compile ).value.getAbsolutePath) ++
95
+ getJarPaths(partestDeps.value, ivyPaths.value.ivyHome)
96
+ val dottyJars = " -dottyJars " + (jars.length + 1 ) + " dotty.jar" + " " + jars.mkString(" " )
97
+ // Provide the jars required on the classpath of run tests
98
+ runTask(Test , " dotty.partest.DPConsoleRunner" , dottyJars + " " + args.mkString(" " ))
99
+ },
100
+
101
+ // Adjust classpath for running dotty
102
+ mainClass in (Compile , run) := Some (" dotty.tools.dotc.Main" ),
103
+ fork in run := true ,
104
+ fork in Test := true ,
105
+ parallelExecution in Test := false ,
106
+
107
+ // http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
108
+ javaOptions <++= (managedClasspath in Runtime , packageBin in Compile ) map { (attList, bin) =>
109
+ // put the Scala {library, reflect} in the classpath
110
+ val path = for {
111
+ file <- attList.map(_.data)
112
+ path = file.getAbsolutePath
113
+ } yield " -Xbootclasspath/p:" + path
114
+ // dotty itself needs to be in the bootclasspath
115
+ val fullpath = (" -Xbootclasspath/a:" + bin) :: path.toList
116
+ // System.err.println("BOOTPATH: " + fullpath)
117
+
118
+ val travis_build = // propagate if this is a travis build
119
+ if (sys.props.isDefinedAt(JENKINS_BUILD ))
120
+ List (s " -D $JENKINS_BUILD= ${sys.props(JENKINS_BUILD )}" ) ::: travisMemLimit
121
+ else
122
+ List ()
123
+
124
+ val tuning =
125
+ if (sys.props.isDefinedAt(" Oshort" ))
126
+ // Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
127
+ List (" -XX:+TieredCompilation" , " -XX:TieredStopAtLevel=1" )
128
+ else
129
+ List ()
130
+
131
+ (" -DpartestParentID=" + pid) :: tuning ::: agentOptions ::: travis_build ::: fullpath
132
+ }
133
+ ).
134
+ settings(
135
+ addCommandAlias(" partest" , " ;test:package;package;test:runMain dotc.build;lockPartestFile;test:test;runPartestRunner" ) ++
136
+ addCommandAlias(" partest-only" , " ;test:package;package;test:runMain dotc.build;lockPartestFile;test:test-only dotc.tests;runPartestRunner" ) ++
137
+ addCommandAlias(" partest-only-no-bootstrap" , " ;test:package;package; lockPartestFile;test:test-only dotc.tests;runPartestRunner" )
138
+ )
139
+
140
+ lazy val `dotty-bench` = project.in(file(" bench" )).
141
+ dependsOn(dotty % " compile->test" ).
142
+ settings(
143
+ baseDirectory in (Test ,run) := (baseDirectory in dotty).value,
144
+
145
+ libraryDependencies ++= Seq (" com.storm-enroute" %% " scalameter" % " 0.6" % Test ,
146
+ " com.novocode" % " junit-interface" % " 0.11" ),
147
+ testFrameworks += new TestFramework (" org.scalameter.ScalaMeterFramework" ),
148
+
149
+ fork in Test := true ,
150
+ parallelExecution in Test := false ,
151
+
152
+ // http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
153
+ javaOptions <++= (dependencyClasspath in Runtime , packageBin in Compile ) map { (attList, bin) =>
154
+ // put the Scala {library, reflect, compiler} in the classpath
155
+ val path = for {
156
+ file <- attList.map(_.data)
157
+ path = file.getAbsolutePath
158
+ prefix = if (path.endsWith(" .jar" )) " p" else " a"
159
+ } yield " -Xbootclasspath/" + prefix + " :" + path
160
+ // dotty itself needs to be in the bootclasspath
161
+ val fullpath = (" -Xbootclasspath/a:" + bin) :: path.toList
162
+ // System.err.println("BOOTPATH: " + fullpath)
163
+
164
+ val travis_build = // propagate if this is a travis build
165
+ if (sys.props.isDefinedAt(JENKINS_BUILD ))
166
+ List (s " -D $JENKINS_BUILD= ${sys.props(JENKINS_BUILD )}" )
167
+ else
168
+ List ()
169
+ val res = agentOptions ::: travis_build ::: fullpath
170
+ println(" Running with javaOptions: " + res)
171
+ res
172
+ }
173
+ )
183
174
184
175
// Partest tasks
185
176
lazy val lockPartestFile = TaskKey [Unit ](" lockPartestFile" , " Creates the lock file at ./tests/locks/partest-<pid>.lock" )
0 commit comments