Skip to content

Update to Mill 1.0.0 #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 11, 2025
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
39 changes: 20 additions & 19 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,32 @@ jobs:
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v3
with:
java-version: "8"
java-version: "11"
distribution: "temurin"
- name: Run tests
run: |
echo '-XX:MaxRAMPercentage=95.0' >> .mill-jvm-opts
./mill -i --disable-ticker __.js.__.resolvedIvyDeps
./mill -i --disable-ticker __.js.__.publishArtifacts + __.js.__.compile + __.js.__.fastOpt + __.js.__.test
run: ./mill -i __.js.__.test
test-native:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v3
with:
java-version: "8"
java-version: "11"
distribution: "temurin"
- name: Run tests
run: |
echo '-XX:MaxRAMPercentage=95.0' >> .mill-jvm-opts
./mill -i --disable-ticker __.native.__.resolvedIvyDeps
./mill -i --disable-ticker __.native.__.publishArtifacts + __.native.__.compile + __.native.__.test
run: ./mill -i __.native.__.test
test-jvm:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v3
with:
java-version: "8"
java-version: "11"
distribution: "temurin"
- name: Run tests
run: |
echo '-XX:MaxRAMPercentage=95.0' >> .mill-jvm-opts
./mill -i --disable-ticker __.jvm.__.resolvedIvyDeps
./mill -i --disable-ticker __.jvm.__.publishArtifacts + __.jvm.__.compile + __.jvm.__.test
run: ./mill -i __.jvm.__.test
check-binary-compatibility:
runs-on: ubuntu-22.04
steps:
Expand All @@ -62,18 +53,18 @@ jobs:
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v3
with:
java-version: "8"
java-version: "11"
distribution: "temurin"
- name: Check Binary Compatibility
run: ./mill -i --disable-ticker __.mimaReportBinaryIssues
run: ./mill -i __.mimaReportBinaryIssues

publish-sonatype:
if: github.repository == 'com-lihaoyi/fastparse' && contains(github.ref, 'refs/tags/')
needs:
- test-jvm
- test-js
- test-native
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
env:
MILL_SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MILL_SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
Expand All @@ -90,4 +81,14 @@ jobs:
distribution: 'temurin'
java-version: 11
- name: Publish to Maven Central
run: ./mill -i mill.scalalib.PublishModule/
run: ./mill -i mill.scalalib.SonatypeCentralPublishModule/

- name: Create GitHub Release
id: create_gh_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
1 change: 0 additions & 1 deletion .mill-version

This file was deleted.

104 changes: 52 additions & 52 deletions build.mill
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
//| mill-version: 1.0.0
//| mill-jvm-opts: ["-XX:NonProfiledCodeHeapSize=500m", "-XX:ReservedCodeCacheSize=1000m"]
//| mvnDeps:
//| - com.github.lolgab::mill-mima_mill1:0.2.0
package build
import mill._
import scalalib._
import scalajslib._
import scalanativelib._
import publish._
import mill.api.Result
import mill.modules.Jvm.createJar
import mill.util.Jvm.createJar

import mill.scalalib.api.ZincWorkerUtil.isScala3
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import $ivy.`com.github.lolgab::mill-mima::0.0.23`
import mill.javalib.api.JvmWorkerUtil.isScala3

import de.tobiasroeser.mill.vcs.version.VcsVersion
import mill.util.VcsVersion
import com.github.lolgab.mill.mima._

