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 d5ef05a commit c7d928e
Show file tree
Hide file tree
Showing 37 changed files with 516 additions and 224 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
- name: Checks
run: |
git config --global user.name "CI"
./mill __.checkFormat + __.fix --check + __.docJar + __.test
./mill __.checkStyle + __.test + __.docJar + __.publishLocal
- name: Publish
if: github.ref == 'refs/heads/main' || 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.11.12
0.12.5
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# mill-scalafix

[![Maven Central](https://img.shields.io/maven-central/v/com.goyeau/mill-scalafix_mill0.11_2.13)](https://mvnrepository.com/artifact/com.goyeau/mill-scalafix_mill0.11_2.13)
[![Maven Central](https://img.shields.io/maven-central/v/com.goyeau/mill-scalafix_mill0.11_2.13)](https://mvnrepository.com/artifact/com.goyeau/mill-scalafix_mill0.11)

A [scalafix](https://scalacenter.github.io/scalafix) plugin for Mill build tool.

Expand All @@ -16,7 +16,7 @@ import com.goyeau.mill.scalafix.ScalafixModule
import mill.scalalib._

object project extends ScalaModule with ScalafixModule {
def scalaVersion = "2.13.8"
def scalaVersion = "2.13.15"
}
```

Expand Down
67 changes: 67 additions & 0 deletions build.mill
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import $ivy.`com.goyeau::mill-git::0.2.6`
import $ivy.`com.goyeau::mill-scalafix::0.4.2`
import $ivy.`org.typelevel::scalac-options:0.1.7`
import com.goyeau.mill.git.{GitVersionModule, GitVersionedPublishModule}
import com.goyeau.mill.scalafix.StyleModule
import mill._
import mill.Task.dest
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.12.0")
def millBinaryVersion(millVersion: String) = scalaNativeBinaryVersion(millVersion) match {
case "0.12" => "0.11"
case version => version
}

object `mill-scalafix` extends Cross[MillScalafixCross](millVersions)
trait MillScalafixCross 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 compileIvyDeps = super.compileIvyDeps() ++ Agg(
ivy"com.lihaoyi::mill-main:$millVersion",
ivy"com.lihaoyi::mill-scalalib:$millVersion"
)
override def ivyDeps = super.ivyDeps() ++ Agg(
ivy"ch.epfl.scala:scalafix-interfaces:0.13.0",
ivy"org.scala-lang.modules::scala-java8-compat:1.0.2"
)

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 = dest / MillScalafixCross.this.artifactId()
os.write(p, MillScalafixCross.this.localClasspath().map(_.path).mkString("\n"), createFolders = true)
Seq(PathRef(dest))
}
}
}

override def artifactName = s"mill-scalafix_mill${millBinaryVersion(millVersion)}"
override def publishVersion = GitVersionModule.version(withSnapshotSuffix = true)()
def pomSettings = PomSettings(
description = "A Scalafix plugin for Mill build tool",
organization = "com.goyeau",
url = "https://github.com/joan38/mill-scalafix",
licenses = Seq(License.MIT),
versionControl = VersionControl.github("joan38", "mill-scalafix"),
developers = Seq(Developer("joan38", "Joan Goyeau", "https://github.com/joan38"))
)
}
80 changes: 0 additions & 80 deletions build.sc

This file was deleted.

3 changes: 0 additions & 3 deletions itest/src/check-failed/project/src/Fix.scala

This file was deleted.

33 changes: 0 additions & 33 deletions itest/src/custom-rule/build.sc

This file was deleted.

23 changes: 0 additions & 23 deletions itest/src/fix-2.12/build.sc

This file was deleted.

21 changes: 0 additions & 21 deletions itest/src/fix-3.5/build.sc

This file was deleted.

22 changes: 0 additions & 22 deletions itest/src/fix/build.sc

This file was deleted.

Loading

0 comments on commit c7d928e

Please sign in to comment.