Skip to content

Commit

Permalink
Merge pull request #268 from com-lihaoyi/mill-0.11.0
Browse files Browse the repository at this point in the history
Upgrade to mill-0.11.0
  • Loading branch information
lihaoyi authored Jun 7, 2023
2 parents 8840abc + 6e2954c commit f560f57
Show file tree
Hide file tree
Showing 23 changed files with 65 additions and 93 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Run tests
run: |
./mill -i --disable-ticker __.resolvedIvyDeps
./mill -i --disable-ticker -j 0 all __.publishArtifacts __.test
./mill -i --disable-ticker -j 0 __.publishArtifacts __.test
check-binary-compatibility:
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion .mill-version
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
0.10.10
0.11.0

131 changes: 43 additions & 88 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
import mill._, scalalib._, scalajslib._, scalanativelib._, publish._
import $ivy.`com.lihaoyi::mill-contrib-buildinfo:$MILL_VERSION`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import $ivy.`com.github.lolgab::mill-mima::0.0.23`
import $ivy.`com.lihaoyi::mill-contrib-buildinfo:`
import mill.contrib.buildinfo._
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.3.0`
import de.tobiasroeser.mill.vcs.version.VcsVersion
import $ivy.`com.github.lolgab::mill-mima::0.0.13`

import com.github.lolgab.mill.mima._
import mill.scalalib.api.Util.isScala3
import mill.scalalib.api.ZincWorkerUtil.isScala3

val dottyVersions = sys.props.get("dottyVersion").toList

val scalaVersions = "2.12.17" :: "2.13.10" :: "2.11.12" :: "3.1.3" :: dottyVersions
val scala2Versions = scalaVersions.filter(_.startsWith("2."))

val scalaJSVersions = scalaVersions.map((_, "1.10.1"))
val scalaNativeVersions = scalaVersions.map((_, "0.4.5"))

trait MimaCheck extends Mima {
def mimaPreviousVersions = Seq("0.11.0", "0.11.1", "0.12.0")
}
val scalaVersions = List("2.12.17", "2.13.10", "2.11.12", "3.1.3") ++ dottyVersions

trait ScalatagsPublishModule extends PublishModule with MimaCheck {
def artifactName = "scalatags"
trait ScalatagsPublishModule extends CrossScalaModule with PublishModule with PlatformScalaModule with Mima{
def ivyDeps = Agg(
ivy"com.lihaoyi::sourcecode::0.3.0",
ivy"com.lihaoyi::geny::1.0.0",
)

def compileIvyDeps = T {
super.compileIvyDeps() ++
(
if (isScala3(crossScalaVersion)) Agg()
else Agg(
ivy"org.scala-lang:scala-reflect:${scalaVersion()}"
)
)
}

def publishVersion = VcsVersion.vcsState().format()

def crossScalaVersion: String

def pomSettings = PomSettings(
description = artifactName(),
organization = "com.lihaoyi",
Expand All @@ -40,101 +42,54 @@ trait ScalatagsPublishModule extends PublishModule with MimaCheck {
Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")
)
)
}

trait Common extends CrossScalaModule {
def millSourcePath = super.millSourcePath / offset
def ivyDeps = Agg(
ivy"com.lihaoyi::sourcecode::0.3.0",
ivy"com.lihaoyi::geny::1.0.0",
)
def compileIvyDeps = T { super.compileIvyDeps() ++
(
if (isScala3(crossScalaVersion)) Agg()
else Agg(
ivy"org.scala-lang:scala-reflect:${scalaVersion()}"
)
)
}
def offset: os.RelPath = os.rel
def sources = T.sources(
super.sources()
.flatMap(source =>
Seq(
PathRef(source.path / os.up / source.path.last),
PathRef(source.path / os.up / os.up / source.path.last),
)
)
)
def mimaPreviousVersions = Seq("0.11.0", "0.11.1", "0.12.0")
}

trait CommonTestModule extends ScalaModule with TestModule.Utest with BuildInfo {
def millSourcePath = super.millSourcePath / os.up
def crossScalaVersion: String
val scalaXmlVersion = if(crossScalaVersion.startsWith("2.11.")) "1.3.0" else "2.1.0"
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.1",
ivy"org.scala-lang.modules::scala-xml:$scalaXmlVersion"
)
def offset: os.RelPath = os.rel
def sources = T.sources(
super.sources()
.flatMap(source =>
Seq(
PathRef(source.path / os.up / "test" / source.path.last),
PathRef(source.path / os.up / os.up / "test" / source.path.last),
)
)
.distinct
ivy"org.scala-lang.modules::scala-xml:${if(scalaVersion().startsWith("2.11.")) "1.3.0" else "2.1.0"}"
)
override def buildInfoPackageName = Some("scalatags")
override def buildInfoMembers = Map(
"scalaMajorVersion" -> crossScalaVersion.split('.').head

override def buildInfoPackageName = "scalatags"
override def buildInfoMembers = Seq(
BuildInfo.Value("scalaMajorVersion", scalaVersion().split('.').head)
)
}


object scalatags extends Module {
object jvm extends Cross[JvmScalatagsModule](scalaVersions:_*)
class JvmScalatagsModule(val crossScalaVersion: String)
extends Common with ScalaModule with ScalatagsPublishModule {
object jvm extends Cross[JvmScalatagsModule](scalaVersions)
trait JvmScalatagsModule
extends ScalatagsPublishModule {

object test extends Tests with CommonTestModule{
def crossScalaVersion = JvmScalatagsModule.this.crossScalaVersion
}
object test extends ScalaTests with CommonTestModule
}

object js extends Cross[JSScalatagsModule](scalaJSVersions:_*)
class JSScalatagsModule(val crossScalaVersion: String, crossJSVersion: String)
extends Common with ScalaJSModule with ScalatagsPublishModule {
def scalaJSVersion = crossJSVersion
object js extends Cross[JSScalatagsModule](scalaVersions)
trait JSScalatagsModule
extends ScalaJSModule with ScalatagsPublishModule {
def scalaJSVersion = "1.10.1"
def ivyDeps = super.ivyDeps() ++ Agg(ivy"org.scala-js::scalajs-dom::2.3.0")
def offset = os.up
object test extends Tests with CommonTestModule{
def offset = os.up
def crossScalaVersion = JSScalatagsModule.this.crossScalaVersion

object test extends ScalaJSTests with CommonTestModule{
def ivyDeps = super.ivyDeps() ++ Agg(ivy"org.scala-js::scalajs-env-jsdom-nodejs:1.1.0").map(_.withDottyCompat(crossScalaVersion))
def jsEnvConfig = mill.scalajslib.api.JsEnvConfig.JsDom()
}
}

object native extends Cross[NativeScalatagsModule](scalaNativeVersions:_*)
class NativeScalatagsModule(val crossScalaVersion: String, crossScalaNativeVersion: String)
extends Common with ScalaNativeModule with ScalatagsPublishModule {
def scalaNativeVersion = crossScalaNativeVersion
object native extends Cross[NativeScalatagsModule](scalaVersions)
trait NativeScalatagsModule extends ScalaNativeModule with ScalatagsPublishModule {
def scalaNativeVersion = "0.4.5"
// No released Scala Native Scala 3 version yet
def mimaPreviousArtifacts = if(isScala3(crossScalaVersion)) Agg.empty[Dep] else super.mimaPreviousArtifacts()
def offset = os.up
object test extends Tests with CommonTestModule{
def offset = os.up
def crossScalaVersion = NativeScalatagsModule.this.crossScalaVersion
}
object test extends ScalaNativeTests with CommonTestModule
}
}

object example extends ScalaJSModule{
val (scalaV, scalaJSV) = scalaJSVersions.head
def scalaVersion = scalaV
def scalaJSVersion = scalaJSV
def moduleDeps = Seq(scalatags.js(scalaV, scalaJSV))
def scalaVersion = scalaVersions.head
def scalaJSVersion = "1.10.1"
def moduleDeps = Seq(scalatags.js(scalaVersions.head))
}
22 changes: 19 additions & 3 deletions mill
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
# This is a wrapper script, that automatically download mill from GitHub release pages
# You can give the required mill version with MILL_VERSION env variable
# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
DEFAULT_MILL_VERSION=0.10.4

set -e

if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
DEFAULT_MILL_VERSION=0.11.0
fi

if [ -z "$MILL_VERSION" ] ; then
if [ -f ".mill-version" ] ; then
MILL_VERSION="$(head -n 1 .mill-version 2> /dev/null)"
elif [ -f ".config/mill-version" ] ; then
MILL_VERSION="$(head -n 1 .config/mill-version 2> /dev/null)"
elif [ -f "mill" ] && [ "$0" != "mill" ] ; then
MILL_VERSION=$(grep -F "DEFAULT_MILL_VERSION=" "mill" | head -n 1 | cut -d= -f2)
else
Expand All @@ -35,15 +40,26 @@ if [ ! -s "$MILL_EXEC_PATH" ] ; then
fi
DOWNLOAD_FILE=$MILL_EXEC_PATH-tmp-download
MILL_VERSION_TAG=$(echo $MILL_VERSION | sed -E 's/([^-]+)(-M[0-9]+)?(-.*)?/\1\2/')
MILL_DOWNLOAD_URL="https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION_TAG}/$MILL_VERSION${ASSEMBLY}"
MILL_DOWNLOAD_URL="https://repo1.maven.org/maven2/com/lihaoyi/mill-dist/$MILL_VERSION/mill-dist-$MILL_VERSION.jar"
curl --fail -L -o "$DOWNLOAD_FILE" "$MILL_DOWNLOAD_URL"
chmod +x "$DOWNLOAD_FILE"
mv "$DOWNLOAD_FILE" "$MILL_EXEC_PATH"
unset DOWNLOAD_FILE
unset MILL_DOWNLOAD_URL
fi

if [ -z "$MILL_MAIN_CLI" ] ; then
MILL_MAIN_CLI="${0}"
fi

MILL_FIRST_ARG=""
if [ "$1" = "--bsp" ] || [ "$1" = "-i" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then
# Need to preserve the first position of those listed options
MILL_FIRST_ARG=$1
shift
fi

unset MILL_DOWNLOAD_PATH
unset MILL_VERSION

exec $MILL_EXEC_PATH "$@"
exec $MILL_EXEC_PATH $MILL_FIRST_ARG -D "mill.main.cli=${MILL_MAIN_CLI}" "$@"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f560f57

Please sign in to comment.