@@ -57,8 +57,7 @@ val partestDependencies = Seq(
57
57
" methvsfield" -> " be8454d5e7751b063ade201c225dcedefd252775" ,
58
58
" nest" -> " cd33e0a0ea249eb42363a2f8ba531186345ff68c"
59
59
).map(bootstrapDep(" test/files/lib" )) ++ Seq (
60
- bootstrapDep(" test/files/codelib" )(" code" -> " e737b123d31eede5594ceda07caafed1673ec472" ) % " test" ,
61
- bootstrapDep(" test/files/speclib" )(" instrumented" -> " d015eff38243f1c2edb44ac3b6a0ce99bc5656db" ) % " test"
60
+ bootstrapDep(" test/files/codelib" )(" code" -> " e737b123d31eede5594ceda07caafed1673ec472" ) % " test"
62
61
)
63
62
64
63
lazy val publishSettings : Seq [Setting [_]] = Seq (
@@ -552,6 +551,36 @@ lazy val scalacheckLib = project.in(file("src") / "scalacheck")
552
551
libraryDependencies += testInterfaceDep
553
552
)
554
553
554
+ // An instrumented version of BoxesRunTime and ScalaRunTime for partest's "specialized" test category
555
+ lazy val specLib = project.in(file(" test" ) / " instrumented" )
556
+ .dependsOn(library, reflect, compiler)
557
+ .settings(clearSourceAndResourceDirectories)
558
+ .settings(commonSettings)
559
+ .settings(disableDocs)
560
+ .settings(disablePublishing)
561
+ .settings(
562
+ sourceGenerators in Compile += Def .task {
563
+ import scala .collection .JavaConverters ._
564
+ val srcBase = (sourceDirectories in Compile in library).value.head / " scala/runtime"
565
+ val targetBase = (sourceManaged in Compile ).value / " scala/runtime"
566
+ def patch (srcFile : String , patchFile : String ): File = try {
567
+ val p = difflib.DiffUtils .parseUnifiedDiff(IO .readLines(baseDirectory.value / patchFile).asJava)
568
+ val r = difflib.DiffUtils .patch(IO .readLines(srcBase / srcFile).asJava, p)
569
+ val target = targetBase / srcFile
570
+ IO .writeLines(target, r.asScala)
571
+ target
572
+ } catch { case ex : Exception =>
573
+ streams.value.log.error(s " Error patching $srcFile: $ex" )
574
+ throw ex
575
+ }
576
+ IO .createDirectory(targetBase)
577
+ Seq (
578
+ patch(" BoxesRunTime.java" , " boxes.patch" ),
579
+ patch(" ScalaRunTime.scala" , " srt.patch" )
580
+ )
581
+ }.taskValue
582
+ )
583
+
555
584
// The scala version used by the benchmark suites, leave undefined to use the ambient version.")
556
585
def benchmarkScalaVersion = System .getProperty(" benchmark.scala.version" , " " )
557
586
@@ -703,9 +732,9 @@ lazy val test = project
703
732
testOptions in IntegrationTest += Tests .Setup { () =>
704
733
val cp = (dependencyClasspath in Test ).value
705
734
val baseDir = (baseDirectory in ThisBuild ).value
706
- // Copy code.jar and instrumented.jar (resolved in the otherwise unused scope "test") to the location where partest expects them
735
+ // Copy code.jar (resolved in the otherwise unused scope "test") and instrumented.jar (from specLib ) to the location where partest expects them
707
736
copyBootstrapJar(cp, baseDir, " test/files/codelib" , " code" )
708
- copyBootstrapJar(cp, baseDir, " test/files/speclib" , " instrumented" )
737
+ IO .copyFile((packagedArtifact in ( LocalProject ( " specLib " ), Compile , packageBin)).value._2, baseDir / " test/files/speclib/ instrumented.jar " )
709
738
},
710
739
definedTests in IntegrationTest += new sbt.TestDefinition (
711
740
" partest" ,
0 commit comments