Skip to content

Commit 57bb97c

Browse files
authored
Merge pull request #6818 from retronym/topic/benchpress
Enable benchmarks to compare HEAD with a previous release
2 parents 69f31a2 + a10b9e8 commit 57bb97c

File tree

6 files changed

+47
-4
lines changed

6 files changed

+47
-4
lines changed

build.sbt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,15 +551,24 @@ lazy val scalacheckLib = project.in(file("src") / "scalacheck")
551551
libraryDependencies += testInterfaceDep
552552
)
553553

554+
// The scala version used by the benchmark suites, leave undefined to use the ambient version.")
555+
def benchmarkScalaVersion = System.getProperty("benchmark.scala.version", "")
556+
554557
lazy val bench = project.in(file("test") / "benchmarks")
555-
.dependsOn(library, compiler)
556-
.settings(instanceSettings)
558+
.dependsOn((if (benchmarkScalaVersion == "") Seq[sbt.ClasspathDep[sbt.ProjectReference]](library, compiler) else Nil): _*)
559+
.settings(if (benchmarkScalaVersion == "") instanceSettings else Seq(scalaVersion := benchmarkScalaVersion, crossPaths := false))
557560
.settings(disableDocs)
558561
.settings(disablePublishing)
559562
.enablePlugins(JmhPlugin)
560563
.settings(
561564
name := "test-benchmarks",
565+
autoScalaLibrary := false,
566+
crossPaths := true, // needed to enable per-scala-version source directories (https://github.com/sbt/sbt/pull/1799)
562567
libraryDependencies += "org.openjdk.jol" % "jol-core" % "0.6",
568+
libraryDependencies ++= {
569+
if (benchmarkScalaVersion == "") Nil
570+
else "org.scala-lang" % "scala-compiler" % benchmarkScalaVersion :: Nil
571+
},
563572
scalacOptions ++= Seq("-feature", "-opt:l:inline", "-opt-inline-from:**")
564573
)
565574

