Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: debs-sifive/acyclic
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: package-cycles
Choose a base ref
...
head repository: com-lihaoyi/acyclic
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 17 commits
  • 9 files changed
  • 4 contributors

Commits on Jan 13, 2025

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    23da105 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    ff0114b View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f129b34 View commit details
  4. Prepare release 0.3.16 (com-lihaoyi#147)

    Pull request: com-lihaoyi#147
    lefou authored Jan 13, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f5df00d View commit details

Commits on Feb 4, 2025

  1. Copy the full SHA
    1c57c32 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1599290 View commit details
  3. 0.3.17

    lihaoyi committed Feb 4, 2025
    Copy the full SHA
    7fd5f12 View commit details
  4. tweak build

    lihaoyi committed Feb 4, 2025
    Copy the full SHA
    c99f93e View commit details
  5. Update actions.yml

    lihaoyi authored Feb 4, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    9eb1b50 View commit details

Commits on Feb 5, 2025

  1. Update build.mill

    lihaoyi authored Feb 5, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    3a6730c View commit details
  2. Update actions.yml

    lihaoyi authored Feb 5, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    138d476 View commit details

Commits on Mar 8, 2025

  1. Rollback Mill 0.12.x bump (com-lihaoyi#157)

    This reverts some recent commits to the `main` branch, after which the
    test suite no longer worked.
    
    Update the `mill` bootstrap script and tweak some CI settings.
    
    As follow up PRs, we need to
    * fix test suite to work with Java 11+
    * add support for newer Scala versions
    * bump Mill to 0.12
    
    Pull request: com-lihaoyi#157
    lefou authored Mar 8, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    bbabdb1 View commit details
  2. Fix Java classpath retrieval in tests (com-lihaoyi#158)

    The classpath retieval used some internal knowledge and cast the
    classloader to `URLClassLoader`. This no longer works in newer Java
    version (Java 11+), hence another method to retrieve the currently used
    classpath was implemented based on the `java.class.path` system
    property.
    
    Also restore the CI publish setup for Mill 0.11.
    
    Pull request: com-lihaoyi#158
    lefou authored Mar 8, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    66db9d6 View commit details
  3. Base test resource recovery on sys env variables (com-lihaoyi#159)

    Instead of assuming some paths, we refer to env variables as resources
    roots:
    
    * `MILL_WORKSPACE_ROOT`
    * `TEST_ACYCLIC_TEST_RESOURCES`
    
    Pull request: com-lihaoyi#159
    lefou authored Mar 8, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f07b956 View commit details
  4. Upgrade Mill from 0.11.13 to 0.12.8 (com-lihaoyi#160)

    Switched to Mill native launcher and removed Java setup from CI.
    
    Pull request: com-lihaoyi#160
    lefou authored Mar 8, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    3cca505 View commit details
  5. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0b58270 View commit details
  6. Prepared release 0.2.18

    lefou committed Mar 8, 2025

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    lefou Tobias Roeser
    Copy the full SHA
    a98ac5f View commit details
Showing with 335 additions and 73 deletions.
  1. +6 −27 .github/workflows/actions.yml
  2. +1 −0 .mill-jvm-version
  3. +1 −1 .mill-version
  4. +5 −5 acyclic/test/src-2/acyclic/TestUtils.scala
  5. +5 −5 acyclic/test/src-3/acyclic/TestUtils.scala
  6. +31 −0 acyclic/test/src/acyclic/BaseTestUtils.scala
  7. +28 −5 build.sc
  8. +245 −29 mill
  9. +13 −1 readme.adoc
33 changes: 6 additions & 27 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -11,43 +11,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 8
- name: Run tests
run: ./mill -i -j 0 __.publishArtifacts + __.test
run: ./mill __.publishArtifacts + __.test

publish-sonatype:
if: github.repository == 'com-lihaoyi/acyclic' && contains(github.ref, 'refs/tags/')
needs: test
runs-on: ubuntu-latest
env:
SONATYPE_PGP_PRIVATE_KEY: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY }}
SONATYPE_PGP_PRIVATE_KEY_PASSWORD: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
MILL_SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MILL_SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
MILL_PGP_SECRET_BASE64: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY }}
MILL_PGP_PASSPHRASE: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY_PASSWORD }}
LANG: "en_US.UTF-8"
LC_MESSAGES: "en_US.UTF-8"
LC_ALL: "en_US.UTF-8"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 8
- name: Publish to Maven Central
run: |
if [[ $(git tag --points-at HEAD) != '' ]]; then
echo $SONATYPE_PGP_PRIVATE_KEY | base64 --decode > gpg_key
gpg --import --no-tty --batch --yes gpg_key
rm gpg_key
./mill -i mill.scalalib.PublishModule/publishAll \
--sonatypeCreds $SONATYPE_USER:$SONATYPE_PASSWORD \
--gpgArgs --passphrase=$SONATYPE_PGP_PRIVATE_KEY_PASSWORD,--no-tty,--pinentry-mode,loopback,--batch,--yes,-a,-b \
--publishArtifacts __.publishArtifacts \
--readTimeout 600000 \
--awaitTimeout 600000 \
--release true \
--signed true
fi
run: ./mill -i mill.scalalib.PublishModule/
1 change: 1 addition & 0 deletions .mill-jvm-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
temurin:11.0.25
2 changes: 1 addition & 1 deletion .mill-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.12
0.12.8-native
10 changes: 5 additions & 5 deletions acyclic/test/src-2/acyclic/TestUtils.scala
Original file line number Diff line number Diff line change
@@ -24,18 +24,18 @@ object TestUtils extends BaseTestUtils {
*/
def make(
path: String,
extraIncludes: Seq[String] = Seq("acyclic/src/acyclic/package.scala"),
extraIncludes: Seq[String] =
Seq(workspaceRoot + "/acyclic/src/acyclic/package.scala"),
force: Boolean = false,
warn: Boolean = false,
collectInfo: Boolean = true
): Seq[(String, String)] = {
val src = "acyclic/test/resources/" + path
val src = testResources + "/" + path
val sources = getFilePaths(src) ++ extraIncludes

val vd = new VirtualDirectory("(memory)", None)
lazy val settings = new Settings
val loader = getClass.getClassLoader.asInstanceOf[URLClassLoader]
val entries = loader.getURLs map (_.getPath)
val entries = getJavaClasspathEntries()
settings.outputDirs.setSingleOutput(vd)

// annoyingly, the Scala library is not in our classpath, so we have to add it manually
@@ -96,7 +96,7 @@ object TestUtils extends BaseTestUtils {
.toSet

def expand(v: Value) = v match {
case Value.File(filePath, pkg) => Value.File("acyclic/test/resources/" + path + "/" + filePath, Nil)
case Value.File(filePath, pkg) => Value.File(testResources + "/" + path + "/" + filePath, Nil)
case v => v
}

10 changes: 5 additions & 5 deletions acyclic/test/src-3/acyclic/TestUtils.scala
Original file line number Diff line number Diff line change
@@ -25,16 +25,16 @@ object TestUtils extends BaseTestUtils {
*/
def make(
path: String,
extraIncludes: Seq[String] = Seq("acyclic/src/acyclic/package.scala"),
extraIncludes: Seq[String] =
Seq(workspaceRoot + "/acyclic/src/acyclic/package.scala"),
force: Boolean = false,
warn: Boolean = false,
collectInfo: Boolean = true
): Seq[(String, String)] = {
val src = "acyclic/test/resources/" + path
val src = testResources + "/" + path
val sources = (getFilePaths(src) ++ extraIncludes).map(f => PlainFile(Path(Paths.get(f))))
val vd = new VirtualDirectory("(memory)", None)
val loader = getClass.getClassLoader.asInstanceOf[URLClassLoader]
val entries = loader.getURLs map (_.getPath)
val entries = getJavaClasspathEntries()

val scalaSettings = new ScalaSettings {}
val settingsState1 = scalaSettings.outputDir.updateIn(scalaSettings.defaultState, vd)
@@ -108,7 +108,7 @@ object TestUtils extends BaseTestUtils {
.toSet

def expand(v: Value) = v match {
case Value.File(filePath, pkg) => Value.File("acyclic/test/resources/" + path + "/" + filePath, Nil)
case Value.File(filePath, pkg) => Value.File(testResources + "/" + path + "/" + filePath, Nil)
case v => v
}

31 changes: 31 additions & 0 deletions acyclic/test/src/acyclic/BaseTestUtils.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package acyclic

import acyclic.plugin.Value

import java.util.jar.JarFile
import scala.collection.SortedSet

abstract class BaseTestUtils {
val srcDirName: String

val workspaceRoot = sys.env("MILL_WORKSPACE_ROOT")
val testResources = sys.env("TEST_ACYCLIC_TEST_RESOURCES")
/**
* Attempts to compile a resource folder as a compilation run, in order
* to test whether it succeeds or fails correctly.
@@ -27,4 +31,31 @@ abstract class BaseTestUtils {
if (f.isDirectory) f.list.toList.flatMap(x => getFilePaths(src + "/" + x))
else List(src)
}

def getJavaClasspathEntries(): Seq[String] = {
System.getProperty("java.class.path")
.split(java.io.File.pathSeparator)
.toIndexedSeq
.flatMap { f =>
// If an (empty) classpath pathing jar is used, we extract the `Class-Path` manifest entry
// and those entries to the classpath
val extra =
if (!f.toLowerCase().endsWith(".jar")) Seq()
else
for {
manifest <- Option(new JarFile(f).getManifest()).toSeq
mainAttr <- Option(manifest.getMainAttributes()).toSeq
cp <- Option(mainAttr.getValue("Class-Path")).toSeq
entry <- cp.split(" ")
if entry.nonEmpty
} yield entry match {
case url if url.startsWith("file:///") =>
url.substring("file://".length)
case url if url.startsWith("file:/") =>
url.substring("file:".length)
case s => s
}
Seq(f) ++ extra
}
}
}
33 changes: 28 additions & 5 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.1`

import mill._, scalalib._, publish._
import de.tobiasroeser.mill.vcs.version.VcsVersion

object Deps {
val scala211 = Seq("2.11.12")
val scala212 = 9.to(20).map("2.12." + _)
val scala213 = 1.to(15).map("2.13." + _)
val scala213 = 3.to(16).map("2.13." + _)
val scala33 = 0.to(3).map("3.3." + _)
val scala34 = 0.to(3).map("3.4." + _)
val scala35 = 0.to(1).map("3.5." + _)
val scala35 = 0.to(2).map("3.5." + _)
val scala36 = 0.to(4).map("3.6." + _)

val unreleased = scala33 ++ scala34 ++ scala35
val unreleased = scala33 ++ scala34 ++ scala35 ++ scala36

def scalaCompiler(scalaVersion: String) =
if (scalaVersion.startsWith("3.")) ivy"org.scala-lang::scala3-compiler:$scalaVersion"
@@ -26,7 +27,8 @@ val crosses =
Deps.scala213 ++
Deps.scala33 ++
Deps.scala34 ++
Deps.scala35
Deps.scala35 ++
Deps.scala36

object acyclic extends Cross[AcyclicModule](crosses)
trait AcyclicModule extends CrossScalaModule with PublishModule {
@@ -47,6 +49,23 @@ trait AcyclicModule extends CrossScalaModule with PublishModule {
override def compileIvyDeps =
Agg(Deps.scalaCompiler(crossScalaVersion))

override def javacOptions = Seq(
"-source",
"8",
"-target",
"8",
"-encoding",
"UTF-8"
)

override def scalacOptions =
if (crossScalaVersion.startsWith("2.")) Seq(
"-target:jvm-1.8"
)
else Seq(
"-java-output-version",
"8"
)

object test extends ScalaTests with TestModule.Utest {
override def sources = T.sources(super.sources() :+ PathRef(millSourcePath / "resources"))
@@ -55,5 +74,9 @@ trait AcyclicModule extends CrossScalaModule with PublishModule {
Deps.scalaCompiler(crossScalaVersion)
)
override def scalacPluginIvyDeps = Agg.empty[Dep]
override def forkEnv = super.forkEnv() ++ Map(
"MILL_WORKSPACE_ROOT" -> T.workspace.toString,
"TEST_ACYCLIC_TEST_RESOURCES" -> (millSourcePath / "resources").toString
)
}
}
274 changes: 245 additions & 29 deletions mill
Original file line number Diff line number Diff line change
@@ -1,49 +1,265 @@
#!/usr/bin/env sh

# 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
# You can give the required mill version with --mill-version parameter
# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
DEFAULT_MILL_VERSION=0.10.5
#
# Original Project page: https://github.com/lefou/millw
# Script Version: 0.4.12
#
# If you want to improve this script, please also contribute your changes back!
#
# Licensed under the Apache License, Version 2.0

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" ] && [ "$0" != "mill" ] ; then
MILL_VERSION=$(grep -F "DEFAULT_MILL_VERSION=" "mill" | head -n 1 | cut -d= -f2)
if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
DEFAULT_MILL_VERSION="0.11.4"
fi


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


MILL_REPO_URL="https://github.com/com-lihaoyi/mill"

if [ -z "${CURL_CMD}" ] ; then
CURL_CMD=curl
fi

# Explicit commandline argument takes precedence over all other methods
if [ "$1" = "--mill-version" ] ; then
shift
if [ "x$1" != "x" ] ; then
MILL_VERSION="$1"
shift
else
MILL_VERSION=$DEFAULT_MILL_VERSION
echo "You specified --mill-version without a version." 1>&2
echo "Please provide a version that matches one provided on" 1>&2
echo "${MILL_REPO_URL}/releases" 1>&2
false
fi
fi

if [ "x${XDG_CACHE_HOME}" != "x" ] ; then
MILL_DOWNLOAD_PATH="${XDG_CACHE_HOME}/mill/download"
else
MILL_DOWNLOAD_PATH="${HOME}/.cache/mill/download"
# Please note, that if a MILL_VERSION is already set in the environment,
# We reuse it's value and skip searching for a value.

# If not already set, read .mill-version file
if [ -z "${MILL_VERSION}" ] ; then
if [ -f ".mill-version" ] ; then
MILL_VERSION="$(tr '\r' '\n' < .mill-version | head -n 1 2> /dev/null)"
elif [ -f ".config/mill-version" ] ; then
MILL_VERSION="$(tr '\r' '\n' < .config/mill-version | head -n 1 2> /dev/null)"
fi
fi
MILL_EXEC_PATH="${MILL_DOWNLOAD_PATH}/${MILL_VERSION}"

version_remainder="$MILL_VERSION"
MILL_MAJOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"
MILL_MINOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"
MILL_USER_CACHE_DIR="${XDG_CACHE_HOME:-${HOME}/.cache}/mill"

if [ -z "${MILL_DOWNLOAD_PATH}" ] ; then
MILL_DOWNLOAD_PATH="${MILL_USER_CACHE_DIR}/download"
fi

# If not already set, try to fetch newest from Github
if [ -z "${MILL_VERSION}" ] ; then
# TODO: try to load latest version from release page
echo "No mill version specified." 1>&2
echo "You should provide a version via '.mill-version' file or --mill-version option." 1>&2

mkdir -p "${MILL_DOWNLOAD_PATH}"
LANG=C touch -d '1 hour ago' "${MILL_DOWNLOAD_PATH}/.expire_latest" 2>/dev/null || (
# we might be on OSX or BSD which don't have -d option for touch
# but probably a -A [-][[hh]mm]SS
touch "${MILL_DOWNLOAD_PATH}/.expire_latest"; touch -A -010000 "${MILL_DOWNLOAD_PATH}/.expire_latest"
) || (
# in case we still failed, we retry the first touch command with the intention
# to show the (previously suppressed) error message
LANG=C touch -d '1 hour ago' "${MILL_DOWNLOAD_PATH}/.expire_latest"
)

# POSIX shell variant of bash's -nt operator, see https://unix.stackexchange.com/a/449744/6993
# if [ "${MILL_DOWNLOAD_PATH}/.latest" -nt "${MILL_DOWNLOAD_PATH}/.expire_latest" ] ; then
if [ -n "$(find -L "${MILL_DOWNLOAD_PATH}/.latest" -prune -newer "${MILL_DOWNLOAD_PATH}/.expire_latest")" ]; then
# we know a current latest version
MILL_VERSION=$(head -n 1 "${MILL_DOWNLOAD_PATH}"/.latest 2> /dev/null)
fi

if [ -z "${MILL_VERSION}" ] ; then
# we don't know a current latest version
echo "Retrieving latest mill version ..." 1>&2
LANG=C ${CURL_CMD} -s -i -f -I ${MILL_REPO_URL}/releases/latest 2> /dev/null | grep --ignore-case Location: | sed s'/^.*tag\///' | tr -d '\r\n' > "${MILL_DOWNLOAD_PATH}/.latest"
MILL_VERSION=$(head -n 1 "${MILL_DOWNLOAD_PATH}"/.latest 2> /dev/null)
fi

if [ -z "${MILL_VERSION}" ] ; then
# Last resort
MILL_VERSION="${DEFAULT_MILL_VERSION}"
echo "Falling back to hardcoded mill version ${MILL_VERSION}" 1>&2
else
echo "Using mill version ${MILL_VERSION}" 1>&2
fi
fi

MILL_NATIVE_SUFFIX="-native"
FULL_MILL_VERSION=$MILL_VERSION
ARTIFACT_SUFFIX=""
case "$MILL_VERSION" in
*"$MILL_NATIVE_SUFFIX")
MILL_VERSION=${MILL_VERSION%"$MILL_NATIVE_SUFFIX"}
if [ "$(expr substr $(uname -s) 1 5 2>/dev/null)" = "Linux" ]; then
if [ "$(uname -m)" = "aarch64" ]; then
ARTIFACT_SUFFIX="-native-linux-aarch64"
else
ARTIFACT_SUFFIX="-native-linux-amd64"
fi
elif [ "$(uname)" = "Darwin" ]; then
if [ "$(uname -m)" = "arm64" ]; then
ARTIFACT_SUFFIX="-native-mac-aarch64"
else
ARTIFACT_SUFFIX="-native-mac-amd64"
fi
else
echo "This native mill launcher supports only Linux and macOS." 1>&2
exit 1
fi
esac

MILL="${MILL_DOWNLOAD_PATH}/${FULL_MILL_VERSION}"

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"
try_to_use_system_mill() {
if [ "$(uname)" != "Linux" ]; then
return 0
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}"
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

MILL_IN_PATH="$(command -v mill || true)"

if [ -z "${MILL_IN_PATH}" ]; then
return 0
fi

SYSTEM_MILL_FIRST_TWO_BYTES=$(head --bytes=2 "${MILL_IN_PATH}")
if [ "${SYSTEM_MILL_FIRST_TWO_BYTES}" = "#!" ]; then
# MILL_IN_PATH is (very likely) a shell script and not the mill
# executable, ignore it.
return 0
fi

SYSTEM_MILL_PATH=$(readlink -e "${MILL_IN_PATH}")
SYSTEM_MILL_SIZE=$(stat --format=%s "${SYSTEM_MILL_PATH}")
SYSTEM_MILL_MTIME=$(stat --format=%y "${SYSTEM_MILL_PATH}")

if [ ! -d "${MILL_USER_CACHE_DIR}" ]; then
mkdir -p "${MILL_USER_CACHE_DIR}"
fi

SYSTEM_MILL_INFO_FILE="${MILL_USER_CACHE_DIR}/system-mill-info"
if [ -f "${SYSTEM_MILL_INFO_FILE}" ]; then
parseSystemMillInfo() {
LINE_NUMBER="${1}"
# Select the line number of the SYSTEM_MILL_INFO_FILE, cut the
# variable definition in that line in two halves and return
# the value, and finally remove the quotes.
sed -n "${LINE_NUMBER}p" "${SYSTEM_MILL_INFO_FILE}" |\
cut -d= -f2 |\
sed 's/"\(.*\)"/\1/'
}

CACHED_SYSTEM_MILL_PATH=$(parseSystemMillInfo 1)
CACHED_SYSTEM_MILL_VERSION=$(parseSystemMillInfo 2)
CACHED_SYSTEM_MILL_SIZE=$(parseSystemMillInfo 3)
CACHED_SYSTEM_MILL_MTIME=$(parseSystemMillInfo 4)

if [ "${SYSTEM_MILL_PATH}" = "${CACHED_SYSTEM_MILL_PATH}" ] \
&& [ "${SYSTEM_MILL_SIZE}" = "${CACHED_SYSTEM_MILL_SIZE}" ] \
&& [ "${SYSTEM_MILL_MTIME}" = "${CACHED_SYSTEM_MILL_MTIME}" ]; then
if [ "${CACHED_SYSTEM_MILL_VERSION}" = "${MILL_VERSION}" ]; then
MILL="${SYSTEM_MILL_PATH}"
return 0
else
return 0
fi
fi
fi

SYSTEM_MILL_VERSION=$(${SYSTEM_MILL_PATH} --version | head -n1 | sed -n 's/^Mill.*version \(.*\)/\1/p')

cat <<EOF > "${SYSTEM_MILL_INFO_FILE}"
CACHED_SYSTEM_MILL_PATH="${SYSTEM_MILL_PATH}"
CACHED_SYSTEM_MILL_VERSION="${SYSTEM_MILL_VERSION}"
CACHED_SYSTEM_MILL_SIZE="${SYSTEM_MILL_SIZE}"
CACHED_SYSTEM_MILL_MTIME="${SYSTEM_MILL_MTIME}"
EOF

if [ "${SYSTEM_MILL_VERSION}" = "${MILL_VERSION}" ]; then
MILL="${SYSTEM_MILL_PATH}"
fi
}
try_to_use_system_mill

# If not already downloaded, download it
if [ ! -s "${MILL}" ] ; then

# support old non-XDG download dir
MILL_OLD_DOWNLOAD_PATH="${HOME}/.mill/download"
OLD_MILL="${MILL_OLD_DOWNLOAD_PATH}/${MILL_VERSION}"
if [ -x "${OLD_MILL}" ] ; then
MILL="${OLD_MILL}"
else
case $MILL_VERSION in
0.0.* | 0.1.* | 0.2.* | 0.3.* | 0.4.* )
DOWNLOAD_SUFFIX=""
DOWNLOAD_FROM_MAVEN=0
;;
0.5.* | 0.6.* | 0.7.* | 0.8.* | 0.9.* | 0.10.* | 0.11.0-M* )
DOWNLOAD_SUFFIX="-assembly"
DOWNLOAD_FROM_MAVEN=0
;;
*)
DOWNLOAD_SUFFIX="-assembly"
DOWNLOAD_FROM_MAVEN=1
;;
esac

DOWNLOAD_FILE=$(mktemp mill.XXXXXX)

if [ "$DOWNLOAD_FROM_MAVEN" = "1" ] ; then
DOWNLOAD_URL="https://repo1.maven.org/maven2/com/lihaoyi/mill-dist${ARTIFACT_SUFFIX}/${MILL_VERSION}/mill-dist${ARTIFACT_SUFFIX}-${MILL_VERSION}.jar"
else
MILL_VERSION_TAG=$(echo "$MILL_VERSION" | sed -E 's/([^-]+)(-M[0-9]+)?(-.*)?/\1\2/')
DOWNLOAD_URL="${GITHUB_RELEASE_CDN}${MILL_REPO_URL}/releases/download/${MILL_VERSION_TAG}/${MILL_VERSION}${DOWNLOAD_SUFFIX}"
unset MILL_VERSION_TAG
fi

# TODO: handle command not found
echo "Downloading mill ${MILL_VERSION} from ${DOWNLOAD_URL} ..." 1>&2
${CURL_CMD} -f -L -o "${DOWNLOAD_FILE}" "${DOWNLOAD_URL}"
chmod +x "${DOWNLOAD_FILE}"
mkdir -p "${MILL_DOWNLOAD_PATH}"
mv "${DOWNLOAD_FILE}" "${MILL}"

unset DOWNLOAD_FILE
unset DOWNLOAD_SUFFIX
fi
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_OLD_DOWNLOAD_PATH
unset OLD_MILL
unset MILL_VERSION
unset MILL_REPO_URL

exec $MILL_EXEC_PATH "$@"
# We don't quote MILL_FIRST_ARG on purpose, so we can expand the empty value without quotes
# shellcheck disable=SC2086
exec "${MILL}" $MILL_FIRST_ARG -D "mill.main.cli=${MILL_MAIN_CLI}" "$@"
14 changes: 13 additions & 1 deletion readme.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
= Acyclic
:version: 0.3.15
:version: 0.3.18
:toc-placement: preamble
:toc:
:link-acyclic: https://github.com/com-lihaoyi/acyclic
@@ -305,6 +305,18 @@ THE SOFTWARE.

== ChangeLog

=== 0.3.18

* Added support for Scala 3.6.4

=== 0.3.17

* Added support for Scala 3.6.x

=== 0.3.16

* Added support for Scala 2.13.16

=== 0.3.15

* Scala 3.x support https://github.com/com-lihaoyi/acyclic/pull/136[#136]