# HG changeset patch # User Tomas Zeman # Date 1675194464 -3600 # Node ID 4245abe80f4537d5eb089a54decdae89a0cb91d8 # Parent e01a46f45b02edb0cee962ff948c2940bb789aa7 Scala update, support for 2.13. Dependencies / mill update. diff -r e01a46f45b02 -r 4245abe80f45 build.sc --- a/build.sc Tue Jan 31 16:46:11 2023 +0100 +++ b/build.sc Tue Jan 31 20:47:44 2023 +0100 @@ -1,3 +1,14 @@ +/* + * REPL: + * + * ./mill --repl -w + * + * Generate Idea project: + * + * ./mill mill.scalalib.GenIdea/idea + * + */ + import mill._ import mill.api.Loose import mill.define.{Command, Target} @@ -7,13 +18,14 @@ object V { val visjs = "0.3-SNAPSHOT" - val scalaJs = "0.6.28" + val scalaJs = "1.12.0" val scala211 = "2.11.12" - val scala212 = "2.12.9" + val scala212 = "2.12.17" + val scala213 = "2.13.10" } object D { - val scalaJsDom = ivy"org.scala-js::scalajs-dom::0.9.7" + val scalaJsDom = ivy"org.scala-js::scalajs-dom::2.3.0" } class VisJs(val crossScalaVersion: String) extends CrossScalaModule with @@ -43,31 +55,34 @@ "-explaintypes", // Explain type errors in more detail. "-feature", // Emit warning and location for usages of features that should be imported explicitly. "-language:higherKinds", // Allow higher-kinded types - "-language:implicitConversions", // Allow definition of implicit functions called views - "-language:reflectiveCalls", - "-language:postfixOps", "-unchecked", // Enable additional warnings where generated code depends on assumptions. - "-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access. - "-Xfuture", // Turn on future language features. - "-target:jvm-1.8", - "-P:scalajs:sjsDefinedByDefault" + "-Xcheckinit" // Wrap field accessors to throw an exception on uninitialized access. )} override def ivyDeps: Target[Loose.Agg[Dep]] = Agg(D.scalaJsDom) } -object visjs extends Cross[VisJs](V.scala211, V.scala212) +object visjs extends Cross[VisJs](V.scala211, V.scala212, V.scala213) + +def compileAll(): Command[Unit] = T.command{ + visjs(V.scala211).compile() + visjs(V.scala212).compile() + visjs(V.scala213).compile() + () +} def publishLocal(): Command[Unit] = T.command{ visjs(V.scala211).publishLocal()() visjs(V.scala212).publishLocal()() + visjs(V.scala213).publishLocal()() () } def publishM2Local(p: os.Path): Command[Unit] = T.command{ visjs(V.scala211).publishM2Local(p.toString)() visjs(V.scala212).publishM2Local(p.toString)() + visjs(V.scala213).publishM2Local(p.toString)() () } diff -r e01a46f45b02 -r 4245abe80f45 mill --- a/mill Tue Jan 31 16:46:11 2023 +0100 +++ b/mill Tue Jan 31 20:47:44 2023 +0100 @@ -3,14 +3,19 @@ # 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.6.3 set -e +if [ -z "${DEFAULT_MILL_VERSION}" ] ; then + DEFAULT_MILL_VERSION=0.10.10 +fi + 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 ".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 MILL_VERSION=$DEFAULT_MILL_VERSION @@ -28,13 +33,14 @@ 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" @@ -42,7 +48,18 @@ 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}" "$@"