val scala3 = "3.3.3"
Expand All @@ -30,13 +32,13 @@ object fastparse extends Module{
object js extends Cross[fastparseJsModule](crossVersions)
trait fastparseJsModule extends FastparseModule with ScalaJSModule {
def scalaJSVersion = scalaJS1
private def sourceMapOptions = T.task {
private def sourceMapOptions = Task.Anon {
val vcsState = VcsVersion.vcsState()
vcsState.lastTag.collect {
case tag if vcsState.commitsSinceLastTag == 0 =>
val baseUrl = pomSettings().url.replace("github.com", "raw.githubusercontent.com")
val sourcesOptionName = if(isScala3(crossScalaVersion)) "-scalajs-mapSourceURI" else "-P:scalajs:mapSourceURI"
s"$sourcesOptionName:${T.workspace.toIO.toURI}->$baseUrl/$tag/"
s"$sourcesOptionName:${mill.api.BuildCtx.workspaceRoot.toIO.toURI}->$baseUrl/$tag/"
}
}

Expand All @@ -55,17 +57,17 @@ object fastparse extends Module{
}

trait FastparseModule extends CommonCrossModule with Mima{
def ivyDeps = Agg(
ivy"com.lihaoyi::sourcecode::0.4.0",
ivy"com.lihaoyi::geny::1.1.0"
def mvnDeps = Seq(
mvn"com.lihaoyi::sourcecode::0.4.0",
mvn"com.lihaoyi::geny::1.1.0"
)

def compileIvyDeps =
if(isScala3(crossScalaVersion)) Agg.empty[Dep]
else Agg(ivy"org.scala-lang:scala-reflect:$crossScalaVersion")
def compileMvnDeps =
if(isScala3(crossScalaVersion)) Seq.empty[Dep]
else Seq(mvn"org.scala-lang:scala-reflect:$crossScalaVersion")

def generatedSources = T{
val dir = T.ctx().dest
def generatedSources = Task {
val dir = Task.ctx().dest
val file = dir/"fastparse"/"SequencerGen.scala"
// Only go up to 21, because adding the last element makes it 22
val tuples = (2 to 21).map{ i =>
Expand Down Expand Up @@ -99,14 +101,14 @@ trait FastparseModule extends CommonCrossModule with Mima{

override def scalacOptions =
super.scalacOptions() ++
Agg.when(scalaVersion() != scala3)(
Seq(
"-Xfatal-warnings",
"-Xlint:unused",
"-Wconf:cat=feature:s,cat=deprecation:s"
)
).filter(_ => scalaVersion() != scala3)

def mimaReportBinaryIssues() =
if (this.isInstanceOf[ScalaNativeModule] || this.isInstanceOf[ScalaJSModule]) T.command()
if (this.isInstanceOf[ScalaNativeModule] || this.isInstanceOf[ScalaJSModule]) Task.Command {}
else super.mimaReportBinaryIssues()

def mimaPreviousVersions = Seq(
Expand All @@ -117,7 +119,7 @@ trait FastparseModule extends CommonCrossModule with Mima{
)

def mimaPreviousArtifacts =
if (isScala3(crossScalaVersion)) Agg.empty[Dep]
if (isScala3(crossScalaVersion)) Seq.empty[Dep]
else super.mimaPreviousArtifacts()

def mimaBinaryIssueFilters = super.mimaBinaryIssueFilters() ++ Seq(
Expand Down Expand Up @@ -170,10 +172,10 @@ trait ExampleParseJvmModule extends CommonCrossModule{
def moduleDeps = Seq(fastparse.jvm())

object test extends ScalaTests with CommonTestModule{
def ivyDeps = super.ivyDeps() ++ Agg(
ivy"net.sourceforge.cssparser:cssparser:0.9.18",
) ++ Agg.when(!isScala3(crossScalaVersion))(
ivy"org.scala-lang:scala-compiler:$crossScalaVersion"
def mvnDeps = super.mvnDeps() ++ Seq(
mvn"net.sourceforge.cssparser:cssparser:0.9.18",
) ++ Option.when(!isScala3(crossScalaVersion))(
mvn"org.scala-lang:scala-compiler:$crossScalaVersion"
)
}
}
Expand Down Expand Up @@ -202,24 +204,22 @@ trait CommonCrossModule extends CrossScalaModule with PublishModule with Platfor
)
)

def scalaDocPluginClasspath = T{ Agg[PathRef]() }
def scalaDocPluginClasspath = Task { Seq[PathRef]() }

def sources = T.sources {
super.sources() ++
Agg(PathRef(millSourcePath / "src-2.12+"))
}
def newSources = Task.Sources("src-2.12+")
def sources = Task { super.sources() ++ newSources() }
}

trait CommonTestModule extends ScalaModule with TestModule.Utest{
def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.8.3")
trait CommonTestModule extends ScalaModule with TestModule.Utest {
def mvnDeps = Seq(mvn"com.lihaoyi::utest::0.8.3")

override def scalacOptions =
super.scalacOptions() ++
Agg.when(scalaVersion() != scala3)(
Seq(
"-Xfatal-warnings",
"-Xlint:unused",
"-Wconf:cat=feature:s,cat=deprecation:s"
)
).filter(_ => scalaVersion() != scala3)
}

object perftests extends Module{
Expand All @@ -235,7 +235,7 @@ object perftests extends Module{

object benchScala33 extends PerfTestModule {
def scalaVersion0 = scala3
def sources = T.sources { bench2.sources() }
def sources = Task { bench2.sources() }
def moduleDeps = Seq(
scalaparse.jvm(scala3).test,
pythonparse.jvm(scala3).test,
Expand All @@ -253,30 +253,30 @@ object perftests extends Module{
pythonparse.jvm(scala212).test
)

def ivyDeps = super.ivyDeps() ++ Agg(
ivy"org.json4s::json4s-ast:3.6.0",
ivy"org.json4s::json4s-native:3.6.0",
ivy"org.json4s::json4s-jackson:3.6.0",
ivy"io.circe::circe-parser:0.9.1",
ivy"io.argonaut::argonaut:6.2",
ivy"com.typesafe.play::play-json:2.6.9",
ivy"com.fasterxml.jackson.core:jackson-databind:2.9.4",
ivy"com.lihaoyi::ujson:1.1.0",
ivy"org.scala-lang.modules::scala-parser-combinators:1.1.1",
ivy"org.python:jython:2.7.1b3"
def mvnDeps = super.mvnDeps() ++ Seq(
mvn"org.json4s::json4s-ast:3.6.0",
mvn"org.json4s::json4s-native:3.6.0",
mvn"org.json4s::json4s-jackson:3.6.0",
mvn"io.circe::circe-parser:0.9.1",
mvn"io.argonaut::argonaut:6.2",
mvn"com.typesafe.play::play-json:2.6.9",
mvn"com.fasterxml.jackson.core:jackson-databind:2.9.4",
mvn"com.lihaoyi::ujson:1.1.0",
mvn"org.scala-lang.modules::scala-parser-combinators:1.1.1",
mvn"org.python:jython:2.7.1b3"
)
}

trait PerfTestModule extends ScalaModule with TestModule.Utest{
trait PerfTestModule extends ScalaModule with TestModule.Utest {
def scalaVersion0: String
def scalaVersion = scalaVersion0
def scalacOptions = Seq("-opt:l:method")
def resources = T.sources{
Seq(PathRef(perftests.millSourcePath / "resources")) ++
fastparse.jvm(scalaVersion0).test.resources()
def newResources = Task.Sources(perftests.moduleDir / "resources")
def resources = Task {
newResources() ++ fastparse.jvm(scalaVersion0).test.resources()
}

def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.8.3")
def mvnDeps = Seq(mvn"com.lihaoyi::utest::0.8.3")
}
}

Expand All @@ -290,8 +290,8 @@ object demo extends ScalaJSModule{
fastparse.js(scala213).test,
)

def ivyDeps = Agg(
ivy"org.scala-js::scalajs-dom::0.9.8",
ivy"com.lihaoyi::scalatags::0.9.3"
def mvnDeps = Seq(
mvn"org.scala-js::scalajs-dom::0.9.8",
mvn"com.lihaoyi::scalatags::0.9.3"
)
}
Loading