summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-02-04 04:23:12 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2018-02-04 04:23:12 -0800
commitf27c385385fbd14370b3112af64d64470068631c (patch)
treeb4be5ebbfd2638d528c201a6131985ed76cfff34
parentec83694b39bb2c61feb2cb76df0cb87ae9c3e20d (diff)
downloadmill-f27c385385fbd14370b3112af64d64470068631c.tar.gz
mill-f27c385385fbd14370b3112af64d64470068631c.tar.bz2
mill-f27c385385fbd14370b3112af64d64470068631c.zip
Use the full path of a ScalaModule in it's default artifact name, rather than just the last segment
-rwxr-xr-xbuild.sc2
-rw-r--r--core/src/mill/define/Ctx.scala9
-rw-r--r--scalalib/src/mill/scalalib/ScalaModule.scala2
3 files changed, 11 insertions, 2 deletions
diff --git a/build.sc b/build.sc
index 9ae3a1ee..aa59e0f5 100755
--- a/build.sc
+++ b/build.sc
@@ -11,7 +11,7 @@ import upickle.Js
trait MillPublishModule extends PublishModule{
def scalaVersion = "2.12.4"
def publishVersion = build.publishVersion()._2
- def artifactName = "mill-" + super.artifactName()
+
def pomSettings = PomSettings(
description = artifactName(),
organization = "com.lihaoyi",
diff --git a/core/src/mill/define/Ctx.scala b/core/src/mill/define/Ctx.scala
index 47035f71..1e85d8b3 100644
--- a/core/src/mill/define/Ctx.scala
+++ b/core/src/mill/define/Ctx.scala
@@ -30,6 +30,15 @@ case class BasePath(value: Path)
case class Segments(value: Segment*){
def ++(other: Seq[Segment]): Segments = Segments(value ++ other:_*)
def ++(other: Segments): Segments = Segments(value ++ other.value:_*)
+ def parts = value.toList match {
+ case Nil => Nil
+ case Segment.Label(head) :: rest =>
+ val stringSegments = rest.flatMap{
+ case Segment.Label(s) => Seq(s)
+ case Segment.Cross(vs) => vs.map(_.toString)
+ }
+ head +: stringSegments
+ }
def render = value.toList match {
case Nil => ""
case Segment.Label(head) :: rest =>
diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala
index 88c2e82e..fa8e8ca6 100644
--- a/scalalib/src/mill/scalalib/ScalaModule.scala
+++ b/scalalib/src/mill/scalalib/ScalaModule.scala
@@ -249,7 +249,7 @@ trait ScalaModule extends mill.Module with TaskModule { outer =>
// publish artifact with name "mill_2.12.4" instead of "mill_2.12"
def crossFullScalaVersion: T[Boolean] = false
- def artifactName: T[String] = millSourcePath.last.toString
+ def artifactName: T[String] = millModuleSegments.parts.mkString("-")
def artifactScalaVersion: T[String] = T {
if (crossFullScalaVersion()) scalaVersion()