diff --git a/build.sc b/build.sc index defb4449d3c..079c07f40c3 100644 --- a/build.sc +++ b/build.sc @@ -142,7 +142,7 @@ object Deps { val log4j2Core = ivy"org.apache.logging.log4j:log4j-core:2.22.1" val osLib = ivy"com.lihaoyi::os-lib:0.9.3" val pprint = ivy"com.lihaoyi::pprint:0.8.1" - val mainargs = ivy"com.lihaoyi::mainargs:0.5.4" + val mainargs = ivy"com.lihaoyi::mainargs:0.6.1" val millModuledefsVersion = "0.10.9" val millModuledefsString = s"com.lihaoyi::mill-moduledefs:${millModuledefsVersion}" val millModuledefs = ivy"${millModuledefsString}" @@ -1210,7 +1210,6 @@ def launcherScript( ) = { val millMainClass = "mill.main.client.MillClientMain" - val millClientMainClass = "mill.main.client.MillClientMain" Jvm.universalScript( shellCommands = { @@ -1264,15 +1263,20 @@ def launcherScript( | fi | ${java(millMainClass, true)} |else - | case "$$1" in - | -i | --interactive | --repl | --no-server | --bsp ) + | if [ "$${1%"-i"*}" != "$$1" ] ; then # first arg starts with "-i" | init_mill_jvm_opts | ${java(millMainClass, true)} - | ;; - | *) - | ${java(millClientMainClass, false)} - | ;; - |esac + | else + | case "$$1" in + | -i | --interactive | --repl | --no-server | --bsp ) + | init_mill_jvm_opts + | ${java(millMainClass, true)} + | ;; + | *) + | ${java(millMainClass, false)} + | ;; + | esac + | fi |fi |""".stripMargin }, @@ -1307,7 +1311,7 @@ def launcherScript( | ) | ${java(millMainClass, true)} |) else ( - | ${java(millClientMainClass, false)} + | ${java(millMainClass, false)} |) |endlocal |""".stripMargin diff --git a/integration/feature/docannotations/test/src/DocAnnotationsTests.scala b/integration/feature/docannotations/test/src/DocAnnotationsTests.scala index 855cac4e00a..f86cdb04f2d 100644 --- a/integration/feature/docannotations/test/src/DocAnnotationsTests.scala +++ b/integration/feature/docannotations/test/src/DocAnnotationsTests.scala @@ -87,19 +87,20 @@ object DocAnnotationsTests extends IntegrationTestSuite { assert(eval("inspect", "core.ivyDepsTree")) val ivyDepsTree = ujson.read(meta("inspect"))("value").str + assert( globMatches( """core.ivyDepsTree(JavaModule.scala:...) | Command to print the transitive dependency tree to STDOUT. | - | --inverse Invert the tree representation, so that the root is on the bottom val - | inverse (will be forced when used with whatDependsOn) - | --whatDependsOn Possible list of modules (org:artifact) to target in the tree in order to - | see where a dependency stems from. - | --withCompile Include the compile-time only dependencies (`compileIvyDeps`, provided - | scope) into the tree. - | --withRuntime Include the runtime dependencies (`runIvyDeps`, runtime scope) into the - | tree. + | --inverse Invert the tree representation, so that the root is on the bottom val + | inverse (will be forced when used with whatDependsOn) + | --what-depends-on Possible list of modules (org:artifact) to target in the tree in order + | to see where a dependency stems from. + | --with-compile Include the compile-time only dependencies (`compileIvyDeps`, provided + | scope) into the tree. + | --with-runtime Include the runtime dependencies (`runIvyDeps`, runtime scope) into the + | tree. | |Inputs: | core.transitiveIvyDeps @@ -107,6 +108,11 @@ object DocAnnotationsTests extends IntegrationTestSuite { ivyDepsTree ) ) + + // Make sure both kebab-case and camelCase flags work, even though the + // docs from `inspect` only show the kebab-case version + assert(eval("core.ivyDepsTree", "--withCompile", "--withRuntime")) + assert(eval("core.ivyDepsTree", "--with-compile", "--with-runtime")) } } } diff --git a/main/client/src/mill/main/client/MillClientMain.java b/main/client/src/mill/main/client/MillClientMain.java index b82d5d6baed..e6b7d3a3969 100644 --- a/main/client/src/mill/main/client/MillClientMain.java +++ b/main/client/src/mill/main/client/MillClientMain.java @@ -61,8 +61,8 @@ public static void main(String[] args) throws Exception { if (args.length > 0) { String firstArg = args[0]; runIsolated = - Arrays.asList("-i", "--interactive", "--no-server", "--repl", "--bsp", "--help") - .contains(firstArg); + Arrays.asList("--interactive", "--no-server", "--repl", "--bsp", "--help") + .contains(firstArg) || firstArg.startsWith("-i"); } if (!runIsolated) { // WSL2 has the directory /run/WSL/ and WSL1 not. diff --git a/main/resolve/src/mill/resolve/Resolve.scala b/main/resolve/src/mill/resolve/Resolve.scala index 4dbf6eb7336..090c7738d59 100644 --- a/main/resolve/src/mill/resolve/Resolve.scala +++ b/main/resolve/src/mill/resolve/Resolve.scala @@ -146,9 +146,10 @@ object Resolve { flattenedArgSigsWithDefaults, allowPositional = true, allowRepeats = false, - allowLeftover = ep.argSigs0.exists(_.reader.isLeftover) + allowLeftover = ep.argSigs0.exists(_.reader.isLeftover), + nameMapper = mainargs.Util.kebabCaseNameMapper ).flatMap { (grouped: TokenGrouping[_]) => - val mainData = ep.asInstanceOf[MainData[_, Any]] + val mainData = ep.asInstanceOf[MainData[Any, Any]] val mainDataWithDefaults = mainData .copy(argSigs0 = mainData.argSigs0.map(withNullDefault)) @@ -170,7 +171,8 @@ object Resolve { docsOnNewLine = false, customName = None, customDoc = None, - sorted = true + sorted = true, + nameMapper = mainargs.Util.nullNameMapper ) ) } diff --git a/mill b/mill index 0c5078a0f04..f280687f47b 100755 --- a/mill +++ b/mill @@ -53,7 +53,9 @@ if [ -z "$MILL_MAIN_CLI" ] ; then fi MILL_FIRST_ARG="" -if [ "$1" = "--bsp" ] || [ "$1" = "-i" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then + + # first arg is a long flag for "--interactive" or starts with "-i" +if [ "$1" = "--bsp" ] || [ "${1%"-i"*}" != "$1" ] || [ "$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 diff --git a/runner/src/mill/runner/MillCliConfig.scala b/runner/src/mill/runner/MillCliConfig.scala index e40edc72120..7f707ca512c 100644 --- a/runner/src/mill/runner/MillCliConfig.scala +++ b/runner/src/mill/runner/MillCliConfig.scala @@ -20,7 +20,6 @@ class MillCliConfig private ( ) val repl: Flag, @arg( - name = "no-server", doc = """Run Mill in single-process mode. In this mode, no Mill server will be started or used. Must be the first argument.""" @@ -37,13 +36,11 @@ class MillCliConfig private ( ) val ringBell: Flag, @arg( - name = "disable-ticker", doc = """Disable ticker log (e.g. short-lived prints of stages and progress bars).""" ) val disableTicker: Flag, @arg( - name = "enable-ticker", doc = """Enable ticker log (e.g. short-lived prints of stages and progress bars).""" ) @@ -52,7 +49,6 @@ class MillCliConfig private ( @arg(name = "debug", short = 'd', doc = "Show debug output on STDOUT") val debugLog: Flag, @arg( - name = "keep-going", short = 'k', doc = """Continue build, even after build failures.""" ) @@ -113,7 +109,6 @@ class MillCliConfig private ( ) val color: Option[Boolean], @arg( - name = "disable-callgraph-invalidation", doc = """Disable the fine-grained callgraph-based target invalidation in response to code changes, and instead fall back to the previous coarse-grained implementation @@ -121,7 +116,6 @@ class MillCliConfig private ( ) val disableCallgraphInvalidation: Flag, @arg( - name = "meta-level", doc = """Experimental: Select a meta-build level to run the given targets. Level 0 is the normal project, level 1 the first meta-build, and so on.