Skip to content
Merged
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
4 changes: 0 additions & 4 deletions libs/javalib/src/mill/javalib/JavaModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1067,10 +1067,6 @@ trait JavaModule
)
}

/**
* All classfiles and resources from upstream modules and dependencies
* necessary to run this module's code after compilation
*/
override def runClasspath: T[Seq[PathRef]] = Task {
super.runClasspath() ++
resolvedRunMvnDeps().toSeq ++
Expand Down
23 changes: 16 additions & 7 deletions libs/tabcomplete/src/mill/tabcomplete/TabCompleteModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private object TabCompleteModule extends ExternalModule {
// user can read it even if there's only one output
//
// https://stackoverflow.com/a/10130007/871202
case Seq((prefix, suffix)) if suffix.nonEmpty => Seq(prefix, prefix + ", " + suffix)
case Seq((prefix, suffix)) if suffix.nonEmpty => Seq(prefix, prefix + ": " + suffix)
case _ =>
for ((prefix, suffix) <- outputs) yield {
if (suffix.isEmpty) prefix
Expand Down Expand Up @@ -158,7 +158,7 @@ private object TabCompleteModule extends ExternalModule {

for (name <- nameField(arg) if !arg.doc.contains("Unsupported")) yield {
val suffix =
val docLine = firstLine(arg.doc.getOrElse(""))
val docLine = oneLine(arg.doc.getOrElse(""))
s"$typeStringPrefix$docLine"
(s"$prefix$name" -> suffix)
}
Expand Down Expand Up @@ -188,10 +188,19 @@ private object TabCompleteModule extends ExternalModule {
res.out.lines().map((_, ""))
}

def firstLine(s: String) = s match {
case "" => ""
case txt => txt.trim.linesIterator.next
}
def oneLine(txt: String) =
if (txt == "") ""
else {
txt
// People often forget trailing periods when there's a paragraph break (double newline), so
// mangle the text to add one if necessary so it looks good when combined onto a single line
.replaceAll("([a-zA-Z0-9_-])\n\n", "$1.\n\n")
.linesIterator
.map(_.trim)
// Drop empty lines, so if there are multiple paragraphs they get combined into one
.filter(_.nonEmpty)
.mkString(" ")
}

def getDocs(resolved: Resolved) = {
val allDocs: Iterable[String] = resolved match {
Expand All @@ -201,7 +210,7 @@ private object TabCompleteModule extends ExternalModule {
mill.util.Inspect.scaladocForTask(resolved.segments, resolved.cls)
}

firstLine(allDocs.mkString("\n"))
oneLine(allDocs.mkString("\n"))
}

def completeTasks(ev: Evaluator, index: Int, args: Seq[String]) = {
Expand Down
36 changes: 18 additions & 18 deletions libs/tabcomplete/test/src/mill/tabcomplete/TabCompleteTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ object TabCompleteTests extends TestSuite {
Set(
"-b Ring the bell once if the run completes successfully, twice if it fails.",
"-w Watch and re-run the given tasks when when their inputs change.",
"-i Run Mill in interactive mode, suitable for opening REPLs and taking user input.",
"-v Show mill version information and exit.",
"-k Continue build, even after build failures.",
"-D <k=v> Define (or overwrite) a system property.",
"-d Show debug output on STDOUT",
"-j <str> The number of parallel threads. It can be an integer e.g. `5`"
"-i Run Mill in interactive mode, suitable for opening REPLs and taking user input. Identical to --no-daemon. Must be the first argument.",
"-v Show mill version information and exit.",
"-j <str> The number of parallel threads. It can be an integer e.g. `5` meaning 5 threads, an expression e.g. `0.5C` meaning half as many threads as available cores, or `C-2` meaning 2 threads less than the number of cores. `1` disables parallelism and `0` (the default) uses 1 thread per core."
)
)
}
Expand Down Expand Up @@ -207,27 +207,27 @@ object TabCompleteTests extends TestSuite {
"--bsp Enable BSP server mode.",
"--debug Show debug output on STDOUT",
"--bell Ring the bell once if the run completes successfully, twice if it fails.",
"--color <bool> Toggle colored output; by default enabled only if the console is interactive",
"--interactive Run Mill in interactive mode, suitable for opening REPLs and taking user input. Identical to --no-daemon. Must be the first argument.",
"--no-build-lock Evaluate tasks / commands without acquiring an exclusive lock on the Mill output directory",
"--tab-complete Runs Mill in tab-completion mode",
"--import <str> Additional ivy dependencies to load into mill, e.g. plugins.",
"--jobs <str> The number of parallel threads. It can be an integer e.g. `5`",
"--bsp-install Create mill-bsp.json with Mill details under .bsp/",
"--no-daemon Run without a long-lived background daemon. Must be the first argument.",
"--help Print this help message and exit.",
"--allow-positional Allows command args to be passed positionally without `--arg` by default",
"--watch Watch and re-run the given tasks when when their inputs change.",
"--interactive Run Mill in interactive mode, suitable for opening REPLs and taking user input.",
"--no-wait-for-build-lock Do not wait for an exclusive lock on the Mill output directory to evaluate tasks / commands.",
"--help-advanced Print a internal or advanced command flags not intended for common usage",
"--ticker <bool> Enable or disable the ticker log, which provides information on running",
"--tab-complete Runs Mill in tab-completion mode",
"--meta-level <int> Select a meta-level to run the given tasks. Level 0 is the main project in `build.mill`,",
"--offline Try to work offline. This tells modules that support it to work offline and avoid any access to the internet. This is on a best effort basis. There are currently no guarantees that modules don't attempt to fetch remote sources.",
"--keep-going Continue build, even after build failures.",
"--define <k=v> Define (or overwrite) a system property.",
"--no-filesystem-checker Globally disables the checks that prevent you from reading and writing to disallowed files or folders during evaluation. Useful as an escape hatch in case you desperately need to do something unusual and you are willing to take the risk",
"--notify-watch <bool> Use filesystem based file watching instead of polling based one (defaults to true).",
"--bsp-watch <bool> Automatically reload the build when its sources change when running the BSP server (defaults to true).",
"--offline Try to work offline.",
"--no-filesystem-checker Globally disables the checks that prevent you from reading and writing to disallowed ",
"--bsp-install Create mill-bsp.json with Mill details under .bsp/",
"--meta-level <int> Select a meta-level to run the given tasks. Level 0 is the main project in `build.mill`, level 1 the first meta-build in `mill-build/build.mill`, etc.",
"--help Print this help message and exit.",
"--jobs <str> The number of parallel threads. It can be an integer e.g. `5` meaning 5 threads, an expression e.g. `0.5C` meaning half as many threads as available cores, or `C-2` meaning 2 threads less than the number of cores. `1` disables parallelism and `0` (the default) uses 1 thread per core.",
"--ticker <bool> Enable or disable the ticker log, which provides information on running tasks and where each log line came from",
"--color <bool> Toggle colored output; by default enabled only if the console is interactive and NO_COLOR environment variable is not set",
"--version Show mill version information and exit.",
"--task <str> The name or a query of the tasks(s) you want to build."
)
Expand All @@ -247,7 +247,7 @@ object TabCompleteTests extends TestSuite {
evalComplete("1", "./mill", "--jo", "1", "task1"),
Set(
"--jobs",
"--jobs, <str> The number of parallel threads. It can be an integer e.g. `5`"
"--jobs: <str> The number of parallel threads. It can be an integer e.g. `5` meaning 5 threads, an expression e.g. `0.5C` meaning half as many threads as available cores, or `C-2` meaning 2 threads less than the number of cores. `1` disables parallelism and `0` (the default) uses 1 thread per core."
)
)
}
Expand All @@ -256,7 +256,7 @@ object TabCompleteTests extends TestSuite {
evalComplete("1", "./mill", "--jobs", "1", "task1"),
Set(
"--jobs",
"--jobs, <str> The number of parallel threads. It can be an integer e.g. `5`"
"--jobs: <str> The number of parallel threads. It can be an integer e.g. `5` meaning 5 threads, an expression e.g. `0.5C` meaning half as many threads as available cores, or `C-2` meaning 2 threads less than the number of cores. `1` disables parallelism and `0` (the default) uses 1 thread per core."
)
)
}
Expand All @@ -265,7 +265,7 @@ object TabCompleteTests extends TestSuite {
evalComplete("1", "./mill", "--jobs"),
Set(
"--jobs",
"--jobs, <str> The number of parallel threads. It can be an integer e.g. `5`"
"--jobs: <str> The number of parallel threads. It can be an integer e.g. `5` meaning 5 threads, an expression e.g. `0.5C` meaning half as many threads as available cores, or `C-2` meaning 2 threads less than the number of cores. `1` disables parallelism and `0` (the default) uses 1 thread per core."
)
)
}
Expand All @@ -281,7 +281,7 @@ object TabCompleteTests extends TestSuite {
test {
assertGoldenLiteral(
evalComplete("2", "./mill", "task1", "--arg-b"),
Set("--arg-b-2", "--arg-b-2, <int> ")
Set("--arg-b-2", "--arg-b-2: <int> ")
)
}
}
Expand Down Expand Up @@ -309,7 +309,7 @@ object TabCompleteTests extends TestSuite {
test {
assertGoldenLiteral(
evalComplete("2", "./mill", "bar.task2", "--arg-b"),
Set("--arg-b-4", "--arg-b-4, <int> arg b 4 docs")
Set("--arg-b-4", "--arg-b-4: <int> arg b 4 docs")
)
}

Expand Down
Loading