Skip to content

Commit

Permalink
Move from mill-tpolecat to scalac-options
Browse files Browse the repository at this point in the history
  • Loading branch information
joan38 committed Oct 14, 2024
1 parent 59f580e commit c0d74bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
import $ivy.`com.goyeau::mill-git::0.2.5`
import $ivy.`com.goyeau::mill-scalafix::0.4.2`
import $ivy.`de.tototec::de.tobiasroeser.mill.integrationtest::0.7.1`
import $ivy.`io.github.davidgregory084::mill-tpolecat::0.3.5`
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 io.github.davidgregory084.TpolecatModule
import mill._
import mill.scalalib._
import mill.scalalib.api.Util.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")
def millBinaryVersion(millVersion: String) = scalaNativeBinaryVersion(millVersion)

object `mill-git` extends Cross[MillGitCross](millVersions: _*)
class MillGitCross(millVersion: String)
extends CrossModuleBase
with TpolecatModule
with StyleModule
with GitVersionedPublishModule {
override def crossScalaVersion = "2.13.10"
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 compileIvyDeps = super.compileIvyDeps() ++ Agg(
Expand Down
3 changes: 2 additions & 1 deletion mill-git/src/com/goyeau/mill/git/GitVersionModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ object GitVersionModule extends ExternalModule {
case untaggedRegex(hash) =>
if (isDirty) uncommitted()
else s"${hash.take(hashLength)}$snapshotSuffix"
case _ => throw new IllegalStateException(s"Unexpected git describe output: $description")
}
}
)
}

private def uncommittedHash(git: Git, temp: Path, hashLength: Int) = {
val indexCopy = temp / "index"
Try(copy(pwd / ".git" / "index", indexCopy, replaceExisting = true, createFolders = true))
val _ = Try(copy(pwd / ".git" / "index", indexCopy, replaceExisting = true, createFolders = true))

// Use different index file to avoid messing up current git status
val altGit = Git.wrap(
Expand Down

0 comments on commit c0d74bb

Please sign in to comment.