Skip to content

Commit 318d052

Browse files
lefoumpollmeier
authored andcommitted
Added Scala version specific source paths based on ranges
A version with a `-` suffix targets code for all Scala versions smaller or equal. A version with a `+` suffix targets code for all Scala versions greater or equal. You can run `mill showNamed __.sources` to see all source dirs.
1 parent 23d23d6 commit 318d052

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

build.sc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,15 @@ trait OsLibModule extends CrossScalaModule with PublishModule with AcyclicModule
143143
)
144144
def platformSegment: String
145145
override def millSourcePath = super.millSourcePath / oslib.up
146-
override def sources = T.sources(
147-
millSourcePath / "src",
148-
millSourcePath / s"src-$platformSegment"
149-
)
146+
override def sources = T.sources {
147+
Seq(
148+
PathRef(millSourcePath / "src"),
149+
PathRef(millSourcePath / s"src-$platformSegment")
150+
) ++
151+
ZincWorkerUtil.versionRanges(crossScalaVersion, scalaVersions).map(vr =>
152+
PathRef(millSourcePath / s"src-${vr}"))
153+
154+
}
150155
}
151156

152157
trait OsLibTestModule extends ScalaModule with TestModule.Utest with SafeDeps {

0 commit comments

Comments
 (0)