From d3184c5a8f58460cb729aaeda0b7cfaaa0ded2eb Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 20 May 2023 20:07:55 -0700 Subject: [PATCH] Publicize PlatformScalaModule#platformScalaSuffix (#2534) --- .../src/mill/scalalib/PlatformScalaModule.scala | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scalalib/src/mill/scalalib/PlatformScalaModule.scala b/scalalib/src/mill/scalalib/PlatformScalaModule.scala index 5a294d77430..3af42e6a579 100644 --- a/scalalib/src/mill/scalalib/PlatformScalaModule.scala +++ b/scalalib/src/mill/scalalib/PlatformScalaModule.scala @@ -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) } }