Skip to content

Commit 5b41330

Browse files
Release 0.22.0 (Sonatype Central)
1 parent 63984ba commit 5b41330

File tree

14 files changed

+435
-257
lines changed

14 files changed

+435
-257
lines changed

.indigo-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.21.2-SNAPSHOT
1+
0.22.0

indigo-plugin/.mill-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.12.5
1+
1.0.3

indigo-plugin/build.sc renamed to indigo-plugin/build.mill

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1+
//| mill-version: 1.0.3
2+
13
import scala.util.Success
24
import scala.util.Try
3-
import $ivy.`com.lihaoyi::mill-contrib-bloop:$MILL_VERSION`
4-
import mill._
5-
import mill.scalalib._
6-
import mill.scalajslib._
7-
import mill.scalajslib.api._
8-
import mill.scalalib.scalafmt._
9-
import coursier.maven.MavenRepository
10-
import publish._
5+
// import $ivy.`com.lihaoyi::mill-contrib-bloop:$MILL_VERSION`
6+
// import mill._
7+
// import mill.scalalib._
8+
// import mill.scalajslib._
9+
// import mill.scalajslib.api._
10+
import mill.scalalib.scalafmt.*
11+
// import coursier.maven.MavenRepository
12+
// import publish._
13+
import mill.*, scalalib.*, publish.*
14+
import mill.api.BuildCtx
1115

1216
object `indigo-plugin` extends Cross[IndigoPluginModule]("2.12", "2.13", "3")
1317

