Skip to content

Commit

Permalink
Publicize PlatformScalaModule#platformScalaSuffix (#2534)
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi authored May 21, 2023
1 parent b8178b2 commit d3184c5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions scalalib/src/mill/scalalib/PlatformScalaModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ import mill._
trait PlatformScalaModule extends ScalaModule {
override def millSourcePath = super.millSourcePath / os.up

override def sources = T.sources {
val platform = millModuleSegments
.value
.collect { case l: mill.define.Segment.Label => l.value }
.last
/**
* The platform suffix of this [[PlatformScalaModule]]. Useful if you want to
* further customize the source paths or artifact names.
*/
def platformScalaSuffix = millModuleSegments
.value
.collect { case l: mill.define.Segment.Label => l.value }
.last

override def sources = T.sources {
super.sources().flatMap { source =>
val platformPath = PathRef(source.path / _root_.os.up / s"${source.path.last}-${platform}")
val platformPath =
PathRef(source.path / _root_.os.up / s"${source.path.last}-${platformScalaSuffix}")
Seq(source, platformPath)
}
}
Expand Down

0 comments on commit d3184c5

Please sign in to comment.