Skip to content

Commit 15a7b54

Browse files
committed
Merge pull request #8 from michaelpigg/sbt-build
Initial partest support
2 parents 4a9955c + ac98cb5 commit 15a7b54

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

build.sbt

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ val bootstrapScalaVersion = "2.11.5"
5656
val scalaParserCombinatorsDep = "org.scala-lang.modules" %% "scala-parser-combinators" % versionNumber("scala-parser-combinators") exclude("org.scala-lang", "scala-library")
5757
val scalaXmlDep = "org.scala-lang.modules" %% "scala-xml" % versionNumber("scala-xml") exclude("org.scala-lang", "scala-library")
5858
val partestDep = "org.scala-lang.modules" %% "scala-partest" % versionNumber("partest") exclude("org.scala-lang", "scala-library")
59+
val partestInterfaceDep = "org.scala-lang.modules" %% "scala-partest-interface" % "0.5.0" exclude("org.scala-lang", "scala-library")
5960
val junitDep = "junit" % "junit" % "4.11"
6061
val junitIntefaceDep = "com.novocode" % "junit-interface" % "0.11" % "test"
6162
val jlineDep = "jline" % "jline" % versionProps("jline.version")
6263
val antDep = "org.apache.ant" % "ant" % "1.9.4"
64+
val scalacheckDep = "org.scalacheck" %% "scalacheck" % "1.11.4" exclude("org.scala-lang", "scala-library")
6365

6466
lazy val commonSettings = clearSourceAndResourceDirectories ++ Seq[Setting[_]](
6567
organization := "org.scala-lang",
@@ -179,6 +181,10 @@ lazy val compiler = configureAsSubproject(project)
179181

180182
lazy val interactive = configureAsSubproject(project)
181183
.settings(disableDocsAndPublishingTasks: _*)
184+
.settings(
185+
scalaVersion := bootstrapScalaVersion,
186+
ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }
187+
)
182188
.dependsOn(compiler)
183189

184190
lazy val repl = configureAsSubproject(project)
@@ -230,6 +236,61 @@ lazy val junit = project.in(file("test") / "junit")
230236
unmanagedSourceDirectories in Test := List(baseDirectory.value)
231237
)
232238

239+
lazy val partestJavaAgent = (project in file(".") / "src" / "partest-javaagent").
240+
dependsOn(asm).
241+
settings(commonSettings: _*).
242+
settings(
243+
doc := file("!!! NO DOCS !!!"),
244+
publishLocal := {},
245+
publish := {},
246+
scalaVersion := bootstrapScalaVersion,
247+
ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) },
248+
// Setting name to "scala-partest-javaagent" so that the jar file gets that name, which the Runner relies on
249+
name := "scala-partest-javaagent",
250+
// writing jar file to /build/pack/lib because that's where it's expected to be found
251+
artifactPath in packageBin in Compile := {
252+
val resolvedArtifact = artifact.value
253+
root.base / s"build/pack/lib/${resolvedArtifact.name}.${resolvedArtifact.extension}"
254+
},
255+
// add required manifest entry - previously included from file
256+
packageOptions in (Compile, packageBin) +=
257+
Package.ManifestAttributes( "Premain-Class" -> "scala.tools.partest.javaagent.ProfilingAgent" ),
258+
// we need to build this to a JAR
259+
exportJars := true
260+
)
261+
262+
lazy val test = project.
263+
dependsOn(compiler, interactive, actors, repl, scalap, partestExtras, partestJavaAgent, asm, scaladoc).
264+
configs(IntegrationTest).
265+
settings(disableDocsAndPublishingTasks: _*).
266+
settings(commonSettings: _*).
267+
settings(Defaults.itSettings: _*).
268+
settings(
269+
scalaVersion := bootstrapScalaVersion,
270+
ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) },
271+
libraryDependencies ++= Seq(partestDep, scalaXmlDep, partestInterfaceDep, scalacheckDep),
272+
unmanagedBase in Test := baseDirectory.value / "files" / "lib",
273+
unmanagedJars in Test <+= (unmanagedBase) (j => Attributed.blank(j)) map(identity),
274+
// no main sources
275+
sources in Compile := Seq.empty,
276+
// test sources are compiled in partest run, not here
277+
sources in IntegrationTest := Seq.empty,
278+
fork in IntegrationTest := true,
279+
javaOptions in IntegrationTest += "-Xmx1G",
280+
testFrameworks += new TestFramework("scala.tools.partest.Framework"),
281+
testOptions in IntegrationTest += Tests.Setup( () => root.base.getAbsolutePath + "/pull-binary-libs.sh" ! ),
282+
definedTests in IntegrationTest += (
283+
new sbt.TestDefinition(
284+
"partest",
285+
// marker fingerprint since there are no test classes
286+
// to be discovered by sbt:
287+
new sbt.testing.AnnotatedFingerprint {
288+
def isModule = true
289+
def annotationName = "partest"
290+
}, true, Array())
291+
)
292+
)
293+
233294
lazy val root = (project in file(".")).
234295
aggregate(library, forkjoin, reflect, compiler, asm, interactive, repl,
235296
scaladoc, scalap, actors, partestExtras, junit).settings(

0 commit comments

Comments
 (0)