14-
trait IndigoPluginModule extends CrossScalaModule with PublishModule with ScalafmtModule {
18+
trait IndigoPluginModule extends CrossScalaModule with SonatypeCentralPublishModule with ScalafmtModule {
1519

16-
def indigoVersion = T.input(IndigoVersion.getVersion(T.workspace))
20+
def indigoVersion = Task.Input(IndigoVersion.getVersion(BuildCtx.workspaceRoot))
1721

1822
def scalaVersion =
1923
crossScalaVersion match {
@@ -25,23 +29,17 @@ trait IndigoPluginModule extends CrossScalaModule with PublishModule with Scalaf
2529

2630
def artifactName = "indigo-plugin"
2731

28-
def ivyDeps =
29-
Agg(
30-
ivy"com.lihaoyi::os-lib:0.11.3",
31-
ivy"io.circe::circe-core:0.14.10",
32-
ivy"io.circe::circe-parser:0.14.10"
33-
)
34-
35-
def repositoriesTask = T.task {
36-
super.repositoriesTask() ++ Seq(
37-
MavenRepository("https://oss.sonatype.org/content/repositories/releases")
32+
def mvnDeps =
33+
Seq(
34+
mvn"com.lihaoyi::os-lib:0.11.5",
35+
mvn"io.circe::circe-core:0.14.14",
36+
mvn"io.circe::circe-parser:0.14.14"
3837
)
39-
}
4038

4139
object test extends ScalaTests {
42-
def ivyDeps =
43-
Agg(
44-
ivy"org.scalameta::munit:1.0.4"
40+
def mvnDeps =
41+
Seq(
42+
mvn"org.scalameta::munit:1.0.4"
4543
)
4644

4745
def testFramework = "munit.Framework"

indigo-plugin/mill

Lines changed: 152 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,45 @@
11
#!/usr/bin/env sh
22

3-
# This is a wrapper script, that automatically download mill from GitHub release pages
4-
# You can give the required mill version with --mill-version parameter
5-
# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
3+
# This is a wrapper script, that automatically selects or downloads Mill from Maven Central or GitHub release pages.
64
#
7-
# Original Project page: https://github.com/lefou/millw
8-
# Script Version: 0.4.12
5+
# This script determines the Mill version to use by trying these sources
6+
# - env-variable `MILL_VERSION`
7+
# - local file `.mill-version`
8+
# - local file `.config/mill-version`
9+
# - `mill-version` from YAML fronmatter of current buildfile
10+
# - if accessible, find the latest stable version available on Maven Central (https://repo1.maven.org/maven2)
11+
# - env-variable `DEFAULT_MILL_VERSION`
12+
#
13+
# If a version has the suffix '-native' a native binary will be used.
14+
# If a version has the suffix '-jvm' an executable jar file will be used, requiring an already installed Java runtime.
15+
# If no such suffix is found, the script will pick a default based on version and platform.
16+
#
17+
# Once a version was determined, it tries to use either
18+
# - a system-installed mill, if found and it's version matches
19+
# - an already downloaded version under ~/.cache/mill/download
20+
#
21+
# If no working mill version was found on the system,
22+
# this script downloads a binary file from Maven Central or Github Pages (this is version dependent)
23+
# into a cache location (~/.cache/mill/download).
24+
#
25+
# Mill Project URL: https://github.com/com-lihaoyi/mill
26+
# Script Version: 1.0.0-M1-21-7b6fae-DIRTY892b63e8
927
#
1028
# If you want to improve this script, please also contribute your changes back!
29+
# This script was generated from: dist/scripts/src/mill.sh
1130
#
1231
# Licensed under the Apache License, Version 2.0
1332

1433
set -e
1534

35+
if [ "$1" = "--setup-completions" ] ; then
36+
# Need to preserve the first position of those listed options
37+
MILL_FIRST_ARG=$1
38+
shift
39+
fi
40+
1641
if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
17-
DEFAULT_MILL_VERSION=0.12.5
42+
DEFAULT_MILL_VERSION=1.0.3
1843
fi
1944

2045

@@ -31,16 +56,17 @@ fi
3156

3257
# Explicit commandline argument takes precedence over all other methods
3358
if [ "$1" = "--mill-version" ] ; then
34-
shift
35-
if [ "x$1" != "x" ] ; then
36-
MILL_VERSION="$1"
37-
shift
38-
else
39-
echo "You specified --mill-version without a version." 1>&2
40-
echo "Please provide a version that matches one provided on" 1>&2
41-
echo "${MILL_REPO_URL}/releases" 1>&2
42-
false
43-
fi
59+
echo "The --mill-version option is no longer supported." 1>&2
60+
fi
61+
62+
MILL_BUILD_SCRIPT=""
63+
64+
if [ -f "build.mill" ] ; then
65+
MILL_BUILD_SCRIPT="build.mill"
66+
elif [ -f "build.mill.scala" ] ; then
67+
MILL_BUILD_SCRIPT="build.mill.scala"
68+
elif [ -f "build.sc" ] ; then
69+
MILL_BUILD_SCRIPT="build.sc"
4470
fi
4571

4672
# Please note, that if a MILL_VERSION is already set in the environment,
@@ -52,6 +78,8 @@ if [ -z "${MILL_VERSION}" ] ; then
5278
MILL_VERSION="$(tr '\r' '\n' < .mill-version | head -n 1 2> /dev/null)"
5379
elif [ -f ".config/mill-version" ] ; then
5480
MILL_VERSION="$(tr '\r' '\n' < .config/mill-version | head -n 1 2> /dev/null)"
81+
elif [ -n "${MILL_BUILD_SCRIPT}" ] ; then
82+
MILL_VERSION="$(cat ${MILL_BUILD_SCRIPT} | grep '//[|] *mill-version: *' | sed 's;//| *mill-version: *;;')"
5583
fi
5684
fi
5785

@@ -65,7 +93,7 @@ fi
6593
if [ -z "${MILL_VERSION}" ] ; then
6694
# TODO: try to load latest version from release page
6795
echo "No mill version specified." 1>&2
68-
echo "You should provide a version via '.mill-version' file or --mill-version option." 1>&2
96+
echo "You should provide a version via a '//| mill-version: ' comment or a '.mill-version' file." 1>&2
6997

7098
mkdir -p "${MILL_DOWNLOAD_PATH}"
7199
LANG=C touch -d '1 hour ago' "${MILL_DOWNLOAD_PATH}/.expire_latest" 2>/dev/null || (
@@ -101,7 +129,60 @@ if [ -z "${MILL_VERSION}" ] ; then
101129
fi
102130
fi
103131

104-
MILL="${MILL_DOWNLOAD_PATH}/${MILL_VERSION}"
132+
MILL_NATIVE_SUFFIX="-native"
133+
MILL_JVM_SUFFIX="-jvm"
134+
FULL_MILL_VERSION=$MILL_VERSION
135+
ARTIFACT_SUFFIX=""
136+
set_artifact_suffix(){
137+
if [ "$(expr substr $(uname -s) 1 5 2>/dev/null)" = "Linux" ]; then
138+
if [ "$(uname -m)" = "aarch64" ]; then
139+
ARTIFACT_SUFFIX="-native-linux-aarch64"
140+
else
141+
ARTIFACT_SUFFIX="-native-linux-amd64"
142+
fi
143+
elif [ "$(uname)" = "Darwin" ]; then
144+
if [ "$(uname -m)" = "arm64" ]; then
145+
ARTIFACT_SUFFIX="-native-mac-aarch64"
146+
else
147+
ARTIFACT_SUFFIX="-native-mac-amd64"
148+
fi
149+
else
150+
echo "This native mill launcher supports only Linux and macOS." 1>&2
151+
exit 1
152+
fi
153+
}
154+
155+
case "$MILL_VERSION" in
156+
*"$MILL_NATIVE_SUFFIX")
157+
MILL_VERSION=${MILL_VERSION%"$MILL_NATIVE_SUFFIX"}
158+
set_artifact_suffix
159+
;;
160+
161+
*"$MILL_JVM_SUFFIX")
162+
MILL_VERSION=${MILL_VERSION%"$MILL_JVM_SUFFIX"}
163+
;;
164+
165+
*)
166+
case "$MILL_VERSION" in
167+
0.1.*) ;;
168+
0.2.*) ;;
169+
0.3.*) ;;
170+
0.4.*) ;;
171+
0.5.*) ;;
172+
0.6.*) ;;
173+
0.7.*) ;;
174+
0.8.*) ;;
175+
0.9.*) ;;
176+
0.10.*) ;;
177+
0.11.*) ;;
178+
0.12.*) ;;
179+
*)
180+
set_artifact_suffix
181+
esac
182+
;;
183+
esac
184+
185+
MILL="${MILL_DOWNLOAD_PATH}/$MILL_VERSION$ARTIFACT_SUFFIX"
105186

