From 388a77d81e644279036be0fa46933fb74eec69da Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 20 May 2023 12:40:56 -0700 Subject: [PATCH 1/2] Publicize PlatformScalaModule#platformScalaSuffix --- .../src/mill/scalalib/PlatformScalaModule.scala | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scalalib/src/mill/scalalib/PlatformScalaModule.scala b/scalalib/src/mill/scalalib/PlatformScalaModule.scala index 5a294d77430..670b40aabeb 100644 --- a/scalalib/src/mill/scalalib/PlatformScalaModule.scala +++ b/scalalib/src/mill/scalalib/PlatformScalaModule.scala @@ -15,14 +15,18 @@ 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) } } From 0f92205523a4e366c5c28606e34c4e332a6319a5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 20 May 2023 13:16:49 -0700 Subject: [PATCH 2/2] . --- scalalib/src/mill/scalalib/PlatformScalaModule.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scalalib/src/mill/scalalib/PlatformScalaModule.scala b/scalalib/src/mill/scalalib/PlatformScalaModule.scala index 670b40aabeb..3af42e6a579 100644 --- a/scalalib/src/mill/scalalib/PlatformScalaModule.scala +++ b/scalalib/src/mill/scalalib/PlatformScalaModule.scala @@ -16,7 +16,7 @@ trait PlatformScalaModule extends ScalaModule { override def millSourcePath = super.millSourcePath / os.up /** - * The platform suffix of this [[PlatformScalaModule]]. Useful if you want to + * The platform suffix of this [[PlatformScalaModule]]. Useful if you want to * further customize the source paths or artifact names. */ def platformScalaSuffix = millModuleSegments @@ -26,7 +26,8 @@ trait PlatformScalaModule extends ScalaModule { override def sources = T.sources { super.sources().flatMap { source => - val platformPath = PathRef(source.path / _root_.os.up / s"${source.path.last}-${platformScalaSuffix}") + val platformPath = + PathRef(source.path / _root_.os.up / s"${source.path.last}-${platformScalaSuffix}") Seq(source, platformPath) } }