-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.mill
More file actions
67 lines (60 loc) · 2.85 KB
/
build.mill
File metadata and controls
67 lines (60 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//| mill-version: 1.1.0-native
//| mill-jvm-version: 17
//| repositories:
//| - https://central.sonatype.com/repository/maven-snapshots
//| - https://oss.sonatype.org/content/repositories/snapshots
//| mvnDeps:
//| - com.goyeau::mill-git::0.3.2
//| - com.goyeau::mill-scalafix::0.6.0
//| - org.typelevel::scalac-options:0.1.8
import com.goyeau.mill.git.{GitVersionModule, GitVersionedPublishModule}
import com.goyeau.mill.scalafix.StyleModule
import mill.*
import mill.api.Cross
import mill.scalalib.*
import mill.scalalib.publish.{Developer, License, PomSettings, VersionControl}
import org.typelevel.scalacoptions.ScalacOptions.*
import org.typelevel.scalacoptions.{ScalaVersion, ScalacOptions}
object `mill-git` extends Cross[MillGitCross]("1.0.0")
trait MillGitCross
extends Cross.Module[String]
with StyleModule
with GitVersionedPublishModule
with SonatypeCentralPublishModule:
val millVersion = crossValue
override def scalaVersion = "3.7.4"
override def scalacOptions = super.scalacOptions() ++ ScalacOptions.tokensForVersion(
ScalaVersion.unsafeFromString(scalaVersion()),
ScalacOptions.default + source3 ++ fatalWarningOptions
)
override def compileMvnDeps = super.compileMvnDeps() ++ Seq(
mvn"com.lihaoyi::mill-libs-scalalib:$millVersion",
mvn"com.lihaoyi::mill-contrib-docker:$millVersion"
)
override def mvnDeps = super.mvnDeps() ++ Seq(mvn"org.eclipse.jgit:org.eclipse.jgit:7.5.0.202512021534-r")
object test extends ScalaTests with TestModule.Munit with StyleModule:
override def mvnDeps = Seq(
mvn"org.scalameta::munit::1.2.2",
mvn"com.lihaoyi::mill-testkit:$millVersion"
)
override def forkEnv = Map("MILL_EXECUTABLE_PATH" -> millExecutable.assembly().path.toString)
// Create a Mill executable configured for testing our plugin
object millExecutable extends JavaModule:
override def mvnDeps = Seq(mvn"com.lihaoyi:mill-runner-launcher_3:$millVersion")
override def mainClass = Some("mill.launcher.MillLauncherMain")
end test
override def artifactName = s"mill-git_mill${millBinaryVersion(millVersion)}"
override def publishVersion = GitVersionModule.version(withSnapshotSuffix = true)()
def pomSettings = PomSettings(
description = "A git version plugin for Mill build tool",
organization = "com.goyeau",
url = "https://github.com/joan38/mill-git",
licenses = Seq(License.MIT),
versionControl = VersionControl.github("joan38", "mill-git"),
developers = Seq(Developer("joan38", "Joan Goyeau", "https://github.com/joan38"))
)
end MillGitCross
def millBinaryVersion(millVersion: String) = millVersion match
case version if version.startsWith("0.12") => "0.11" // 0.12.x is binary compatible with 0.11.x
case version if version.startsWith("1.") => "1"
case _ => throw IllegalArgumentException(s"Unsupported Mill version: $millVersion")