106187
try_to_use_system_mill() {
107188
if [ "$(uname)" != "Linux" ]; then
@@ -174,57 +255,67 @@ EOF
174255
try_to_use_system_mill
175256

176257
# If not already downloaded, download it
177-
if [ ! -s "${MILL}" ] ; then
178-
179-
# support old non-XDG download dir
180-
MILL_OLD_DOWNLOAD_PATH="${HOME}/.mill/download"
181-
OLD_MILL="${MILL_OLD_DOWNLOAD_PATH}/${MILL_VERSION}"
182-
if [ -x "${OLD_MILL}" ] ; then
183-
MILL="${OLD_MILL}"
258+
if [ ! -s "${MILL}" ] || [ "$MILL_TEST_DRY_RUN_LAUNCHER_SCRIPT" = "1" ] ; then
259+
case $MILL_VERSION in
260+
0.0.* | 0.1.* | 0.2.* | 0.3.* | 0.4.* )
261+
DOWNLOAD_SUFFIX=""
262+
DOWNLOAD_FROM_MAVEN=0
263+
;;
264+
0.5.* | 0.6.* | 0.7.* | 0.8.* | 0.9.* | 0.10.* | 0.11.0-M* )
265+
DOWNLOAD_SUFFIX="-assembly"
266+
DOWNLOAD_FROM_MAVEN=0
267+
;;
268+
*)
269+
DOWNLOAD_SUFFIX="-assembly"
270+
DOWNLOAD_FROM_MAVEN=1
271+
;;
272+
esac
273+
case $MILL_VERSION in
274+
0.12.0 | 0.12.1 | 0.12.2 | 0.12.3 | 0.12.4 | 0.12.5 | 0.12.6 | 0.12.7 | 0.12.8 | 0.12.9 | 0.12.10 | 0.12.11 )
275+
DOWNLOAD_EXT="jar"
276+
;;
277+
0.12.* )
278+
DOWNLOAD_EXT="exe"
279+
;;
280+
0.* )
281+
DOWNLOAD_EXT="jar"
282+
;;
283+
*)
284+
DOWNLOAD_EXT="exe"
285+
;;
286+
esac
287+
288+
DOWNLOAD_FILE=$(mktemp mill.XXXXXX)
289+
if [ "$DOWNLOAD_FROM_MAVEN" = "1" ] ; then
290+
DOWNLOAD_URL="https://repo1.maven.org/maven2/com/lihaoyi/mill-dist${ARTIFACT_SUFFIX}/${MILL_VERSION}/mill-dist${ARTIFACT_SUFFIX}-${MILL_VERSION}.${DOWNLOAD_EXT}"
184291
else
185-
case $MILL_VERSION in
186-
0.0.* | 0.1.* | 0.2.* | 0.3.* | 0.4.* )
187-
DOWNLOAD_SUFFIX=""
188-
DOWNLOAD_FROM_MAVEN=0
189-
;;
190-
0.5.* | 0.6.* | 0.7.* | 0.8.* | 0.9.* | 0.10.* | 0.11.0-M* )
191-
DOWNLOAD_SUFFIX="-assembly"
192-
DOWNLOAD_FROM_MAVEN=0
193-
;;
194-
*)
195-
DOWNLOAD_SUFFIX="-assembly"
196-
DOWNLOAD_FROM_MAVEN=1
197-
;;
198-
esac
199-
200-
DOWNLOAD_FILE=$(mktemp mill.XXXXXX)
201-
202-
if [ "$DOWNLOAD_FROM_MAVEN" = "1" ] ; then
203-
DOWNLOAD_URL="https://repo1.maven.org/maven2/com/lihaoyi/mill-dist/${MILL_VERSION}/mill-dist-${MILL_VERSION}.jar"
204-
else
205-
MILL_VERSION_TAG=$(echo "$MILL_VERSION" | sed -E 's/([^-]+)(-M[0-9]+)?(-.*)?/\1\2/')
206-
DOWNLOAD_URL="${GITHUB_RELEASE_CDN}${MILL_REPO_URL}/releases/download/${MILL_VERSION_TAG}/${MILL_VERSION}${DOWNLOAD_SUFFIX}"
207-
unset MILL_VERSION_TAG
208-
fi
209-
210-
# TODO: handle command not found
211-
echo "Downloading mill ${MILL_VERSION} from ${DOWNLOAD_URL} ..." 1>&2
212-
${CURL_CMD} -f -L -o "${DOWNLOAD_FILE}" "${DOWNLOAD_URL}"
213-
chmod +x "${DOWNLOAD_FILE}"
214-
mkdir -p "${MILL_DOWNLOAD_PATH}"
215-
mv "${DOWNLOAD_FILE}" "${MILL}"
292+
MILL_VERSION_TAG=$(echo "$MILL_VERSION" | sed -E 's/([^-]+)(-M[0-9]+)?(-.*)?/\1\2/')
293+
DOWNLOAD_URL="${GITHUB_RELEASE_CDN}${MILL_REPO_URL}/releases/download/${MILL_VERSION_TAG}/${MILL_VERSION}${DOWNLOAD_SUFFIX}"
294+
unset MILL_VERSION_TAG
295+
fi
216296

