Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add missing build commands
  • Loading branch information
ghostbuster91 committed Sep 23, 2023
commit c7878673ad2d508ed624e781d34fb842f49bd352
28 changes: 27 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import sbt.Def
import sbt.Reference.display
import com.softwaremill.SbtSoftwareMillCommon.commonSmlBuildSettings
import com.softwaremill.Publish.{ossPublishSettings, updateDocs}
import complete.DefaultParsers._

val scala212 = "2.12.16"
val scala213 = "2.13.8"
Expand All @@ -14,6 +15,14 @@ val scalatestVersion = "3.2.12"
val specs2Version = "4.16.1"
val smlTaggingVersion = "2.3.3"

val scopesDescription = "Scala version can be: 2.12, 2.13, 3; platform: JVM, JS, Native"
val compileScoped =
inputKey[Unit](
s"Compiles sources in the given scope. Usage: compileScoped [scala version] [platform]. $scopesDescription"
)
val testScoped =
inputKey[Unit](s"Run tests in the given scope. Usage: testScoped [scala version] [platform]. $scopesDescription")

lazy val commonSettings: Seq[Def.Setting[_]] = commonSmlBuildSettings ++ ossPublishSettings ++ Seq(
organization := "com.softwaremill.diffx",
scmInfo := Some(ScmInfo(url("https://github.com/softwaremill/diffx"), "[email protected]:softwaremill/diffx.git")),
Expand Down Expand Up @@ -272,6 +281,19 @@ val allAggregates =
def filterProject(p: String => Boolean) =
ScopeFilter(inProjects(allAggregates.filter(pr => p(display(pr.project))): _*))

def filterByVersionAndPlatform(scalaVersionFilter: String, platformFilter: String) = filterProject { projectName =>
val byPlatform =
if (platformFilter == "JVM") !projectName.contains("JS") && !projectName.contains("Native")
else projectName.contains(platformFilter)
val byVersion = scalaVersionFilter match {
case "2.13" => !projectName.contains("2_12") && !projectName.contains("3")
case "2.12" => projectName.contains("2_12")
case "3" => projectName.contains("3")
}

byPlatform && byVersion && !projectName.contains("finatra")
}

lazy val rootProject = project
.in(file("."))
.settings(commonSettings)
Expand All @@ -280,6 +302,10 @@ lazy val rootProject = project
name := "diffx",
scalaVersion := scalaIdeaVersion,
testJVM := (Test / test).all(filterProject(p => !p.contains("JS") && !p.contains("Native"))).value,
testJS := (Test / test).all(filterProject(_.contains("JS"))).value
testJS := (Test / test).all(filterProject(_.contains("JS"))).value,
compileScoped := Def.inputTaskDyn {
val args = spaceDelimited("<arg>").parsed
Def.taskDyn((Compile / compile).all(filterByVersionAndPlatform(args.head, args(1))))
}.evaluated
)
.aggregate(allAggregates: _*)