11package com .goyeau .mill .git
22
33import mill .*
4- import mill .api .Result .{ Exception as MillException , OuterStack , Success as MillSuccess }
4+ import mill .api .Result
55import mill .Task .workspace
66import mill .define .{Command , Discover , ExternalModule }
77import 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