Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create sbt submodules per scala version #2057

Merged
merged 6 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
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
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++2.12.18 core/test http4s/test akkaHttp/test pekkoHttp/test zioHttp/test quickAdapter/test catsInterop/test tools/test codegenSbt/test clientJVM/test monixInterop/compile tapirInterop/test federation/test reporting/test tracing/test
- run: sbt ++2.12.18 rootJVM212/compile rootJVM212/test
ghostdogpr marked this conversation as resolved.
Show resolved Hide resolved
- save_cache:
key: sbtcache
paths:
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++2.13.12 core/test http4s/test akkaHttp/test pekkoHttp/test play/test zioHttp/test quickAdapter/test examples/compile catsInterop/test benchmarks/compile monixInterop/compile tapirInterop/test clientJVM/test tools/test federation/test reporting/test tracing/test
- run: sbt ++2.13.12 rootJVM213/compile rootJVM213/test examples/compile benchmarks/compile
- save_cache:
key: sbtcache
paths:
Expand All @@ -83,7 +83,7 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++2.13.12 core/test http4s/test akkaHttp/test pekkoHttp/test play/test zioHttp/test quickAdapter/test examples/compile catsInterop/test benchmarks/compile monixInterop/compile tapirInterop/test clientJVM/test tools/test federation/test reporting/test tracing/test
- run: sbt ++2.13.12 rootJVM213/compile rootJVM213/test examples/compile benchmarks/compile
- save_cache:
key: sbtcache
paths:
Expand All @@ -98,7 +98,7 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++3.3.1 core/test catsInterop/test benchmarks/compile monixInterop/compile clientJVM/test clientJS/compile zioHttp/test quickAdapter/test tapirInterop/test pekkoHttp/test http4s/test play/test federation/test tools/test reporting/test tracing/test
- run: sbt ++3.3.1 rootJVM3/compile rootJVM3/test benchmarks/compile
- save_cache:
key: sbtcache
paths:
Expand All @@ -113,7 +113,7 @@ jobs:
- checkout
- restore_cache:
key: sbtcache
- run: sbt ++3.3.1 core/test catsInterop/test benchmarks/compile monixInterop/compile clientJVM/test clientJS/compile zioHttp/test quickAdapter/test tapirInterop/test pekkoHttp/test http4s/test play/test federation/test tools/test reporting/test tracing/test
- run: sbt ++3.3.1 rootJVM3/compile rootJVM3/test benchmarks/compile
- save_cache:
key: sbtcache
paths:
Expand Down
55 changes: 47 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Global / onChangedBuildSource := ReloadOnSourceChanges

inThisBuild(
List(
scalaVersion := scala213, // Change to control IntelliJ's highlighting
scalaVersion := scala213,
crossScalaVersions := allScala,
organization := "com.github.ghostdogpr",
homepage := Some(url("https://github.com/ghostdogpr/caliban")),
Expand All @@ -60,7 +60,7 @@ inThisBuild(
)
),
versionScheme := Some("pvp"),
ConsoleHelper.welcomeMessage,
ConsoleHelper.welcomeMessage(scala212, scala213, scala3),
// See https://github.com/playframework/playframework/issues/11461#issuecomment-1276028512
// Can be removed when the entire Scala ecosystem has migrated to Scala 2.12.17+, sbt 1.8.x, and moved away from scala-xml v1 in general.
libraryDependencySchemes ++= Seq(
Expand All @@ -76,12 +76,8 @@ addCommandAlias(
"all scalafmtSbtCheck scalafmtCheck test:scalafmtCheck"
)

lazy val root = project
.in(file("."))
.enablePlugins(ScalaJSPlugin)
.settings(publish / skip := true)
.settings(crossScalaVersions := Nil)
.aggregate(
lazy val allProjects: Seq[ProjectReference] =
List(
macros,
core,
http4s,
Expand All @@ -104,6 +100,49 @@ lazy val root = project
tracing
)

lazy val root = project
.in(file("."))
.enablePlugins(ScalaJSPlugin)
.settings(publish / skip := true)
.settings(crossScalaVersions := Nil)
.aggregate(allProjects *)

lazy val rootJVM212 = project
.in(file("target/rootJVM212"))
.settings(
crossScalaVersions := Nil,
publish / skip := true,
ideSkipProject := true
)
.aggregate({
val excluded: Set[ProjectReference] = Set(clientJS, clientNative, clientLaminext, play)
allProjects.filterNot(excluded.contains)
} *)

lazy val rootJVM213 = project
.in(file("target/rootJVM213"))
.settings(
crossScalaVersions := Nil,
publish / skip := true,
ideSkipProject := true
)
.aggregate({
val excluded: Set[ProjectReference] = Set(clientJS, clientNative, clientLaminext, codegenSbt)
allProjects.filterNot(excluded.contains)
} *)

lazy val rootJVM3 = project
.in(file("target/rootJVM3"))
.settings(
crossScalaVersions := Nil,
publish / skip := true,
ideSkipProject := true
)
.aggregate({
val excluded: Set[ProjectReference] = Set(clientJS, clientNative, clientLaminext, codegenSbt, akkaHttp)
allProjects.filterNot(excluded.contains)
} *)

lazy val macros = project
.in(file("macros"))
.settings(name := "caliban-macros")
Expand Down
18 changes: 10 additions & 8 deletions project/ConsoleHelper.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import sbt.Keys._
import sbt.Keys.*

object ConsoleHelper {
def prompt: String = s"${Console.CYAN}>${Console.RESET} "
Expand All @@ -7,8 +7,9 @@ object ConsoleHelper {
def item(text: String): String =
s"${Console.RED}> ${Console.CYAN}$text${Console.RESET}"

def welcomeMessage =
onLoadMessage :=
def welcomeMessage(scala212Version: String, scala213Version: String, scala3Version: String) =
onLoadMessage := {
val scalaVersions = s"++$scala212Version; ++$scala213Version; ++$scala3Version"
raw"""|${header(s""" ____ _ _ _ """)}
|${header(s""" / ___|__ _| (_) |__ __ _ _ __ """)}
|${header(s""" | | / _` | | | '_ \\ / _` | '_ \\ """)}
Expand All @@ -17,12 +18,13 @@ object ConsoleHelper {
|
|Useful sbt tasks:
|${item("~compile")} - Compile all modules with file-watch enabled
|${item("test")} - Run the unit test suite
|${item("+test")} - Run the unit test suite for all modules and Scala versions
|${item(s"++$scala3Version; rootJVM3/test")} - Run tests for all JVM modules in Scala 3
|${item("fmt")} - Run scalafmt on the entire project
|${item("scripted")} - Run the scripted test suite
|${item("examples/runMain example.http4s.ExampleApp")} - Start the example server (http4s based)
|${item("examples/runMain example.akkahttp.ExampleApp")} - Start the example server (akka-http based)
|${item("examples/runMain example.quick.ExampleApp")} - Start the example server
|${item("benchmarks/jmh:run")} - Run the benchmarks
|${item("+publishLocal")} - Publish caliban locally""".stripMargin

|${item("+publishLocal")} - Publish caliban locally
|${item(scalaVersions)} - Changing scala versions""".stripMargin
}
}