From 155beb280823d9efad65dd20dedc8a145faebbcd Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sat, 28 Sep 2024 08:11:35 +0100 Subject: Updatet Mill to 0.11.12 --- CHANGES.md | 4 ++++ build.sc | 19 ++++++++++--------- mill | 31 +++++++++++++++++++++++++------ server/test/src/TestData.scala | 6 ++++-- 4 files changed, 43 insertions(+), 17 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1843d7f..1476a63 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # What's new? +## Release 1.4.2 - 2024-10-?? + + - Updated mill (development). + ## Release 1.4.1 - 2024-08-09 - Updated dependencies. diff --git a/build.sc b/build.sc index 7c53ac1..997a960 100644 --- a/build.sc +++ b/build.sc @@ -33,14 +33,12 @@ object server extends ScalaModule with ScalafmtModule with BuildInfo { ) val name = "spacebeans" - def buildInfoMembers: T[Map[String, String]] = - T { - Map( - "name" -> name, - "version" -> VcsVersion.vcsState().format() - ) - } - def buildInfoPackageName = Some("net.usebox.gemini.server") + def buildInfoMembers = + Seq( + BuildInfo.Value("name", name), + BuildInfo.Value("version", VcsVersion.vcsState().format()) + ) + def buildInfoPackageName = "net.usebox.gemini.server" def assembly = T { @@ -50,7 +48,10 @@ object server extends ScalaModule with ScalafmtModule with BuildInfo { PathRef(spacePath) } - object test extends Tests with TestModule.ScalaTest with ScalafmtModule { + object test extends ScalaTests with ScalafmtModule with TestModule.ScalaTest { def ivyDeps = Agg(ivy"org.scalatest::scalatest:3.2.19") + + def forkEnv = super.forkEnv() ++ + Map("MILL_TEST_RESOURCE_FOLDER" -> resources().map(_.path).mkString(";")) } } diff --git a/mill b/mill index 21625f6..d03a045 100755 --- a/mill +++ b/mill @@ -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.10.12 set -e +if [ -z "${DEFAULT_MILL_VERSION}" ] ; then + DEFAULT_MILL_VERSION=0.11.12 +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 @@ 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://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" @@ -42,7 +48,20 @@ if [ ! -x "$MILL_EXEC_PATH" ] ; then unset MILL_DOWNLOAD_URL fi +if [ -z "$MILL_MAIN_CLI" ] ; then + MILL_MAIN_CLI="${0}" +fi + +MILL_FIRST_ARG="" + + # first arg is a long flag for "--interactive" or starts with "-i" +if [ "$1" = "--bsp" ] || [ "${1#"-i"}" != "$1" ] || [ "$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}" "$@" diff --git a/server/test/src/TestData.scala b/server/test/src/TestData.scala index 64ac43b..133c679 100644 --- a/server/test/src/TestData.scala +++ b/server/test/src/TestData.scala @@ -8,6 +8,8 @@ object TestData { val port = 1965 val portStr = port.toString() + var resPath = sys.env("MILL_TEST_RESOURCE_FOLDER") + val conf = ServiceConf( address = "127.0.0.1", port = port, @@ -16,7 +18,7 @@ object TestData { virtualHosts = List( VirtualHost( host = host, - root = getClass.getResource("/").getPath(), + root = resPath, keyStore = KeyStore( path = "/tmp/unused.jks", alias = "localhost", @@ -98,7 +100,7 @@ object TestData { .copy( userDirectories = true, userDirectoryPath = Some( - getClass.getResource("/").getPath() + "{user}/public_gemini/" + resPath + "/{user}/public_gemini/" ) ) ) -- cgit v1.2.3