Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .mill-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.6
1.1.2
7 changes: 4 additions & 3 deletions build.mill.scala → build.mill
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//| mill-jvm-version: system|17
//| mvnDeps:
//| - io.github.alexarchambault.mill::mill-native-image::0.2.4
//| - io.github.alexarchambault.mill::mill-native-image-upload:0.2.4
Expand Down Expand Up @@ -67,7 +68,7 @@ trait CrossScalaDefaultToRunner extends CrossScalaDefault { self: Cross[?] =>
// Publish a bootstrapped, executable jar for a restricted environments
object cliBootstrapped extends ScalaCliPublishModule {
override def unmanagedClasspath: T[Seq[PathRef]] =
Task(cli(Scala.defaultInternal).nativeImageClassPath())
Task(cli(Scala.defaultInternal).nativeImageClassPath().filter(ref => os.exists(ref.path)))
override def jar: T[PathRef] = assembly()

import mill.scalalib.Assembly
Expand Down Expand Up @@ -864,7 +865,7 @@ trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers
| def signingCliJvmVersion = ${Deps.Versions.signingCliJvmVersion}
| def defaultMillVersion = "${BuildInfo.millVersion}"
| def mill012Version = "${Deps.Versions.mill012Version}"
| def mill10Version = "${Deps.Versions.mill10Version}"
| def mill1Version = "${Deps.Versions.mill1Version}"
| def defaultSbtVersion = "${Deps.Versions.sbtVersion}"
| def defaultMavenVersion = "${Deps.Versions.mavenVersion}"
| def defaultMavenScalaCompilerPluginVersion = "${Deps.Versions.mavenScalaCompilerPluginVersion}"
Expand Down Expand Up @@ -1121,7 +1122,7 @@ trait CliIntegration extends SbtModule
| def jmhGeneratorBytecodeModule = "${Deps.jmhGeneratorBytecode.dep.module.name.value}"
| def defaultMillVersion = "${BuildInfo.millVersion}"
| def mill012Version = "${Deps.Versions.mill012Version}"
| def mill10Version = "${Deps.Versions.mill10Version}"
| def mill1Version = "${Deps.Versions.mill1Version}"
|}
|""".stripMargin
if (!os.isFile(dest) || os.read(dest) != code)
Expand Down
8 changes: 2 additions & 6 deletions mill.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setlocal enabledelayedexpansion

if [!DEFAULT_MILL_VERSION!]==[] ( set "DEFAULT_MILL_VERSION=0.12.17" )
if [!DEFAULT_MILL_VERSION!]==[] ( set "DEFAULT_MILL_VERSION=1.1.2" )

if [!MILL_GITHUB_RELEASE_CDN!]==[] ( set "MILL_GITHUB_RELEASE_CDN=" )

Expand Down Expand Up @@ -276,12 +276,8 @@ if [%~1%]==[--bsp] (
if [%~1%]==[--no-daemon] (
set MILL_FIRST_ARG=%1%
) else (
if [%~1%]==[--repl] (
if [%~1%]==[--help] (
set MILL_FIRST_ARG=%1%
) else (
if [%~1%]==[--help] (
set MILL_FIRST_ARG=%1%
)
)
)
)
Expand Down
96 changes: 57 additions & 39 deletions millw
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

if [ -z "${DEFAULT_MILL_VERSION}" ] ; then DEFAULT_MILL_VERSION="0.12.17"; fi
if [ -z "${DEFAULT_MILL_VERSION}" ] ; then DEFAULT_MILL_VERSION="1.1.2"; fi

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

Expand Down Expand Up @@ -54,61 +54,79 @@ if [ -z "${MILL_FINAL_DOWNLOAD_FOLDER}" ] ; then MILL_FINAL_DOWNLOAD_FOLDER="${M

MILL_NATIVE_SUFFIX="-native"
MILL_JVM_SUFFIX="-jvm"
FULL_MILL_VERSION=$MILL_VERSION
ARTIFACT_SUFFIX=""
set_artifact_suffix(){
if [ "$(expr substr $(uname -s) 1 5 2>/dev/null)" = "Linux" ]; then

# Check if GLIBC version is at least the required version
# Returns 0 (true) if GLIBC >= required version, 1 (false) otherwise
check_glibc_version() {
required_version="2.39"
required_major=$(echo "$required_version" | cut -d. -f1)
required_minor=$(echo "$required_version" | cut -d. -f2)
# Get GLIBC version from ldd --version (first line contains version like "ldd (GNU libc) 2.31")
glibc_version=$(ldd --version 2>/dev/null | head -n 1 | grep -oE '[0-9]+\.[0-9]+$' || echo "")
if [ -z "$glibc_version" ]; then
# If we can't determine GLIBC version, assume it's too old
return 1
fi
glibc_major=$(echo "$glibc_version" | cut -d. -f1)
glibc_minor=$(echo "$glibc_version" | cut -d. -f2)
if [ "$glibc_major" -gt "$required_major" ]; then
return 0
elif [ "$glibc_major" -eq "$required_major" ] && [ "$glibc_minor" -ge "$required_minor" ]; then
return 0
else
return 1
fi
}

set_artifact_suffix() {
if [ "$(uname -s 2>/dev/null | cut -c 1-5)" = "Linux" ]; then
# Native binaries require new enough GLIBC; fall back to JVM launcher if older
if ! check_glibc_version; then
return
fi
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
echo "This native mill launcher supports only Linux and macOS." 1>&2
exit 1
fi
}

case "$MILL_VERSION" in
*"$MILL_NATIVE_SUFFIX")
MILL_VERSION=${MILL_VERSION%"$MILL_NATIVE_SUFFIX"}
set_artifact_suffix
;;
*"$MILL_NATIVE_SUFFIX")
MILL_VERSION=${MILL_VERSION%"$MILL_NATIVE_SUFFIX"}
set_artifact_suffix
;;

*"$MILL_JVM_SUFFIX")
*"$MILL_JVM_SUFFIX")
MILL_VERSION=${MILL_VERSION%"$MILL_JVM_SUFFIX"}
;;

*)
case "$MILL_VERSION" in
0.1.*) ;;
0.2.*) ;;
0.3.*) ;;
0.4.*) ;;
0.5.*) ;;
0.6.*) ;;
0.7.*) ;;
0.8.*) ;;
0.9.*) ;;
0.10.*) ;;
0.11.*) ;;
0.12.*) ;;
*)
set_artifact_suffix
esac
;;
;;

*)
case "$MILL_VERSION" in
0.1.* | 0.2.* | 0.3.* | 0.4.* | 0.5.* | 0.6.* | 0.7.* | 0.8.* | 0.9.* | 0.10.* | 0.11.* | 0.12.*)
;;
*)
set_artifact_suffix
;;
esac
;;
esac

MILL="${MILL_FINAL_DOWNLOAD_FOLDER}/$MILL_VERSION$ARTIFACT_SUFFIX"

# If not already downloaded, download it
if [ ! -s "${MILL}" ] || [ "$MILL_TEST_DRY_RUN_LAUNCHER_SCRIPT" = "1" ] ; then
case $MILL_VERSION in
0.0.* | 0.1.* | 0.2.* | 0.3.* | 0.4.* )
0.0.* | 0.1.* | 0.2.* | 0.3.* | 0.4.*)
MILL_DOWNLOAD_SUFFIX=""
MILL_DOWNLOAD_FROM_MAVEN=0
;;
0.5.* | 0.6.* | 0.7.* | 0.8.* | 0.9.* | 0.10.* | 0.11.0-M* )
0.5.* | 0.6.* | 0.7.* | 0.8.* | 0.9.* | 0.10.* | 0.11.0-M*)
MILL_DOWNLOAD_SUFFIX="-assembly"
MILL_DOWNLOAD_FROM_MAVEN=0
;;
Expand All @@ -118,13 +136,13 @@ if [ ! -s "${MILL}" ] || [ "$MILL_TEST_DRY_RUN_LAUNCHER_SCRIPT" = "1" ] ; then
;;
esac
case $MILL_VERSION in
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 )
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)
MILL_DOWNLOAD_EXT="jar"
;;
0.12.* )
0.12.*)
MILL_DOWNLOAD_EXT="exe"
;;
0.* )
0.*)
MILL_DOWNLOAD_EXT="jar"
;;
*)
Expand All @@ -145,8 +163,8 @@ if [ ! -s "${MILL}" ] || [ "$MILL_TEST_DRY_RUN_LAUNCHER_SCRIPT" = "1" ] ; then


if [ "$MILL_TEST_DRY_RUN_LAUNCHER_SCRIPT" = "1" ] ; then
echo $MILL_DOWNLOAD_URL
echo $MILL
echo "$MILL_DOWNLOAD_URL"
echo "$MILL"
exit 0
fi

Expand All @@ -163,7 +181,7 @@ if [ ! -s "${MILL}" ] || [ "$MILL_TEST_DRY_RUN_LAUNCHER_SCRIPT" = "1" ] ; then
fi

MILL_FIRST_ARG=""
if [ "$1" = "--bsp" ] || [ "${1#"-i"}" != "$1" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--no-daemon" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then
if [ "$1" = "--bsp" ] || [ "${1#"-i"}" != "$1" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--no-daemon" ] || [ "$1" = "--help" ] ; then
# Need to preserve the first position of those listed options
MILL_FIRST_ARG=$1
shift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class BuildOptionsTests extends TestUtil.ScalaCliBuildSuite {
)
}

test("Scala 2.12.9-bin-1111111 shows No Valid Scala Version Error") {
test("Scala 2.12.9-bin-1111111 shows No Valid Scala Version Error".flaky) {

val options = BuildOptions(
scalaOptions = ScalaOptions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
},
{
"name": "ch.epfl.scala.bsp4j.DebugProvider",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
Expand Down Expand Up @@ -180,13 +183,6 @@
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "ch.epfl.scala.bsp4j.DependencyModulesDataKind",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "ch.epfl.scala.bsp4j.DependencyModulesItem",
"allDeclaredConstructors": true,
Expand Down Expand Up @@ -257,13 +253,6 @@
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "ch.epfl.scala.bsp4j.FileChangeType",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "ch.epfl.scala.bsp4j.InitializeBuildParams",
"allDeclaredConstructors": true,
Expand Down Expand Up @@ -687,13 +676,6 @@
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "ch.epfl.scala.bsp4j.TaskDataKind",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "ch.epfl.scala.bsp4j.TaskFinishParams",
"allDeclaredConstructors": true,
Expand Down Expand Up @@ -1232,13 +1214,6 @@
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "scala.build.bsp.LoggingBuildServerAll",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "scala.build.bsp.LoggingJavaBuildServer",
"allDeclaredConstructors": true,
Expand Down Expand Up @@ -1267,41 +1242,6 @@
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "scala.build.bsp.ScalaScriptBuildServer",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "scala.build.bsp.WrappedSourceItem",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "scala.build.bsp.WrappedSourcesItem",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "scala.build.bsp.WrappedSourcesParams",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "scala.build.bsp.WrappedSourcesResult",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allDeclaredFields": true
},
{
"name": "scala.build.bsp.protocol.TextEdit",
"allDeclaredConstructors": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ final case class MillProject(
os.write(path0, content, createFolders = true)
}

val outputBuildFile = if isMill1OrNewer then dir / "build.mill.scala" else dir / "build.sc"
val outputBuildFile = if isMill1OrNewer then dir / "build.mill" else dir / "build.sc"
os.write(outputBuildFile, buildFileContent.getBytes(charSet))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ object NativeImage {
)(
f: os.Path => T
): T =
if (Properties.isWin && currentHome.toString.length >= 180) {
// Lower threshold (was 180) to ensure native-image's internal paths don't exceed 260-char limit
if (Properties.isWin && currentHome.toString.length >= 90) {
val (driveLetter, newHome) = getShortenedPath(currentHome, logger)
val savedCodepage: String = getCodePage(logger)
val result =
Expand Down
Loading