Skip to content

Commit

Permalink
Bump Mill to 0.11.0 (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Jun 7, 2023
1 parent 028d3fc commit caea494
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 79 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Run tests
run: ./mill -i all __.publishArtifacts __.test
run: ./mill -i "__.{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.12
0.11.0

93 changes: 19 additions & 74 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
import mill._, scalalib._, scalajslib._, scalanativelib._, publish._
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.3.1`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import $ivy.`com.github.lolgab::mill-mima::0.0.23`
import de.tobiasroeser.mill.vcs.version.VcsVersion
import $ivy.`com.github.lolgab::mill-mima::0.0.22`
import com.github.lolgab.mill.mima._
import mill.scalalib.api.Util.isScala3
import mill.scalalib.api.ZincWorkerUtil.isScala3

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

val scalaVersions =
"2.12.17" :: "2.13.8" :: "2.11.12" :: "3.1.3" :: dottyCommunityBuildVersion
val scalaVersions = Seq("2.11.12", "2.12.17", "2.13.8", "3.1.3") ++ dottyCommunityBuildVersion

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

trait MimaCheck extends Mima {
def mimaPreviousVersions = VcsVersion.vcsState().lastTag.toSeq
}

trait FansiModule extends PublishModule with MimaCheck {
trait FansiModule extends PublishModule with Mima with CrossScalaModule with PlatformScalaModule {
def artifactName = "fansi"

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

def crossScalaVersion: String

// Temporary until the next version of Mima gets released with
// https://github.com/lightbend/mima/issues/693 included in the release.
def mimaPreviousArtifacts =
if(isScala3(crossScalaVersion)) Agg.empty[Dep] else super.mimaPreviousArtifacts()
def mimaPreviousVersions = VcsVersion.vcsState().lastTag.toSeq

def pomSettings = PomSettings(
description = artifactName(),
Expand All @@ -39,71 +26,29 @@ trait FansiModule extends PublishModule with MimaCheck {
Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")
)
)
}
trait FansiMainModule extends CrossScalaModule {
def millSourcePath = super.millSourcePath / offset

def ivyDeps = Agg(ivy"com.lihaoyi::sourcecode::0.3.0")
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),
)
)
)
}


trait FansiTestModule extends ScalaModule with TestModule.Utest {
def crossScalaVersion: String
def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.8.1")
def offset: os.RelPath = os.rel
def millSourcePath = super.millSourcePath / os.up

def sources = T.sources(
super.sources()
.++(CrossModuleBase.scalaVersionPaths(crossScalaVersion, s => millSourcePath / s"src-$s" ))
.flatMap(source =>
Seq(
PathRef(source.path / os.up / "test" / source.path.last),
PathRef(source.path / os.up / os.up / "test" / source.path.last),
)
)
.distinct
)
}

object fansi extends Module {
object jvm extends Cross[JvmFansiModule](scalaVersions:_*)
class JvmFansiModule(val crossScalaVersion: String)
extends FansiMainModule with ScalaModule with FansiModule {
object test extends Tests with FansiTestModule{
val crossScalaVersion = JvmFansiModule.this.crossScalaVersion
}
object jvm extends Cross[JvmFansiModule](scalaVersions)
trait JvmFansiModule extends FansiModule with ScalaModule {
object test extends ScalaTests with FansiTestModule
}

object js extends Cross[JsFansiModule](scalaJSVersions:_*)
class JsFansiModule(val crossScalaVersion: String, crossJSVersion: String)
extends FansiMainModule with ScalaJSModule with FansiModule {
def offset = os.up
def scalaJSVersion = crossJSVersion
object test extends Tests with FansiTestModule{
def offset = os.up
val crossScalaVersion = JsFansiModule.this.crossScalaVersion
}
object js extends Cross[JsFansiModule](scalaVersions)
trait JsFansiModule extends FansiModule with ScalaJSModule{
def scalaJSVersion = "1.10.1"
object test extends ScalaJSTests with FansiTestModule
}

object native extends Cross[NativeFansiModule](scalaNativeVersions:_*)
class NativeFansiModule(val crossScalaVersion: String, crossScalaNativeVersion: String)
extends FansiMainModule with ScalaNativeModule with FansiModule {
def offset = os.up

def scalaNativeVersion = crossScalaNativeVersion
object test extends Tests with FansiTestModule{
def offset = os.up
val crossScalaVersion = NativeFansiModule.this.crossScalaVersion
}
object native extends Cross[NativeFansiModule](scalaVersions)
trait NativeFansiModule extends FansiModule with ScalaNativeModule{
def scalaNativeVersion = "0.4.5"
object test extends ScalaNativeTests with FansiTestModule
}
}
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.5

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}" "$@"

0 comments on commit caea494

Please sign in to comment.