Skip to content

Commit

Permalink
Support Mill 0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
joan38 committed Jun 28, 2023
1 parent d3ae15b commit 9934c60
Show file tree
Hide file tree
Showing 7 changed files with 220 additions and 89 deletions.
1 change: 1 addition & 0 deletions .mill-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.10.12
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.3.3
version = 3.7.4
runner.dialect = scala213source3
project.git = true
maxColumn = 120
Expand Down
14 changes: 7 additions & 7 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import $ivy.`com.goyeau::mill-git::0.2.3`
import $ivy.`com.goyeau::mill-scalafix::0.2.8`
import $ivy.`de.tototec::de.tobiasroeser.mill.integrationtest::0.4.1-30-f29f55`
import $ivy.`io.github.davidgregory084::mill-tpolecat::0.3.0`
import $ivy.`com.goyeau::mill-git::0.2.4`
import $ivy.`com.goyeau::mill-scalafix::0.3.1`
import $ivy.`de.tototec::de.tobiasroeser.mill.integrationtest::0.7.1`
import $ivy.`io.github.davidgregory084::mill-tpolecat::0.3.2`
import com.goyeau.mill.git.{GitVersionModule, GitVersionedPublishModule}
import com.goyeau.mill.scalafix.StyleModule
import de.tobiasroeser.mill.integrationtest._
Expand All @@ -11,7 +11,7 @@ import mill.scalalib._
import mill.scalalib.api.Util.scalaNativeBinaryVersion
import mill.scalalib.publish.{Developer, License, PomSettings, VersionControl}

val millVersions = Seq("0.10.0", "0.9.12")
val millVersions = Seq("0.10.12", "0.11.1")
def millBinaryVersion(millVersion: String) = scalaNativeBinaryVersion(millVersion)

