Skip to content

Commit ecdb83d

Browse files
committed
Support Mill 0.13.0-M0-93-a6992e
1 parent 08e7535 commit ecdb83d

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

build.mill

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import mill.scalalib.publish.{Developer, License, PomSettings, VersionControl}
1010
import org.typelevel.scalacoptions.ScalacOptions._
1111
import org.typelevel.scalacoptions.{ScalaVersion, ScalacOptions}
1212

13-
object `mill-git` extends Cross[MillGitCross]("0.12.0", "0.13.0-M0")
13+
object `mill-git` extends Cross[MillGitCross]("0.12.0", "0.13.0-M0-93-a6992e")
1414
trait MillGitCross extends Cross.Module[String] with StyleModule with GitVersionedPublishModule {
1515
val millVersion = crossValue
16-
override def scalaVersion = millBinaryVersion(millVersion) match {
17-
case "0.11" => "2.13.16"
18-
case "0.13" => "3.6.3"
16+
override def scalaVersion = millVersion match {
17+
case millVersion if millVersion.startsWith("0.12") => "2.13.16"
18+
case millVersion if millVersion.startsWith("0.13") => "3.6.3"
1919
}
2020
override def scalacOptions = super.scalacOptions() ++ ScalacOptions.tokensForVersion(
2121
ScalaVersion.unsafeFromString(scalaVersion()),
@@ -62,6 +62,6 @@ trait MillGitCross extends Cross.Module[String] with StyleModule with GitVersion
6262

6363
def millBinaryVersion(millVersion: String) = millVersion match {
6464
case version if version.startsWith("0.12") => "0.11" // 0.12.x is binary compatible with 0.11.x
65-
case version if version.startsWith("0.13") => "0.13"
65+
case version if version.startsWith("0.13") => "0.13.0-M0"
6666
case _ => throw new IllegalArgumentException(s"Unsupported Mill version: $millVersion")
6767
}

mill-git/src/com/goyeau/mill/git/GitVersionModule.scala

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.goyeau.mill.git
22

33
import mill.*
4-
import mill.api.Result.{Exception as MillException, OuterStack, Success as MillSuccess}
4+
import mill.api.Result
55
import mill.Task.workspace
66
import mill.define.{Command, Discover, ExternalModule}
77
import org.eclipse.jgit.api.Git
@@ -24,7 +24,7 @@ object GitVersionModule extends ExternalModule {
2424
val describeResult = Try(git.describe().setTags(true).setMatch("v[0-9]*").setAlways(true).call())
2525

2626
describeResult match {
27-
case TryFailure(_) => MillSuccess(uncommitted())
27+
case TryFailure(_) => Result.Success(uncommitted())
2828
case TrySuccess(description) =>
2929
val taggedRegex = """v(\d.*?)(?:-(\d+)-g([\da-f]+))?""".r
3030
val untaggedRegex = """([\da-f]+)""".r
@@ -38,13 +38,11 @@ object GitVersionModule extends ExternalModule {
3838
if (isDirty) s"-${distance.toInt + 1}-${uncommitted()}"
3939
else s"-$distance-${hash.take(hashLength)}$snapshotSuffix"
4040
}
41-
MillSuccess(s"$tag$distanceHash")
41+
Result.Success(s"$tag$distanceHash")
4242
case untaggedRegex(hash) =>
43-
if (isDirty) MillSuccess(uncommitted())
44-
else MillSuccess(s"${hash.take(hashLength)}$snapshotSuffix")
45-
case _ =>
46-
val exception = new IllegalStateException(s"Unexpected git describe output: $description")
47-
MillException(exception, new OuterStack(exception.getStackTrace.toIndexedSeq))
43+
if (isDirty) Result.Success(uncommitted())
44+
else Result.Success(s"${hash.take(hashLength)}$snapshotSuffix")
45+
case _ => Result.Failure(s"Unexpected git describe output: $description")
4846
}
4947
}
5048
}

0 commit comments

Comments
 (0)