217-
unset DOWNLOAD_FILE
218-
unset DOWNLOAD_SUFFIX
297+
if [ "$MILL_TEST_DRY_RUN_LAUNCHER_SCRIPT" = "1" ] ; then
298+
echo $DOWNLOAD_URL
299+
echo $MILL
300+
exit 0
219301
fi
302+
# TODO: handle command not found
303+
echo "Downloading mill ${MILL_VERSION} from ${DOWNLOAD_URL} ..." 1>&2
304+
${CURL_CMD} -f -L -o "${DOWNLOAD_FILE}" "${DOWNLOAD_URL}"
305+
chmod +x "${DOWNLOAD_FILE}"
306+
mkdir -p "${MILL_DOWNLOAD_PATH}"
307+
mv "${DOWNLOAD_FILE}" "${MILL}"
308+
309+
unset DOWNLOAD_FILE
310+
unset DOWNLOAD_SUFFIX
220311
fi
221312

222313
if [ -z "$MILL_MAIN_CLI" ] ; then
223314
MILL_MAIN_CLI="${0}"
224315
fi
225316

226317
MILL_FIRST_ARG=""
227-
if [ "$1" = "--bsp" ] || [ "$1" = "-i" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then
318+
if [ "$1" = "--bsp" ] || [ "${1#"-i"}" != "$1" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--no-daemon" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then
228319
# Need to preserve the first position of those listed options
229320
MILL_FIRST_ARG=$1
230321
shift
@@ -236,6 +327,7 @@ unset OLD_MILL
236327
unset MILL_VERSION
237328
unset MILL_REPO_URL
238329

330+
# -D mill.main.cli is for compatibility with Mill 0.10.9 - 0.13.0-M2
239331
# We don't quote MILL_FIRST_ARG on purpose, so we can expand the empty value without quotes
240332
# shellcheck disable=SC2086
241-
exec "${MILL}" $MILL_FIRST_ARG -D "mill.main.cli=${MILL_MAIN_CLI}" "$@"
333+
exec "${MILL}" $MILL_FIRST_ARG -D "mill.main.cli=${MILL_MAIN_CLI}" "$@"

0 commit comments

Comments
 (0)