Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- uses: coursier/setup-action@v2
with:
jvm: 21
- run: ./mill mill.scalalib.PublishModule/ --sonatypeUri https://s01.oss.sonatype.org/service/local --sonatypeSnapshotUri https://s01.oss.sonatype.org/content/repositories/snapshots
- run: ./mill -i mill.scalalib.SonatypeCentralPublishModule/
env:
MILL_PGP_SECRET_BASE64: ${{ secrets.PUBLISH_SECRET_KEY }}
MILL_PGP_PASSPHRASE: ${{ secrets.PUBLISH_SECRET_KEY_PASSWORD }}
Expand Down
1 change: 0 additions & 1 deletion .mill-version

This file was deleted.

96 changes: 47 additions & 49 deletions build.sc → build.mill
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import $ivy.`com.github.lolgab::mill-mima::0.0.24`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`

import com.github.lolgab.mill.mima._
import de.tobiasroeser.mill.vcs.version._
import mill._
import mill.scalajslib._
import mill.scalalib._
import mill.scalalib.publish._
//| mill-version: 1.1.3
//| mvnDeps:
//| - com.github.lolgab::mill-mima::0.2.1

import com.github.lolgab.mill.mima.*
import mill.*
import mill.api.BuildCtx
import mill.scalajslib.*
import mill.scalalib.*
import mill.scalalib.publish.*
import mill.util.VcsVersion

import java.io.File

Expand All @@ -19,36 +21,34 @@ object DepVersions {
}

object Deps {
def macroParadise = ivy"org.scalamacros:::paradise:2.1.1"
def pprint = ivy"com.lihaoyi::pprint::0.9.0"
def utest = ivy"com.lihaoyi::utest::0.8.9"
def macroParadise = mvn"org.scalamacros:::paradise:2.1.1"
def pprint = mvn"com.lihaoyi::pprint::0.9.0"
def utest = mvn"com.lihaoyi::utest::0.8.9"
}

trait VersionsMima extends Mima {
def mimaPreviousVersions: T[Seq[String]] = T.input {
trait VersionsMima extends Mima with PublishModule {
def mimaPreviousVersions: T[Seq[String]] = Task.Input {
val current = os.proc("git", "describe", "--tags", "--match", "v*")
.call(cwd = T.workspace)
.call(cwd = BuildCtx.workspaceRoot)
.out.trim()
val cutOff = coursier.core.Version("0.4.0")
val cutOff = coursier.version.Version("0.4.0")
os.proc("git", "tag", "-l")
.call(cwd = T.workspace)
.call(cwd = BuildCtx.workspaceRoot)
.out.lines()
.filter(_ != current)
.filter(_.startsWith("v"))
.map(_.stripPrefix("v"))
.map(coursier.core.Version(_))
.map(coursier.version.Version(_))
.filter(_ > cutOff)
.sorted
.map(_.repr)
}
// required if mimaPreviousVersions is empty
def mimaPreviousArtifacts = T {
def mimaPreviousArtifacts = Task {
val versions = mimaPreviousVersions().distinct
mill.api.Result.Success(
Agg.from(
versions.map(version =>
ivy"${pomSettings().organization}:${artifactId()}:$version"
)
versions.map(version =>
mvn"${pomSettings().organization}:${artifactId()}:$version"
)
)
}
Expand All @@ -66,7 +66,7 @@ trait VersionsPublishModule extends PublishModule with VersionsMima {
)
)

def publishVersion = T {
def publishVersion = Task {
val state = VcsVersion.vcsState()
if (state.commitsSinceLastTag > 0) {
val versionOrEmpty = state.lastTag
Expand All @@ -93,14 +93,14 @@ trait VersionsPublishModule extends PublishModule with VersionsMima {
trait Versions extends Cross.Module[String] with ScalaModule with VersionsPublishModule {
def artifactName = "versions"
def scalaVersion = crossValue
def scalacPluginIvyDeps = T {
def scalacPluginMvnDeps = Task {
val sv = scalaVersion()
val scala212Plugins =
if (sv.startsWith("2.12.")) Agg(Deps.macroParadise)
if (sv.startsWith("2.12.")) Seq(Deps.macroParadise)
else Nil
super.scalacPluginIvyDeps() ++ scala212Plugins
super.scalacPluginMvnDeps() ++ scala212Plugins
}
def scalacOptions = T {
def scalacOptions = Task {
val sv = scalaVersion()
val scala213Opts =
if (sv.startsWith("2.13.")) Seq("-Ymacro-annotations")
Expand All @@ -111,16 +111,12 @@ trait Versions extends Cross.Module[String] with ScalaModule with VersionsPublis
"8"
)
}
def sources = T.sources {
super.sources() ++ Seq(PathRef(T.workspace / "versions/shared/src"))
}

def testSources = T.sources {
Seq(PathRef(T.workspace / "versions/shared/test/src"))
def sources = Task {
super.sources() ++ Seq(versions.shared.sources())
}

def compileIvyDeps = Agg(
ivy"io.github.alexarchambault::data-class:0.2.7"
def compileMvnDeps = Seq(
mvn"io.github.alexarchambault::data-class:0.2.7"
)

def mimaBinaryIssueFilters = super.mimaBinaryIssueFilters() ++ Seq(
Expand All @@ -132,13 +128,13 @@ trait Versions extends Cross.Module[String] with ScalaModule with VersionsPublis
trait VersionsJvm extends Versions {

object test extends ScalaTests {
def ivyDeps = super.ivyDeps() ++ Agg(
def mvnDeps = super.mvnDeps() ++ Seq(
Deps.pprint,
Deps.utest
)
def testFramework = "utest.runner.Framework"
def sources = T.sources {
super.sources() ++ testSources()
def sources = Task {
super.sources() ++ Seq(versions.shared.testSources())
}
}
}
Expand All @@ -147,31 +143,33 @@ trait VersionsJs extends Versions with ScalaJSModule {
def scalaJSVersion = DepVersions.scalaJs

object test extends ScalaJSTests {
def ivyDeps = super.ivyDeps() ++ Agg(
def mvnDeps = super.mvnDeps() ++ Seq(
Deps.pprint,
Deps.utest
)
def testFramework = "utest.runner.Framework"
def sources = T.sources {
super.sources() ++ testSources()
def sources = Task {
super.sources() ++ Seq(versions.shared.testSources())
}
}
}

object versions extends Module {
object shared extends Module {
def sources = Task.Source("src")
def testSources = Task.Source("test/src")
}
object jvm extends Cross[VersionsJvm](DepVersions.scala)
object js extends Cross[VersionsJs](DepVersions.scala)
}


def readme = T.sources {
Seq(PathRef(T.workspace / "README.md"))
}
def readme = Task.Source("README.md")

private def mdocScalaVersion = DepVersions.scala213
def mdoc(args: String*) = T.command {
val readme0 = readme().head.path
val dest = T.dest / "README.md"
def mdoc(args: String*) = Task.Command {
val readme0 = readme().path
val dest = Task.dest / "README.md"
val cp = (versions.jvm(mdocScalaVersion).runClasspath() :+ versions.jvm(mdocScalaVersion).jar())
.map(_.path)
.filter(os.exists(_))
Expand All @@ -183,7 +181,7 @@ def mdoc(args: String*) = T.command {
"--classpath", cp.mkString(File.pathSeparator)
)
os.proc(cmd, "--", mdocArgs, args).call(
cwd = T.workspace,
cwd = BuildCtx.workspaceRoot,
stdin = os.Inherit,
stdout = os.Inherit,
stderr = os.Inherit
Expand Down
Loading
Loading