mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Fix --tasks.
This commit is contained in:
parent
e93f4ba85f
commit
371929f754
1 changed files with 31 additions and 12 deletions
|
@ -3,6 +3,7 @@ package com.beust.kobalt
|
||||||
import com.beust.jcommander.JCommander
|
import com.beust.jcommander.JCommander
|
||||||
import com.beust.kobalt.api.IClasspathDependency
|
import com.beust.kobalt.api.IClasspathDependency
|
||||||
import com.beust.kobalt.api.Kobalt
|
import com.beust.kobalt.api.Kobalt
|
||||||
|
import com.beust.kobalt.api.PluginTask
|
||||||
import com.beust.kobalt.api.Project
|
import com.beust.kobalt.api.Project
|
||||||
import com.beust.kobalt.internal.PluginInfo
|
import com.beust.kobalt.internal.PluginInfo
|
||||||
import com.beust.kobalt.internal.TaskManager
|
import com.beust.kobalt.internal.TaskManager
|
||||||
|
@ -14,6 +15,7 @@ import com.beust.kobalt.maven.DepFactory
|
||||||
import com.beust.kobalt.maven.Http
|
import com.beust.kobalt.maven.Http
|
||||||
import com.beust.kobalt.maven.LocalRepo
|
import com.beust.kobalt.maven.LocalRepo
|
||||||
import com.beust.kobalt.misc.*
|
import com.beust.kobalt.misc.*
|
||||||
|
import com.google.common.collect.HashMultimap
|
||||||
import com.google.inject.Guice
|
import com.google.inject.Guice
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
|
@ -174,23 +176,16 @@ private class Main @Inject constructor(
|
||||||
// --resolve
|
// --resolve
|
||||||
resolveDependency.run(args.dependency as String)
|
resolveDependency.run(args.dependency as String)
|
||||||
} else if (args.tasks) {
|
} else if (args.tasks) {
|
||||||
//
|
// --tasks
|
||||||
// List of tasks
|
displayTasks()
|
||||||
//
|
|
||||||
val sb = StringBuffer("List of tasks\n")
|
|
||||||
taskManager.tasks.distinctBy {
|
|
||||||
it.name
|
|
||||||
}.forEach { task ->
|
|
||||||
sb.append("\n " + AsciiArt.horizontalDoubleLine +" ${task.plugin.name} "
|
|
||||||
+ AsciiArt.horizontalDoubleLine + "\n")
|
|
||||||
sb.append(" ${task.name}\t\t${task.doc}\n")
|
|
||||||
println(sb.toString())
|
|
||||||
}
|
|
||||||
} else if (args.checkVersions) {
|
} else if (args.checkVersions) {
|
||||||
|
// --checkVersions
|
||||||
checkVersions.run(allProjects)
|
checkVersions.run(allProjects)
|
||||||
} else if (args.download) {
|
} else if (args.download) {
|
||||||
|
// -- download
|
||||||
updateKobalt.downloadKobalt()
|
updateKobalt.downloadKobalt()
|
||||||
} else if (args.update) {
|
} else if (args.update) {
|
||||||
|
// --update
|
||||||
updateKobalt.updateKobalt()
|
updateKobalt.updateKobalt()
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
|
@ -206,6 +201,30 @@ private class Main @Inject constructor(
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun displayTasks() {
|
||||||
|
//
|
||||||
|
// List of tasks, --tasks
|
||||||
|
//
|
||||||
|
val tasksByPlugins = HashMultimap.create<String, PluginTask>()
|
||||||
|
taskManager.tasks.forEach {
|
||||||
|
tasksByPlugins.put(it.plugin.name, it)
|
||||||
|
}
|
||||||
|
val sb = StringBuffer("List of tasks\n")
|
||||||
|
tasksByPlugins.keySet().forEach { name ->
|
||||||
|
sb.append("\n " + AsciiArt.horizontalDoubleLine + " $name "
|
||||||
|
+ AsciiArt.horizontalDoubleLine + "\n")
|
||||||
|
tasksByPlugins[name].distinctBy {
|
||||||
|
it.name
|
||||||
|
}.sortedBy {
|
||||||
|
it.name
|
||||||
|
}.forEach { task ->
|
||||||
|
sb.append(" ${task.name}\t\t${task.doc}\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
println(sb.toString())
|
||||||
|
}
|
||||||
|
|
||||||
private fun runClasspathInterceptors(allProjects: List<Project>) {
|
private fun runClasspathInterceptors(allProjects: List<Project>) {
|
||||||
allProjects.forEach {
|
allProjects.forEach {
|
||||||
runClasspathInterceptors(it.compileDependencies)
|
runClasspathInterceptors(it.compileDependencies)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue