Skip to content

Commit

Permalink
Support Scala 3 - Scala Native (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
lolgab authored Feb 3, 2022
1 parent ef49755 commit d0176ef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
24 changes: 12 additions & 12 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import mill._, scalalib._, scalajslib._, scalanativelib._, publish._
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version_mill0.9:0.1.1`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.1.4`
import de.tobiasroeser.mill.vcs.version.VcsVersion
import $ivy.`com.github.lolgab::mill-mima_mill0.9:0.0.4`
import $ivy.`com.github.lolgab::mill-mima::0.0.9`
import com.github.lolgab.mill.mima._

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

val scala211 = "2.11.12"
val scala212 = "2.12.13"
val scala213 = "2.13.4"
val scala3 = "3.0.0"
val scala30 = "3.0.0"
val scala31 = "3.1.1"

val scalaVersions = scala213 :: scala212 :: scala211 :: scala3 :: dottyCustomVersion.toList
val scala2Versions = scalaVersions.filter(_.startsWith("2."))
val scala2VersionsAndDotty = scala213 :: scala212 :: scala211 :: dottyVersions

val scalaJSVersions = for {
scalaV <- scalaVersions
scalaV <- scala30 :: scala2VersionsAndDotty
scalaJSV <- Seq("0.6.33", "1.5.1")
if scalaV.startsWith("2.") || scalaJSV.startsWith("1.")
} yield (scalaV, scalaJSV)

val scalaNativeVersions = for {
scalaV <- scala2Versions
scalaNativeV <- Seq("0.4.0")
scalaV <- scala31 :: scala2VersionsAndDotty
scalaNativeV <- Seq("0.4.3")
} yield (scalaV, scalaNativeV)

object castor extends Module {
Expand Down Expand Up @@ -50,15 +50,15 @@ object castor extends Module {
millSourcePath / s"src-$platformSegment"
)

def ivyDeps = Agg(ivy"com.lihaoyi::sourcecode::0.2.7")
def ivyDeps = Agg(ivy"com.lihaoyi::sourcecode::0.2.8")
}
trait ActorTestModule extends ScalaModule with TestModule.Utest {
def platformSegment: String
def sources = T.sources(
millSourcePath / "src",
millSourcePath / s"src-$platformSegment"
)
def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.7.10")
def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.7.11")
}

object js extends Cross[ActorJsModule](scalaJSVersions:_*)
Expand All @@ -74,7 +74,7 @@ object castor extends Module {
def scalaVersion = crossScalaVersion
}
}
object jvm extends Cross[ActorJvmModule](scalaVersions:_*)
object jvm extends Cross[ActorJvmModule](scala30 :: scala2VersionsAndDotty: _*)
class ActorJvmModule(crossScalaVersion: String) extends ActorModule(crossScalaVersion) {
def platformSegment = "jvm"
object test extends Tests with ActorTestModule{
Expand Down
11 changes: 6 additions & 5 deletions mill
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# 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.9.7
DEFAULT_MILL_VERSION=0.10.0-35-11bc3c

set -e

if [ -z "$MILL_VERSION" ] ; then
if [ -f ".mill-version" ] ; then
MILL_VERSION="$(head -n 1 .mill-version 2> /dev/null)"
elif [ -f "mill" ] && [ "$BASH_SOURCE" != "mill" ] ; then
elif [ -f "mill" ] && [ "$0" != "mill" ] ; then
MILL_VERSION=$(grep -F "DEFAULT_MILL_VERSION=" "mill" | head -n 1 | cut -d= -f2)
else
MILL_VERSION=$DEFAULT_MILL_VERSION
Expand All @@ -28,13 +28,14 @@ version_remainder="$MILL_VERSION"
MILL_MAJOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"
MILL_MINOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"

if [ ! -x "$MILL_EXEC_PATH" ] ; then
mkdir -p $MILL_DOWNLOAD_PATH
if [ ! -s "$MILL_EXEC_PATH" ] ; then
mkdir -p "$MILL_DOWNLOAD_PATH"
if [ "$MILL_MAJOR_VERSION" -gt 0 ] || [ "$MILL_MINOR_VERSION" -ge 5 ] ; then
ASSEMBLY="-assembly"
fi
DOWNLOAD_FILE=$MILL_EXEC_PATH-tmp-download
MILL_DOWNLOAD_URL="https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION%%-*}/$MILL_VERSION${ASSEMBLY}"
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}"
curl --fail -L -o "$DOWNLOAD_FILE" "$MILL_DOWNLOAD_URL"
chmod +x "$DOWNLOAD_FILE"
mv "$DOWNLOAD_FILE" "$MILL_EXEC_PATH"
Expand Down

0 comments on commit d0176ef

Please sign in to comment.