Skip to content

Commit e7dff70

Browse files
adamwclaude
andcommitted
Migrate from sbt-crossproject to sbt-projectmatrix
Replace sbt-scala-native-crossproject with sbt-projectmatrix (0.11.0), matching the convention used in other SoftwareMill projects (sttp, sttp-model). Source layout changes: - core/shared/src/ → core/src/main/scala/, core/src/test/scala/ - core/jvm/src/ → core/src/main/scalajvm/, core/src/test/scalajvm/ - core/native/src/ → core/src/main/scalanative/, core/src/test/scalanative/ Project names: core3 (JVM), coreNative3 (Native), examples3, examplesNative3. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0f2d100 commit e7dff70

208 files changed

Lines changed: 41 additions & 37 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.sbt

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import com.softwaremill.SbtSoftwareMillCommon.commonSmlBuildSettings
22
import com.softwaremill.Publish.{ossPublishSettings, updateDocs}
33
import com.softwaremill.UpdateVersionInDocs
44
import com.typesafe.tools.mima.core.{MissingClassProblem, ProblemFilters}
5-
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
65
import scalanative.build._
76

7+
lazy val scala3 = "3.3.7"
8+
89
lazy val commonSettings = commonSmlBuildSettings ++ ossPublishSettings ++ Seq(
910
organization := "com.softwaremill.ox",
10-
scalaVersion := "3.3.7",
11+
scalaVersion := scala3,
1112
updateDocs := Def.taskDyn {
1213
val files1 = UpdateVersionInDocs(sLog.value, organization.value, version.value)
1314
Def.task {
@@ -52,50 +53,53 @@ compileDocumentation := {
5253
lazy val rootProject = (project in file("."))
5354
.settings(commonSettings)
5455
.settings(publishArtifact := false, name := "ox")
55-
.aggregate(core.jvm, core.native, kafka, mdcLogback, flowReactiveStreams, cron, otelContext)
56+
.aggregate(core.projectRefs ++ examples.projectRefs ++ Seq[ProjectReference](kafka, mdcLogback, flowReactiveStreams, cron, otelContext): _*)
5657

57-
lazy val core = crossProject(JVMPlatform, NativePlatform)
58-
.crossType(CrossType.Full)
59-
.in(file("core"))
58+
lazy val core = (projectMatrix in file("core"))
6059
.settings(commonSettings)
6160
.settings(
6261
name := "core",
63-
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.20" % Test,
64-
Test / fork := true
62+
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.20" % Test
6563
)
66-
.jvmSettings(
67-
libraryDependencies ++= Seq(
68-
"com.softwaremill.jox" % "channels" % "1.1.2",
69-
"org.apache.pekko" %% "pekko-stream" % "1.6.0" % Test,
70-
"org.reactivestreams" % "reactive-streams-tck-flow" % "1.0.4" % Test
64+
.jvmPlatform(
65+
scalaVersions = Seq(scala3),
66+
settings = enableMimaSettings ++ Seq(
67+
Test / fork := true,
68+
libraryDependencies ++= Seq(
69+
"com.softwaremill.jox" % "channels" % "1.1.2",
70+
"org.apache.pekko" %% "pekko-stream" % "1.6.0" % Test,
71+
"org.reactivestreams" % "reactive-streams-tck-flow" % "1.0.4" % Test
72+
)
7173
)
7274
)
73-
.jvmSettings(enableMimaSettings)
74-
.nativeSettings(
75-
Test / fork := false,
76-
// Only include native-specific tests; shared Ox tests use JVM-only APIs (java.time, java.net, etc.)
77-
Test / unmanagedSourceDirectories := Seq((Test / sourceDirectory).value / "scala"),
78-
nativeConfig ~= {
79-
_.withMultithreading(true)
80-
}
75+
.nativePlatform(
76+
scalaVersions = Seq(scala3),
77+
settings = Seq(
78+
Test / fork := false,
79+
// Only include native-specific tests; shared Ox tests use JVM-only APIs (java.time, java.net, etc.)
80+
Test / unmanagedSourceDirectories := Seq((Test / sourceDirectory).value / "scalanative"),
81+
nativeConfig ~= { _.withMultithreading(true) }
82+
)
8183
)
8284

83-
lazy val examples = crossProject(JVMPlatform, NativePlatform)
84-
.crossType(CrossType.Pure)
85-
.in(file("examples"))
85+
lazy val examples = (projectMatrix in file("examples"))
8686
.settings(commonSettings)
8787
.settings(
8888
name := "examples",
8989
publishArtifact := false,
9090
Compile / mainClass := Some("VirtualThreadsNativeJvmBenchmark")
9191
)
92-
.jvmSettings(
93-
assembly / assemblyJarName := "examples-assembly.jar"
92+
.jvmPlatform(
93+
scalaVersions = Seq(scala3),
94+
settings = Seq(
95+
assembly / assemblyJarName := "examples-assembly.jar"
96+
)
9497
)
95-
.nativeSettings(
96-
nativeConfig ~= {
97-
_.withMultithreading(true)
98-
}
98+
.nativePlatform(
99+
scalaVersions = Seq(scala3),
100+
settings = Seq(
101+
nativeConfig ~= { _.withMultithreading(true) }
102+
)
99103
)
100104
.dependsOn(core)
101105

@@ -113,7 +117,7 @@ lazy val kafka: Project = (project in file("kafka"))
113117
scalaTest
114118
)
115119
)
116-
.dependsOn(core.jvm)
120+
.dependsOn(core.jvm(scala3))
117121

118122
lazy val mdcLogback: Project = (project in file("mdc-logback"))
119123
.settings(commonSettings)
@@ -124,7 +128,7 @@ lazy val mdcLogback: Project = (project in file("mdc-logback"))
124128
scalaTest
125129
)
126130
)
127-
.dependsOn(core.jvm)
131+
.dependsOn(core.jvm(scala3))
128132

129133
lazy val flowReactiveStreams: Project = (project in file("flow-reactive-streams"))
130134
.settings(commonSettings)
@@ -135,7 +139,7 @@ lazy val flowReactiveStreams: Project = (project in file("flow-reactive-streams"
135139
scalaTest
136140
)
137141
)
138-
.dependsOn(core.jvm)
142+
.dependsOn(core.jvm(scala3))
139143

140144
lazy val cron: Project = (project in file("cron"))
141145
.settings(commonSettings)
@@ -146,7 +150,7 @@ lazy val cron: Project = (project in file("cron"))
146150
scalaTest
147151
)
148152
)
149-
.dependsOn(core.jvm % "test->test;compile->compile")
153+
.dependsOn(core.jvm(scala3) % "test->test;compile->compile")
150154

151155
lazy val otelContext: Project = (project in file("otel-context"))
152156
.settings(commonSettings)
@@ -157,7 +161,7 @@ lazy val otelContext: Project = (project in file("otel-context"))
157161
scalaTest
158162
)
159163
)
160-
.dependsOn(core.jvm % "test->test;compile->compile")
164+
.dependsOn(core.jvm(scala3) % "test->test;compile->compile")
161165

162166
lazy val documentation: Project = (project in file("generated-doc")) // important: it must not be doc/
163167
.enablePlugins(MdocPlugin)
@@ -175,7 +179,7 @@ lazy val documentation: Project = (project in file("generated-doc")) // importan
175179
libraryDependencies ++= Seq(logback % Test)
176180
)
177181
.dependsOn(
178-
core.jvm,
182+
core.jvm(scala3),
179183
kafka,
180184
mdcLogback,
181185
flowReactiveStreams,
File renamed without changes.

core/shared/src/main/scala/ox/channels/BufferCapacity.scala renamed to core/src/main/scala/ox/channels/BufferCapacity.scala

File renamed without changes.

core/shared/src/main/scala/ox/channels/ChannelClosedUnion.scala renamed to core/src/main/scala/ox/channels/ChannelClosedUnion.scala

File renamed without changes.

core/shared/src/main/scala/ox/channels/SourceCompanionOps.scala renamed to core/src/main/scala/ox/channels/SourceCompanionOps.scala

File renamed without changes.

core/shared/src/main/scala/ox/channels/SourceDrainOps.scala renamed to core/src/main/scala/ox/channels/SourceDrainOps.scala

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)