From a0ffc4aeaddfde30345ab5c21d82237daa04eb2f Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 30 Nov 2022 22:09:42 +0100 Subject: [PATCH] Reworked `.mill-jvm-opts` reader to support files without final newline I tried to keep POSIX shell compatibility, hence it's a bit lenghty. Fix https://github.com/com-lihaoyi/mill/issues/2140 --- build.sc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/build.sc b/build.sc index 39dbc4d0080..50ee6a8578c 100644 --- a/build.sc +++ b/build.sc @@ -1161,10 +1161,20 @@ def launcherScript( | fi | | if [ -f "$$mill_jvm_opts_file" ] ; then - | while IFS= read line - | do - | mill_jvm_opts="$${mill_jvm_opts} $$(echo $$line | grep -v "^[[:space:]]*[#]")" - | done <"$$mill_jvm_opts_file" + | # We need to append a newline at the end to fix + | # https://github.com/com-lihaoyi/mill/issues/2140 + | newline=" + |" + | mill_jvm_opts="$$( + | echo "$$newline" | cat "$$mill_jvm_opts_file" - | ( + | while IFS= read line + | do + | mill_jvm_opts="$${mill_jvm_opts} $$(echo $$line | grep -v "^[[:space:]]*[#]")" + | done + | # we are in a sub-shell, so need to return it explicitly + | echo "$${mill_jvm_opts}" + | ) + | )" | mill_jvm_opts="$${mill_jvm_opts} -Dmill.jvm_opts_applied=true" | fi |} @@ -1515,7 +1525,6 @@ object docs extends Module { } def assembly = T { - val version = millVersion() val devRunClasspath = dev.runClasspath().map(_.path) val filename = if (scala.util.Properties.isWin) "mill.bat" else "mill"