@@ -1049,6 +1058,7 @@ intellij := {
10491058
val buildModule = ("scala-build", scalabuild.BuildInfo.buildClasspath.split(java.io.File.pathSeparator).toSeq.map(new File(_)))
10501059
// `sbt projects` lists all modules in the build
10511060
buildModule :: List(
1061+
moduleDeps(bench).value,
10521062
moduleDeps(compilerP).value,
10531063
moduleDeps(interactive).value,
10541064
moduleDeps(junit).value,

src/intellij/benchmarks.iml.SAMPLE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager">
4+
<output url="file://$MODULE_DIR$/../../../test/benchmarks/target/classes" />
5+
<output-test url="file://$MODULE_DIR$/../../../test/benchmarks/target/test-classes" />
6+
<exclude-output />
7+
<content url="file://$MODULE_DIR$/../../test/benchmarks">
8+
<sourceFolder url="file://$MODULE_DIR$/../../test/benchmarks/src/main/scala" isTestSource="false" />
9+
<sourceFolder url="file://$MODULE_DIR$/../../test/benchmarks/src/main/java" isTestSource="false" />
10+
<sourceFolder url="file://$MODULE_DIR$/../../test/benchmarks/src/main/scala-2.13/scala" isTestSource="false" />
11+
<sourceFolder url="file://$MODULE_DIR$/../../test/benchmarks/src/main/scala-2.13/java" isTestSource="false" />
12+
</content>
13+
<orderEntry type="inheritedJdk" />
14+
<orderEntry type="sourceFolder" forTests="false" />
15+
<orderEntry type="module" module-name="library" />
16+
<orderEntry type="module" module-name="reflect" />
17+
<orderEntry type="module" module-name="compiler" />
18+
<orderEntry type="module" module-name="interactive" />
19+
<orderEntry type="library" name="bench-deps" level="project" />
20+
<orderEntry type="library" name="starr" level="project" />
21+
</component>
22+
</module>

src/intellij/junit.iml.SAMPLE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<module type="JAVA_MODULE" version="4">
33
<component name="NewModuleRootManager">
44
<output url="file://$MODULE_DIR$/../../build/quick/classes/junit" />
5-
<output-test url="file://$MODULE_DIR$/../../out/test/junit" />
5+
<output-test url="file://$MODULE_DIR$/../../target/junit/test-classes" />
66
<exclude-output />
77
<content url="file://$MODULE_DIR$/../../test/junit">
88
<sourceFolder url="file://$MODULE_DIR$/../../test/junit" isTestSource="true" />

src/intellij/scala-build.iml.SAMPLE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module external.linked.project.id="scala-build" external.linked.project.path="$MODULE_DIR$/../../project" external.root.project.path="$MODULE_DIR$/../.." external.system.id="SBT" sbt.imports="sbt._, Keys._, dsl._, _root_.sbt.plugins.IvyPlugin, _root_.sbt.plugins.JvmPlugin, _root_.sbt.plugins.CorePlugin, _root_.sbt.plugins.JUnitXmlReportPlugin" sbt.resolvers="https://repo1.maven.org/maven2/|maven|public, https://oss.sonatype.org/content/repositories/snapshots|maven|sonatype-snapshots, https://scala-ci.typesafe.com/artifactory/scala-release-temp/|maven|private-repo, $USER_HOME$/.ivy2/cache|ivy|Local cache" type="SBT_MODULE" version="4">
2+
<module external.linked.project.id="scala-build" external.linked.project.path="$MODULE_DIR$/../../project" external.root.project.path="$MODULE_DIR$/../.." external.system.id="SBT" sbt.imports="sbt._, Keys._, dsl._, _root_.sbt.plugins.IvyPlugin, _root_.sbt.plugins.JvmPlugin, _root_.sbt.plugins.CorePlugin, _root_.sbt.plugins.JUnitXmlReportPlugin, _root_.pl.project13.scala.sbt.JmhPlugin, _root_.scala.build.BuildSettings.autoImport._, _root_.com.typesafe.tools.mima.plugin.MimaPlugin.autoImport._" sbt.resolvers="https://repo1.maven.org/maven2/|maven|public, https://oss.sonatype.org/content/repositories/snapshots|maven|sonatype-snapshots, https://scala-ci.typesafe.com/artifactory/scala-release-temp/|maven|private-repo, $USER_HOME$/.ivy2/cache|ivy|Local cache" type="SBT_MODULE" version="4">
33
<component name="NewModuleRootManager" inherit-compiler-output="true">
44
<exclude-output />
55
<content url="file://$MODULE_DIR$/../../project">

src/intellij/scala.ipr.SAMPLE

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
</component>
166166
<component name="ProjectModuleManager">
167167
<modules>
168+
<module fileurl="file://$PROJECT_DIR$/benchmarks.iml" filepath="$PROJECT_DIR$/benchmarks.iml" />
168169
<module fileurl="file://$PROJECT_DIR$/compiler.iml" filepath="$PROJECT_DIR$/compiler.iml" />
169170
<module fileurl="file://$PROJECT_DIR$/interactive.iml" filepath="$PROJECT_DIR$/interactive.iml" />
170171
<module fileurl="file://$PROJECT_DIR$/junit.iml" filepath="$PROJECT_DIR$/junit.iml" />
@@ -196,6 +197,16 @@
196197
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
197198
</component>
198199
<component name="libraryTable">
200+
<library name="bench-deps">
201+
<CLASSES>
202+
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-6.0.0-scala-1.jar!/" />
203+
<root url="jar://$USER_HOME$/.ivy2/cache/org.openjdk.jmh/jmh-core/jars/jmh-core-1.19.jar!/" />
204+
<root url="jar://$USER_HOME$/.ivy2/cache/org.openjdk.jol/jol-core/jars/jol-core-0.5.jar!/" />
205+
</CLASSES>
206+
<JAVADOC />
207+
<SOURCES />
208+
</library>
209+
199210
<library name="compiler-deps">
200211
<CLASSES>
201212
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-6.0.0-scala-1.jar!/" />

0 commit comments

Comments
 (0)