Skip to content

Commit

Permalink
Merge pull request #135 from nightscape/mill-0.12
Browse files Browse the repository at this point in the history
Update to Mill 0.12
  • Loading branch information
ckipp01 authored Dec 23, 2024
2 parents ce4bbae + c9af946 commit 5704d5a
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 8 deletions.
13 changes: 9 additions & 4 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import $ivy.`com.goyeau::mill-scalafix::0.4.0`
import $ivy.`com.goyeau::mill-scalafix::0.4.2`
import $ivy.`io.chris-kipp::mill-ci-release::0.1.10`

import mill._
Expand All @@ -13,9 +13,9 @@ import de.tobiasroeser.mill.vcs.version.VcsVersion
import io.kipp.mill.ci.release.CiReleaseModule
import io.kipp.mill.ci.release.SonatypeHost

val millVersions = Seq("0.10.15", "0.11.11")
val millVersions = Seq("0.10.15", "0.11.12", "0.12.4")
val millBinaryVersions = millVersions.map(scalaNativeBinaryVersion)
val scala213 = "2.13.14"
val scala213 = "2.13.15"
val pluginName = "mill-ci-release"

def millBinaryVersion(millVersion: String) = scalaNativeBinaryVersion(
Expand Down Expand Up @@ -55,8 +55,13 @@ trait Plugin
override def compileIvyDeps = super.compileIvyDeps() ++ Agg(
ivy"com.lihaoyi::mill-scalalib:${millVersion(crossValue)}"
)

def millVcsMillVersion = crossValue match {
case "0.12" => "0.11"
case _ => crossValue
}
override def ivyDeps = super.ivyDeps() ++ Agg(
ivy"de.tototec::de.tobiasroeser.mill.vcs.version_mill${crossValue}::0.4.0"
ivy"de.tototec::de.tobiasroeser.mill.vcs.version_mill${millVcsMillVersion}::0.4.0"
)
override def scalacOptions = Seq("-Ywarn-unused", "-deprecation")

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.kipp.mill.ci.release

import mill.Module

/** Helper module extending PublishModule. We use our own Trait to have a bit
* more control over things and so that we can set the version for example for
* the user. This should hopefully just be one less thing they need to worry
* about. The entire goal of this is to make it frictionless for a user to
* release their project.
*/
trait BaseCiReleaseModule extends Module {
lazy val millDiscover: mill.define.Discover[this.type] =
mill.define.Discover[this.type]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.kipp.mill.ci.release

import mill.Module

/** Helper module extending PublishModule. We use our own Trait to have a bit
* more control over things and so that we can set the version for example for
* the user. This should hopefully just be one less thing they need to worry
* about. The entire goal of this is to make it frictionless for a user to
* release their project.
*/
trait BaseCiReleaseModule extends Module {
lazy val millDiscover: mill.define.Discover[this.type] =
mill.define.Discover[this.type]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.kipp.mill.ci.release

import mill._

/** Helper module extending PublishModule. We use our own Trait to have a bit
* more control over things and so that we can set the version for example for
* the user. This should hopefully just be one less thing they need to worry
* about. The entire goal of this is to make it frictionless for a user to
* release their project.
*/
trait BaseCiReleaseModule extends Module {
lazy val millDiscover: mill.define.Discover =
mill.define.Discover[this.type]
}
7 changes: 7 additions & 0 deletions plugin/src-mill0.12/io/kipp/mill/ci/release/Discover.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.kipp.mill.ci.release

private[release] object Discover {
implicit def millEvaluatorTokenReader
: mainargs.TokensReader[mill.eval.Evaluator] =
mill.main.TokenReaders.millEvaluatorTokenReader
}
9 changes: 9 additions & 0 deletions plugin/src-mill0.12/io/kipp/mill/ci/release/Eval.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.kipp.mill.ci.release

import mill.eval.Evaluator

private[release] object Eval {

def evalOrThrow(ev: Evaluator): Evaluator.EvalOrThrow = ev.evalOrThrow()

}
5 changes: 1 addition & 4 deletions plugin/src/io/kipp/mill/ci/release/CiReleaseModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ trait CiReleaseModule extends PublishModule {

// In here for the Discover import
@nowarn("msg=Unused import")
object ReleaseModule extends ExternalModule {
object ReleaseModule extends ExternalModule with BaseCiReleaseModule {

/** This is a replacement for the mill.scalalib.PublishModule/publishAll task
* that should basically work identically _but_ without requiring the user to
Expand Down Expand Up @@ -232,7 +232,4 @@ object ReleaseModule extends ExternalModule {
private def releaseModules(ev: Evaluator) =
ev.rootModule.millInternal.modules.collect { case m: CiReleaseModule => m }

import Discover._
lazy val millDiscover: mill.define.Discover[this.type] =
mill.define.Discover[this.type]
}

0 comments on commit 5704d5a

Please sign in to comment.