object `mill-git` extends Cross[MillGitCross](millVersions: _*)
Expand All @@ -20,15 +20,15 @@ class MillGitCross(millVersion: String)
with TpolecatModule
with StyleModule
with GitVersionedPublishModule {
override def crossScalaVersion = "2.13.7"
override def crossScalaVersion = "2.13.10"
override def artifactSuffix = s"_mill${millBinaryVersion(millVersion)}" + super.artifactSuffix()

override def compileIvyDeps = super.compileIvyDeps() ++ Agg(
ivy"com.lihaoyi::mill-main:$millVersion",
ivy"com.lihaoyi::mill-scalalib:$millVersion",
ivy"com.lihaoyi::mill-contrib-docker:$millVersion"
)
override def ivyDeps = super.ivyDeps() ++ Agg(ivy"org.eclipse.jgit:org.eclipse.jgit:6.3.0.202209071007-r")
override def ivyDeps = super.ivyDeps() ++ Agg(ivy"org.eclipse.jgit:org.eclipse.jgit:6.6.0.202305301015-r")

override def publishVersion = GitVersionModule.version(withSnapshotSuffix = true)()
def pomSettings = PomSettings(
Expand Down
34 changes: 19 additions & 15 deletions itest/src/custom/build.sc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import $exec.plugins
import $file.plugins
import com.goyeau.mill.git.GitVersionModule
import mill._
import mill.scalalib.JavaModule
Expand All @@ -10,6 +10,8 @@ object project extends JavaModule {

// Uncommitted changes
def setupUncommittedChanges = T.input {
remove.all(pwd / ".git")

proc("git", "init").call()
}
def uncommittedChanges() = T.command {
Expand All @@ -22,6 +24,8 @@ def uncommittedChanges() = T.command {

// Commit without tag
def setupCommitWithoutTag = T.input {
remove.all(pwd / ".git")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -37,6 +41,9 @@ def commitWithoutTag() = T.command {

// Uncommitted changes after commit without tag
def setupUncommittedChangesAfterCommitWithoutTag = T.input {
remove.all(pwd / ".git")
remove(pwd / "some-file")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -48,13 +55,12 @@ def uncommittedChangesAfterCommitWithoutTag() = T.command {
assert("""[\da-f]{7}""".r.findFirstIn(project.jobVersion()).isDefined)
val hash = proc("git", "rev-parse", "HEAD").call().out.trim().take(7)
assert(!project.jobVersion().contains(hash))

remove.all(pwd / ".git")
remove(pwd / "some-file")
}

// Head tagged
def setupHeadTagged = T.input {
remove.all(pwd / ".git")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -64,12 +70,13 @@ def headTagged() = T.command {
setupHeadTagged()

assert(project.jobVersion() == "1.0.0")

remove.all(pwd / ".git")
}

// Uncommitted changes after tag
def setupUncommittedChangesAfterTag = T.input {
remove.all(pwd / ".git")
remove(pwd / "some-file")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -82,13 +89,13 @@ def uncommittedChangesAfterTag() = T.command {
assert("""1\.0\.0-1-[\da-f]{7}""".r.findFirstIn(project.jobVersion()).isDefined)
val hash = proc("git", "rev-parse", "HEAD").call().out.trim().take(7)
assert(!project.jobVersion().contains(hash))

remove.all(pwd / ".git")
remove(pwd / "some-file")
}

// Commit after tag
def setupCommitAfterTag = T.input {
remove.all(pwd / ".git")
remove(pwd / "some-file")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -102,13 +109,13 @@ def commitAfterTag() = T.command {

val hash = proc("git", "rev-parse", "HEAD").call().out.trim().take(7)
assert(project.jobVersion() == s"1.0.0-1-$hash")

remove.all(pwd / ".git")
remove(pwd / "some-file")
}

// Uncommitted changes after tag and after commit
def setupUncommittedChangesAfterTagAndCommit = T.input {
remove.all(pwd / ".git")
remove(pwd / "some-file")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -124,7 +131,4 @@ def uncommittedChangesAfterTagAndCommit() = T.command {
assert("""1\.0\.0-2-[\da-f]{7}""".r.findFirstIn(project.jobVersion()).isDefined)
val hash = proc("git", "rev-parse", "HEAD").call().out.trim().take(7)
assert(!project.jobVersion().contains(hash))

remove.all(pwd / ".git")
remove(pwd / "some-file")
}
38 changes: 19 additions & 19 deletions itest/src/docker/build.sc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import $exec.plugins
import $file.plugins
import $ivy.`com.lihaoyi::mill-contrib-docker:$MILL_VERSION`
import com.goyeau.mill.git.GitTaggedDockerModule
import mill._
Expand All @@ -14,6 +14,8 @@ object project extends JavaModule with GitTaggedDockerModule {

// Uncommitted changes
def setupUncommittedChanges = T.input {
remove.all(pwd / ".git")

proc("git", "init").call()
}
def uncommittedChanges() = T.command {
Expand All @@ -23,12 +25,12 @@ def uncommittedChanges() = T.command {
assert(tags.size == 2)
assert("""project:[\da-f]{7}""".r.findFirstIn(tags(0)).isDefined)
assert(tags(1) == "project:latest")

remove.all(pwd / ".git")
}

// Commit without tag
def setupCommitWithoutTag = T.input {
remove.all(pwd / ".git")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -41,12 +43,13 @@ def commitWithoutTag() = T.command {
assert(tags.size == 2)
assert(tags(0) == s"project:$hash")
assert(tags(1) == "project:latest")

remove.all(pwd / ".git")
}

// Uncommitted changes after commit without tag
def setupUncommittedChangesAfterCommitWithoutTag = T.input {
remove.all(pwd / ".git")
remove(pwd / "some-file")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -61,13 +64,12 @@ def uncommittedChangesAfterCommitWithoutTag() = T.command {
val hash = proc("git", "rev-parse", "HEAD").call().out.trim().take(7)
assert(!tags(0).contains(hash))
assert(tags(1) == "project:latest")

remove.all(pwd / ".git")
remove(pwd / "some-file")
}

// Head tagged
def setupHeadTagged = T.input {
remove.all(pwd / ".git")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -80,12 +82,13 @@ def headTagged() = T.command {
assert(tags.size == 2)
assert(tags(0) == s"project:1.0.0")
assert(tags(1) == "project:latest")

remove.all(pwd / ".git")
}

// Uncommitted changes after tag
def setupUncommittedChangesAfterTag = T.input {
remove.all(pwd / ".git")
remove(pwd / "some-file")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -101,13 +104,13 @@ def uncommittedChangesAfterTag() = T.command {
val hash = proc("git", "rev-parse", "HEAD").call().out.trim().take(7)
assert(!tags(0).contains(hash))
assert(tags(1) == "project:latest")

remove.all(pwd / ".git")
remove(pwd / "some-file")
}

// Commit after tag
def setupCommitAfterTag = T.input {
remove.all(pwd / ".git")
remove(pwd / "some-file")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -124,13 +127,13 @@ def commitAfterTag() = T.command {
val hash = proc("git", "rev-parse", "HEAD").call().out.trim().take(7)
assert(tags(0) == s"project:1.0.0-1-$hash")
assert(tags(1) == "project:latest")

remove.all(pwd / ".git")
remove(pwd / "some-file")
}

// Uncommitted changes after tag and after commit
def setupUncommittedChangesAfterTagAndCommit = T.input {
remove.all(pwd / ".git")
remove(pwd / "some-file")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -149,7 +152,4 @@ def uncommittedChangesAfterTagAndCommit() = T.command {
val hash = proc("git", "rev-parse", "HEAD").call().out.trim().take(7)
assert(!tags(0).contains(hash))
assert(tags(1) == "project:latest")

remove.all(pwd / ".git")
remove(pwd / "some-file")
}
38 changes: 19 additions & 19 deletions itest/src/publish/build.sc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import $exec.plugins
import $file.plugins
import com.goyeau.mill.git.GitVersionedPublishModule
import mill._
import mill.scalalib.JavaModule
Expand All @@ -18,18 +18,20 @@ object project extends JavaModule with GitVersionedPublishModule {

// Uncommitted changes
def setupUncommittedChanges = T.input {
remove.all(pwd / ".git")

proc("git", "init").call()
}
def uncommittedChanges() = T.command {
setupUncommittedChanges()

assert("""[\da-f]{7}""".r.findFirstIn(project.publishVersion()).isDefined)

remove.all(pwd / ".git")
}

// Commit without tag
def setupCommitWithoutTag = T.input {
remove.all(pwd / ".git")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -39,12 +41,13 @@ def commitWithoutTag() = T.command {

val hash = proc("git", "rev-parse", "HEAD").call().out.trim().take(7)
assert(project.publishVersion() == hash)

remove.all(pwd / ".git")
}

// Uncommitted changes after commit without tag
def setupUncommittedChangesAfterCommitWithoutTag = T.input {
remove.all(pwd / ".git")
remove(pwd / "some-file")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -56,13 +59,12 @@ def uncommittedChangesAfterCommitWithoutTag() = T.command {
assert("""[\da-f]{7}""".r.findFirstIn(project.publishVersion()).isDefined)
val hash = proc("git", "rev-parse", "HEAD").call().out.trim().take(7)
assert(!project.publishVersion().contains(hash))

remove.all(pwd / ".git")
remove(pwd / "some-file")
}

// Head tagged
def setupHeadTagged = T.input {
remove.all(pwd / ".git")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -72,12 +74,13 @@ def headTagged() = T.command {
setupHeadTagged()

assert(project.publishVersion() == "1.0.0")

remove.all(pwd / ".git")
}

// Uncommitted changes after tag
def setupUncommittedChangesAfterTag = T.input {
remove.all(pwd / ".git")
remove(pwd / "some-file")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -90,13 +93,13 @@ def uncommittedChangesAfterTag() = T.command {
assert("""1\.0\.0-1-[\da-f]{7}""".r.findFirstIn(project.publishVersion()).isDefined)
val hash = proc("git", "rev-parse", "HEAD").call().out.trim().take(7)
assert(!project.publishVersion().contains(hash))

remove.all(pwd / ".git")
remove(pwd / "some-file")
}

// Commit after tag
def setupCommitAfterTag = T.input {
remove.all(pwd / ".git")
remove(pwd / "some-file")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -110,13 +113,13 @@ def commitAfterTag() = T.command {

val hash = proc("git", "rev-parse", "HEAD").call().out.trim().take(7)
assert(project.publishVersion() == s"1.0.0-1-$hash")

remove.all(pwd / ".git")
remove(pwd / "some-file")
}

// Uncommitted changes after tag and after commit
def setupUncommittedChangesAfterTagAndCommit = T.input {
remove.all(pwd / ".git")
remove(pwd / "some-file")

proc("git", "init").call()
proc("git", "add", "--all").call()
proc("git", "commit", "-m", "Some commit").call()
Expand All @@ -132,7 +135,4 @@ def uncommittedChangesAfterTagAndCommit() = T.command {
assert("""1\.0\.0-2-[\da-f]{7}""".r.findFirstIn(project.publishVersion()).isDefined)
val hash = proc("git", "rev-parse", "HEAD").call().out.trim().take(7)
assert(!project.publishVersion().contains(hash))

remove.all(pwd / ".git")
remove(pwd / "some-file")
}
Loading

0 comments on commit 9934c60

Please sign in to comment.