From 903107268580615c9545606b47d9891f30e61b52 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Mon, 8 Jul 2019 08:03:34 +0800 Subject: make use of mill file if it exists and we're not already using it --- build.sc | 12 +++++------- mill | 2 ++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build.sc b/build.sc index db56d39a..de2a66cd 100755 --- a/build.sc +++ b/build.sc @@ -522,11 +522,7 @@ object dev extends MillModule{ if (isWin) { windowsVmOptions("dev.launcher", outputPath, forkArgs()) } else { - val perms = java.nio.file.Files.getPosixFilePermissions(outputPath.toNIO) - perms.add(PosixFilePermission.GROUP_EXECUTE) - perms.add(PosixFilePermission.OWNER_EXECUTE) - perms.add(PosixFilePermission.OTHERS_EXECUTE) - java.nio.file.Files.setPosixFilePermissions(outputPath.toNIO, perms) + os.perms.set(outputPath, "rwxrwxrwx") } PathRef(outputPath) } @@ -608,16 +604,18 @@ def assembly = T{ def millBootstrap = T.sources(os.pwd / "mill") def launcher = T{ + val outputPath = T.ctx().dest / "mill" val millBootstrapGrepPrefix = "DEFAULT_MILL_VERSION=" os.write( - T.ctx().dest / "mill", + outputPath, os.read(millBootstrap().head.path) .replaceAll( millBootstrapGrepPrefix + "[^\\n]+", millBootstrapGrepPrefix + publishVersion()._2 ) ) - PathRef(T.ctx().dest / "mill") + os.perms.set(outputPath, "rwxrwxrwx") + PathRef(outputPath) } val isMasterCommit = { diff --git a/mill b/mill index 0e6cfd2a..a3c1664c 100755 --- a/mill +++ b/mill @@ -10,6 +10,8 @@ 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" ] && [ "$BASH_SOURCE" != "mill" ] ; then + MILL_VERSION=$(grep -F "DEFAULT_MILL_VERSION=" "mill" | cut -c $cutCount-) else MILL_VERSION=$DEFAULT_MILL_VERSION fi -- cgit v1.2.3