Skip to content

Commit

Permalink
Upgrade to Mill 0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
joan38 committed Jan 5, 2025
1 parent a0628d6 commit 95ad6f5
Show file tree
Hide file tree
Showing 19 changed files with 487 additions and 462 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ jobs:
- name: Checks
run: |
git config --global user.name "CI"
./mill all __.checkStyle __.docJar __.publishLocal __.test
./mill __.checkStyle
./mill __.docJar
./mill __.publishLocal
./mill __.test
- name: Publish
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release'
run: |
echo "${{secrets.pgp_secret_key}}" > private.key
gpg --batch --yes --import private.key
rm private.key
./mill mill.scalalib.PublishModule/publishAll --sonatypeCreds ${{secrets.sonatype_credentials}} --publishArtifacts __.publishArtifacts --awaitTimeout 600000 --release true
./mill mill.scalalib.PublishModule/publishAll --sonatypeCreds ${{secrets.sonatype_credentials}} --publishArtifacts __.publishArtifacts --release true
2 changes: 1 addition & 1 deletion .mill-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.10.15
0.12.5
56 changes: 26 additions & 30 deletions build.sc → build.mill
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
import $ivy.`com.goyeau::mill-git::0.2.5`
import $ivy.`com.goyeau::mill-git::0.2.6`
import $ivy.`com.goyeau::mill-scalafix::0.4.2`
import $ivy.`de.tototec::de.tobiasroeser.mill.integrationtest::0.7.1`
import $ivy.`org.typelevel::scalac-options:0.1.7`
import com.goyeau.mill.git.{GitVersionModule, GitVersionedPublishModule}
import com.goyeau.mill.scalafix.StyleModule
import de.tobiasroeser.mill.integrationtest._
import mill._
import mill.scalalib._
import mill.scalalib.api.ZincWorkerUtil.scalaNativeBinaryVersion
import mill.scalalib.publish.{Developer, License, PomSettings, VersionControl}
import org.typelevel.scalacoptions.ScalacOptions._
import org.typelevel.scalacoptions.{ScalaVersion, ScalacOptions}

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

object `mill-git` extends Cross[MillGitCross](millVersions: _*)
class MillGitCross(millVersion: String)
extends CrossModuleBase
with StyleModule
with GitVersionedPublishModule {
override def crossScalaVersion = "2.13.10"
object `mill-git` extends Cross[MillGitCross](millVersions)
trait MillGitCross extends Cross.Module[String] with StyleModule with GitVersionedPublishModule {
val millVersion = crossValue
override def scalaVersion = "2.13.15"
override def scalacOptions = super.scalacOptions() ++ ScalacOptions.tokensForVersion(
ScalaVersion.unsafeFromString(scalaVersion()),
ScalacOptions.default + source3 ++ fatalWarningOptions
)
override def artifactSuffix = s"_mill${millBinaryVersion(millVersion)}" + super.artifactSuffix()
override def artifactName = s"mill-git_mill${scalaNativeBinaryVersion(millVersion)}"

override def compileIvyDeps = super.compileIvyDeps() ++ Agg(
ivy"com.lihaoyi::mill-main:$millVersion",
Expand All @@ -34,6 +29,25 @@ class MillGitCross(millVersion: String)
)
override def ivyDeps = super.ivyDeps() ++ Agg(ivy"org.eclipse.jgit:org.eclipse.jgit:6.10.0.202406032230-r")

object test extends ScalaTests with TestModule.Munit {
override def ivyDeps = Agg(
ivy"org.scalameta::munit::1.0.3",
ivy"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 ivyDeps = Agg(ivy"com.lihaoyi:mill-dist:$millVersion")
override def mainClass = Some("mill.runner.client.MillClientMain")
override def resources = T {
val p = Task.dest / "mill/local-test-overrides" / s"com.lihaoyi-${MillGitCross.this.artifactId()}"
os.write(p, MillGitCross.this.localClasspath().map(_.path).mkString("\n"), createFolders = true)
Seq(PathRef(T.dest))
}
}
}

override def publishVersion = GitVersionModule.version(withSnapshotSuffix = true)()
def pomSettings = PomSettings(
description = "A git version plugin for Mill build tool",
Expand All @@ -44,21 +58,3 @@ class MillGitCross(millVersion: String)
developers = Seq(Developer("joan38", "Joan Goyeau", "https://github.com/joan38"))
)
}

object itest extends Cross[ITestCross](millVersions: _*)
class ITestCross(millVersion: String) extends MillIntegrationTestModule {
override def millSourcePath = super.millSourcePath / os.up
override def millTestVersion = millVersion
override def pluginsUnderTest = Seq(`mill-git`(millVersion))
override def testInvocations = testCases().map(
_ -> Seq(
TestInvocation.Targets(Seq("uncommittedChanges")),
TestInvocation.Targets(Seq("commitWithoutTag")),
TestInvocation.Targets(Seq("uncommittedChangesAfterCommitWithoutTag")),
TestInvocation.Targets(Seq("headTagged")),
TestInvocation.Targets(Seq("uncommittedChangesAfterTag")),
TestInvocation.Targets(Seq("commitAfterTag")),
TestInvocation.Targets(Seq("uncommittedChangesAfterTagAndCommit"))
)
)
}
134 changes: 0 additions & 134 deletions itest/src/custom/build.sc

This file was deleted.

Loading

0 comments on commit 95ad6f5

Please sign in to comment.