diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-02-04 16:14:25 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-02-04 16:38:21 -0800 |
commit | 593d9f94794e6db8040e7082ba50a24d86c4cc06 (patch) | |
tree | 061aa31787a213866964cff6d52a98295c2a0e1f /scalalib | |
parent | 5871dd570403906435ad407059398c53d002fdbf (diff) | |
download | mill-593d9f94794e6db8040e7082ba50a24d86c4cc06.tar.gz mill-593d9f94794e6db8040e7082ba50a24d86c4cc06.tar.bz2 mill-593d9f94794e6db8040e7082ba50a24d86c4cc06.zip |
properly embed the local module dependency graph metadata in published pom.xmls
Diffstat (limited to 'scalalib')
-rw-r--r-- | scalalib/src/mill/scalalib/PublishModule.scala | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/scalalib/src/mill/scalalib/PublishModule.scala b/scalalib/src/mill/scalalib/PublishModule.scala index 785f77ac..19fafaa3 100644 --- a/scalalib/src/mill/scalalib/PublishModule.scala +++ b/scalalib/src/mill/scalalib/PublishModule.scala @@ -2,6 +2,7 @@ package mill package scalalib import ammonite.ops._ +import mill.define.Task import mill.eval.{PathRef, Result} import mill.util.Loose.Agg /** @@ -10,14 +11,28 @@ import mill.util.Loose.Agg trait PublishModule extends ScalaModule { outer => import mill.scalalib.publish._ + override def moduleDeps = Seq.empty[PublishModule] + def pomSettings: T[PomSettings] def publishVersion: T[String] def artifactId: T[String] = T { s"${artifactName()}${artifactSuffix()}" } - + def publishSelfDependency = T{ + Artifact(pomSettings().organization, artifactId(), publishVersion()), + } + def publishUpstreamDependencies = T{ Task.sequence(moduleDeps.map(_.publishSelfDependency)) } def pom = T { - val dependencies = - ivyDeps().map(Artifact.fromDep(_, scalaVersion(), Lib.scalaBinaryVersion(scalaVersion()))) - val pom = Pom(artifact(), dependencies, artifactId(), pomSettings()) + val ivyPomDeps = ivyDeps().map( + Artifact.fromDep(_, scalaVersion(), Lib.scalaBinaryVersion(scalaVersion())) + ) + + val upstreamPomDeps = publishUpstreamDependencies().map(Dependency(_, Scope.Compile)) + + val pom = Pom( + artifact(), + ivyPomDeps ++ upstreamPomDeps, + artifactId(), + pomSettings() + ) val pomPath = T.ctx().dest / s"${artifactId()}-${publishVersion()}.pom" write.over(pomPath, pom) |