1- import $ivy .`com.goyeau::mill-git::0.2.5 `
1+ import $ivy.`com.goyeau::mill-git::0.2.6 `
22import $ivy.`com.goyeau::mill-scalafix::0.4.2`
3- import $ivy .`de.tototec::de.tobiasroeser.mill.integrationtest::0.7.1`
43import $ivy.`org.typelevel::scalac-options:0.1.7`
54import com.goyeau.mill.git.{GitVersionModule, GitVersionedPublishModule}
65import com.goyeau.mill.scalafix.StyleModule
7- import de .tobiasroeser .mill .integrationtest ._
86import mill._
97import mill.scalalib._
108import mill.scalalib.api.ZincWorkerUtil.scalaNativeBinaryVersion
119import mill.scalalib.publish.{Developer, License, PomSettings, VersionControl}
1210import org.typelevel.scalacoptions.ScalacOptions._
1311import org.typelevel.scalacoptions.{ScalaVersion, ScalacOptions}
1412
15- val millVersions = Seq (" 0.10.12" , " 0.11.1" , " 0.12.4" )
16- def millBinaryVersion (millVersion : String ) = scalaNativeBinaryVersion(millVersion)
13+ val millVersions = Seq("0.12.0")
1714
18- object `mill-git` extends Cross [MillGitCross ](millVersions : _* )
19- class MillGitCross (millVersion : String )
20- extends CrossModuleBase
21- with StyleModule
22- with GitVersionedPublishModule {
23- override def crossScalaVersion = " 2.13.10"
15+ object `mill-git` extends Cross[MillGitCross](millVersions)
16+ trait MillGitCross extends Cross.Module[String] with StyleModule with GitVersionedPublishModule {
17+ val millVersion = crossValue
18+ override def scalaVersion = "2.13.15"
2419 override def scalacOptions = super.scalacOptions() ++ ScalacOptions.tokensForVersion(
2520 ScalaVersion.unsafeFromString(scalaVersion()),
2621 ScalacOptions.default + source3 ++ fatalWarningOptions
2722 )
28- override def artifactSuffix = s " _mill ${millBinaryVersion (millVersion)}" + super .artifactSuffix()
23+ override def artifactName = s"mill-git_mill${scalaNativeBinaryVersion (millVersion)}"
2924
3025 override def compileIvyDeps = super.compileIvyDeps() ++ Agg(
3126 ivy"com.lihaoyi::mill-main:$millVersion",
@@ -34,6 +29,25 @@ class MillGitCross(millVersion: String)
3429 )
3530 override def ivyDeps = super.ivyDeps() ++ Agg(ivy"org.eclipse.jgit:org.eclipse.jgit:6.10.0.202406032230-r")
3631
32+ object test extends ScalaTests with TestModule.Munit {
33+ override def ivyDeps = Agg(
34+ ivy"org.scalameta::munit::1.0.3",
35+ ivy"com.lihaoyi::mill-testkit:$millVersion"
36+ )
37+ override def forkEnv = Map("MILL_EXECUTABLE_PATH" -> millExecutable.assembly().path.toString)
38+
39+ // Create a Mill executable configured for testing our plugin
40+ object millExecutable extends JavaModule {
41+ override def ivyDeps = Agg(ivy"com.lihaoyi:mill-dist:$millVersion")
42+ override def mainClass = Some("mill.runner.client.MillClientMain")
43+ override def resources = T {
44+ val p = Task.dest / "mill/local-test-overrides" / s"com.lihaoyi-${MillGitCross.this.artifactId()}"
45+ os.write(p, MillGitCross.this.localClasspath().map(_.path).mkString("\n"), createFolders = true)
46+ Seq(PathRef(T.dest))
47+ }
48+ }
49+ }
50+
3751 override def publishVersion = GitVersionModule.version(withSnapshotSuffix = true)()
3852 def pomSettings = PomSettings(
3953 description = "A git version plugin for Mill build tool",
@@ -44,21 +58,3 @@ class MillGitCross(millVersion: String)
4458 developers = Seq(Developer("joan38", "Joan Goyeau", "https://github.com/joan38"))
4559 )
4660}
47-
48- object itest extends Cross [ITestCross ](millVersions : _* )
49- class ITestCross (millVersion : String ) extends MillIntegrationTestModule {
50- override def millSourcePath = super .millSourcePath / os.up
51- override def millTestVersion = millVersion
52- override def pluginsUnderTest = Seq (`mill-git`(millVersion))
53- override def testInvocations = testCases().map(
54- _ -> Seq (
55- TestInvocation .Targets (Seq (" uncommittedChanges" )),
56- TestInvocation .Targets (Seq (" commitWithoutTag" )),
57- TestInvocation .Targets (Seq (" uncommittedChangesAfterCommitWithoutTag" )),
58- TestInvocation .Targets (Seq (" headTagged" )),
59- TestInvocation .Targets (Seq (" uncommittedChangesAfterTag" )),
60- TestInvocation .Targets (Seq (" commitAfterTag" )),
61- TestInvocation .Targets (Seq (" uncommittedChangesAfterTagAndCommit" ))
62- )
63- )
64- }
0 commit comments