Skip to content

Commit

Permalink
Filter pattern in GlobalBenchmarkSetup
Browse files Browse the repository at this point in the history
  • Loading branch information
Friendseeker committed Jan 1, 2024
1 parent 0df02a1 commit ee81a5d
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@ package xsbt
import java.io.File

import xsbt.BenchmarkProjects.{ Scalac, Shapeless }
import scala.util.matching.Regex

object GlobalBenchmarkSetup {

/** Update this list every time you add a new benchmark. */
val projects = Map("Scalac" -> Scalac, "Shapeless" -> Shapeless)

def runSetup(setupDir: File, pattern: Regex): (Int, String) = {
def runSetup(setupDir: File, pattern: String): (Int, String) = {
val projectsPreparation = projects
.filterKeys { _.matches(pattern) }
.map { (_, project) =>
.map { case (_, project) =>
val benchmark = new ZincBenchmark(project)
project -> benchmark.writeSetup(new File(setupDir, project.repo))
}
Expand All @@ -50,7 +49,7 @@ object GlobalBenchmarkSetup {
fail("Too many arguments. Pass the directory to host project setups.")
else {
val setupDir = new File(args(0))
val pattern = args(1).r
val pattern = if (args.length == 1) ".*" else args(1)
val (exitCode, status) = runSetup(setupDir, pattern)
println(status)
println("The benchmark setup has finished.")
Expand Down

0 comments on commit ee81a5d

Please sign in to comment.