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

Publicize PlatformScalaModule#platformScalaSuffix #2534

Merged
merged 2 commits into from
May 21, 2023
Merged
Changes from all 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
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