1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Implemented --log 0

This commit is contained in:
Erik C. Thauvin 2017-03-28 17:16:11 -07:00
parent a6e8dbabb1
commit 014802e272
18 changed files with 76 additions and 103 deletions

View file

@ -43,7 +43,7 @@ class Args {
var listTemplates: Boolean = false var listTemplates: Boolean = false
@Parameter(names = arrayOf("--log"), description = "Define the log level " + @Parameter(names = arrayOf("--log"), description = "Define the log level " +
"(${Constants.LOG_DEFAULT_LEVEL}-${Constants.LOG_MAX_LEVEL})") "(${Constants.LOG_QUIET_LEVEL}-${Constants.LOG_MAX_LEVEL})")
var log: Int = Constants.LOG_DEFAULT_LEVEL var log: Int = Constants.LOG_DEFAULT_LEVEL
@Parameter(names = arrayOf("--logTags"), @Parameter(names = arrayOf("--logTags"),

View file

@ -3,6 +3,7 @@ package com.beust.kobalt
import com.beust.kobalt.misc.KFiles import com.beust.kobalt.misc.KFiles
object Constants { object Constants {
const val LOG_QUIET_LEVEL = 0
const val LOG_DEFAULT_LEVEL = 1 const val LOG_DEFAULT_LEVEL = 1
const val LOG_MAX_LEVEL = 3 const val LOG_MAX_LEVEL = 3
val BUILD_FILE_NAME = "Build.kt" val BUILD_FILE_NAME = "Build.kt"

View file

@ -3,13 +3,8 @@ package com.beust.kobalt
import com.beust.kobalt.api.IClasspathDependency import com.beust.kobalt.api.IClasspathDependency
import com.beust.kobalt.maven.LocalRepo import com.beust.kobalt.maven.LocalRepo
import com.beust.kobalt.maven.MavenId import com.beust.kobalt.maven.MavenId
import com.beust.kobalt.maven.aether.AetherDependency import com.beust.kobalt.maven.aether.*
import com.beust.kobalt.maven.aether.Filters import com.beust.kobalt.misc.*
import com.beust.kobalt.maven.aether.KobaltMavenResolver
import com.beust.kobalt.misc.KobaltExecutors
import com.beust.kobalt.misc.Node
import com.beust.kobalt.misc.kobaltLog
import com.beust.kobalt.misc.warn
import com.google.inject.Inject import com.google.inject.Inject
import org.eclipse.aether.artifact.DefaultArtifact import org.eclipse.aether.artifact.DefaultArtifact
import org.eclipse.aether.graph.DependencyNode import org.eclipse.aether.graph.DependencyNode
@ -74,7 +69,7 @@ class ResolveDependency @Inject constructor(
kobaltLog(1, AsciiArt.logBox(listOf(dep.id, url, dep.jarFile.get()).map { " $it" })) kobaltLog(1, AsciiArt.logBox(listOf(dep.id, url, dep.jarFile.get()).map { " $it" }))
display(root.children) display(root.children)
println("") kobaltLog(1, "")
} }
private fun display(nodes: List<Node<Dep>>) { private fun display(nodes: List<Node<Dep>>) {
@ -86,10 +81,12 @@ class ResolveDependency @Inject constructor(
else leftMiddle else leftMiddle
val indent = level * increment val indent = level * increment
for(i in 0..indent - 2) { for(i in 0..indent - 2) {
if (!KobaltLogger.isQuiet) {
if (i == 0 || ((i + 1) % increment == 0)) print(vertical) if (i == 0 || ((i + 1) % increment == 0)) print(vertical)
else print(" ") else print(" ")
} }
println(left + " " + dep.id + (if (dep.optional) " (optional)" else "")) }
kobaltLog(1, left + " " + dep.id + (if (dep.optional) " (optional)" else ""))
display(node.children) display(node.children)
} }
} }

View file

@ -1,12 +1,7 @@
package com.beust.kobalt.internal package com.beust.kobalt.internal
import com.beust.kobalt.AsciiTable import com.beust.kobalt.*
import com.beust.kobalt.KobaltException import com.beust.kobalt.misc.*
import com.beust.kobalt.TaskResult
import com.beust.kobalt.misc.NamedThreadFactory
import com.beust.kobalt.misc.error
import com.beust.kobalt.misc.kobaltLog
import com.beust.kobalt.misc.warn
import com.google.common.collect.HashMultimap import com.google.common.collect.HashMultimap
import java.lang.reflect.InvocationTargetException import java.lang.reflect.InvocationTargetException
import java.util.* import java.util.*
@ -303,14 +298,14 @@ class DynamicGraphExecutor<T>(val graph : DynamicGraph<T>, val factory: IThreadW
duration = " (" + ((hl.timestamp - start) / 1000) duration = " (" + ((hl.timestamp - start) / 1000)
.toInt().toString() + ")" .toInt().toString() + ")"
} else { } else {
println("DONOTCOMMIT") kobaltLog(1, "DONOTCOMMIT")
} }
} }
return hl.name + duration return hl.name + duration
} }
historyLog.forEach { hl -> historyLog.forEach { hl ->
println("CURRENT LOG: " + currentLog + " HISTORY LINE: " + hl) kobaltLog(1, "CURRENT LOG: " + currentLog + " HISTORY LINE: " + hl)
if (hl.start) { if (hl.start) {
projectStart[hl.name] = hl.timestamp projectStart[hl.name] = hl.timestamp
} }
@ -318,10 +313,10 @@ class DynamicGraphExecutor<T>(val graph : DynamicGraph<T>, val factory: IThreadW
currentLog = CompressedLog(hl.timestamp, hashMapOf(hl.threadId to hl.name)) currentLog = CompressedLog(hl.timestamp, hashMapOf(hl.threadId to hl.name))
} else currentLog?.let { cl -> } else currentLog?.let { cl ->
if (! hl.start || hl.timestamp - cl.timestamp < 1000) { if (! hl.start || hl.timestamp - cl.timestamp < 1000) {
println(" CURRENT LOG IS WITHING ONE SECOND: $hl") kobaltLog(1, " CURRENT LOG IS WITHING ONE SECOND: $hl")
cl.threadMap[hl.threadId] = toName(hl) cl.threadMap[hl.threadId] = toName(hl)
} else { } else {
println(" ADDING COMPRESSED LINE $cl") kobaltLog(1, " ADDING COMPRESSED LINE $cl")
compressed.add(cl) compressed.add(cl)
currentLog = CompressedLog(hl.timestamp, hashMapOf(hl.threadId to toName(hl))) currentLog = CompressedLog(hl.timestamp, hashMapOf(hl.threadId to toName(hl)))
} }
@ -378,7 +373,7 @@ class DynamicGraphExecutor<T>(val graph : DynamicGraph<T>, val factory: IThreadW
return table return table
} }
println(displayRegularLog(table).build()) kobaltLog(1, displayRegularLog(table).build())
} }
} }

View file

@ -2,9 +2,7 @@ package com.beust.kobalt.internal
import com.beust.kobalt.Args import com.beust.kobalt.Args
import com.beust.kobalt.KobaltException import com.beust.kobalt.KobaltException
import com.beust.kobalt.misc.kobaltError import com.beust.kobalt.misc.*
import com.beust.kobalt.misc.kobaltLog
import com.beust.kobalt.misc.kobaltWarn
import com.google.inject.Inject import com.google.inject.Inject
import com.google.inject.Singleton import com.google.inject.Singleton
import java.util.* import java.util.*
@ -69,7 +67,7 @@ class ParallelLogger @Inject constructor(val args: Args) : ILogger {
private fun debug(s: CharSequence) { private fun debug(s: CharSequence) {
if (args.log >= 3) { if (args.log >= 3) {
val time = System.currentTimeMillis() - startTime!! val time = System.currentTimeMillis() - startTime!!
println(" ### [$time] $s") kobaltLog(1, " ### [$time] $s")
} }
} }
@ -127,6 +125,6 @@ class ParallelLogger @Inject constructor(val args: Args) : ILogger {
runningProjects.forEach { runningProjects.forEach {
emptyProjectLog(it) emptyProjectLog(it)
} }
println("") kobaltLog(1, "")
} }
} }

View file

@ -2,19 +2,11 @@ package com.beust.kobalt.internal
import com.beust.kobalt.AsciiArt import com.beust.kobalt.AsciiArt
import com.beust.kobalt.TestConfig import com.beust.kobalt.TestConfig
import com.beust.kobalt.api.IClasspathDependency import com.beust.kobalt.api.*
import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project
import com.beust.kobalt.maven.aether.AetherDependency import com.beust.kobalt.maven.aether.AetherDependency
import com.beust.kobalt.misc.KFiles import com.beust.kobalt.misc.*
import com.beust.kobalt.misc.StringVersion
import com.beust.kobalt.misc.runCommand
import com.beust.kobalt.misc.warn
import org.testng.remote.RemoteArgs import org.testng.remote.RemoteArgs
import org.testng.remote.strprotocol.JsonMessageSender import org.testng.remote.strprotocol.*
import org.testng.remote.strprotocol.MessageHelper
import org.testng.remote.strprotocol.MessageHub
import org.testng.remote.strprotocol.TestResultMessage
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
@ -124,8 +116,8 @@ class TestNgRunner : GenericTestRunner() {
try { try {
var message = mh.receiveMessage() var message = mh.receiveMessage()
println("") kobaltLog(1, "")
println(green("PASSED") + " | " + red("FAILED") + " | " + yellow("SKIPPED")) kobaltLog(1, green("PASSED") + " | " + red("FAILED") + " | " + yellow("SKIPPED"))
while (message != null) { while (message != null) {
message = mh.receiveMessage() message = mh.receiveMessage()
if (message is TestResultMessage) { if (message is TestResultMessage) {
@ -136,17 +128,19 @@ class TestNgRunner : GenericTestRunner() {
MessageHelper.SKIPPED_TEST -> skipped.add(message.name) MessageHelper.SKIPPED_TEST -> skipped.add(message.name)
} }
} }
if (!KobaltLogger.isQuiet) {
print("\r " + d(passed.size, AsciiArt.GREEN) print("\r " + d(passed.size, AsciiArt.GREEN)
+ " | " + d(failed.size, AsciiArt.RED) + " | " + d(failed.size, AsciiArt.RED)
+ " | " + d(skipped.size, AsciiArt.YELLOW)) + " | " + d(skipped.size, AsciiArt.YELLOW))
} }
} catch(ex: IOException) {
println("Exception: ${ex.message}")
} }
println("\nPassed: " + passed.size + ", Failed: " + failed.size + ", Skipped: " + skipped.size) } catch(ex: IOException) {
kobaltLog(1, "Exception: ${ex.message}")
}
kobaltLog(1, "\nPassed: " + passed.size + ", Failed: " + failed.size + ", Skipped: " + skipped.size)
failed.forEach { failed.forEach {
val top = it.stackTrace.substring(0, it.stackTrace.indexOf("\n")) val top = it.stackTrace.substring(0, it.stackTrace.indexOf("\n"))
println(" " + it.cls + "." + it.method + "\n " + top) kobaltLog(1, " " + it.cls + "." + it.method + "\n " + top)
} }
return failed.isEmpty() && skipped.isEmpty() return failed.isEmpty() && skipped.isEmpty()
} }
@ -201,10 +195,12 @@ fun main(args: Array<String>) {
fun d(n: Int, color: String) fun d(n: Int, color: String)
= AsciiArt.wrap(String.format("%4d", n), color) = AsciiArt.wrap(String.format("%4d", n), color)
if (!KobaltLogger.isQuiet) {
println("PASSED | FAILED | SKIPPED") println("PASSED | FAILED | SKIPPED")
repeat(20) { i -> repeat(20) { i ->
print("\r " + d(i, AsciiArt.GREEN) + " | " + d(i * 2, AsciiArt.RED) + " | " + d(i, AsciiArt.YELLOW)) print("\r " + d(i, AsciiArt.GREEN) + " | " + d(i * 2, AsciiArt.RED) + " | " + d(i, AsciiArt.YELLOW))
Thread.sleep(500) Thread.sleep(500)
} }
println("") println("")
}
} }

View file

@ -1,6 +1,7 @@
package com.beust.kobalt.internal.build package com.beust.kobalt.internal.build
import com.beust.kobalt.homeDir import com.beust.kobalt.homeDir
import com.beust.kobalt.misc.kobaltLog
import java.io.File import java.io.File
import java.nio.file.* import java.nio.file.*
import java.nio.file.attribute.BasicFileAttributes import java.nio.file.attribute.BasicFileAttributes
@ -37,7 +38,7 @@ class BuildSources(val file: File) : IBuildSources {
override fun preVisitDirectory(dir: Path?, attrs: BasicFileAttributes?): FileVisitResult { override fun preVisitDirectory(dir: Path?, attrs: BasicFileAttributes?): FileVisitResult {
if (dir != null) { if (dir != null) {
val path = dir.toFile() val path = dir.toFile()
println(path.name) kobaltLog(1, path.name)
if (path.name == "src" && path.parentFile.name == "kobalt") { if (path.name == "src" && path.parentFile.name == "kobalt") {
val sources = path.listFiles().filter { it.name.endsWith(".kt")} val sources = path.listFiles().filter { it.name.endsWith(".kt")}
result.addAll(sources) result.addAll(sources)

View file

@ -1,13 +1,12 @@
package com.beust.kobalt.maven package com.beust.kobalt.maven
import com.beust.kobalt.misc.kobaltLog
import org.w3c.dom.Element import org.w3c.dom.Element
import org.xml.sax.InputSource import org.xml.sax.InputSource
import java.io.File import java.io.File
import java.io.FileReader import java.io.FileReader
import javax.xml.bind.JAXBContext import javax.xml.bind.JAXBContext
import javax.xml.bind.annotation.XmlAnyElement import javax.xml.bind.annotation.*
import javax.xml.bind.annotation.XmlElement
import javax.xml.bind.annotation.XmlRootElement
import javax.xml.parsers.SAXParserFactory import javax.xml.parsers.SAXParserFactory
import javax.xml.transform.sax.SAXSource import javax.xml.transform.sax.SAXSource
@ -147,7 +146,7 @@ class Dependency {
private fun expandVariable(s: String, pom: Pom2) : String { private fun expandVariable(s: String, pom: Pom2) : String {
val variable = extractVariable(s) val variable = extractVariable(s)
if (variable != null) { if (variable != null) {
println("Expanding variable $variable") kobaltLog(2, "Expanding variable $variable")
val value = pom.pomProject.propertyValue(variable) val value = pom.pomProject.propertyValue(variable)
return s return s
} else { } else {

View file

@ -1,9 +1,7 @@
package com.beust.kobalt.misc package com.beust.kobalt.misc
import java.io.File import java.io.File
import java.nio.file.Files import java.nio.file.*
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
class Io(val dryRun: Boolean = false) { class Io(val dryRun: Boolean = false) {
fun mkdirs(dir: String) { fun mkdirs(dir: String) {
@ -47,8 +45,8 @@ class Io(val dryRun: Boolean = false) {
if (! dryRun) { if (! dryRun) {
KFiles.copyRecursively(from, toDir) KFiles.copyRecursively(from, toDir)
require(from.exists(), { -> "$from should exist" }) require(from.exists(), { -> "$from should exist" })
require(from.isDirectory, { -> println("$from should be a directory")}) require(from.isDirectory, { -> kobaltLog(1, "$from should be a directory")})
require(toDir.isDirectory, { -> println("$toDir should be a file")}) require(toDir.isDirectory, { -> kobaltLog(1, "$toDir should be a file")})
} }
} }
@ -58,7 +56,7 @@ class Io(val dryRun: Boolean = false) {
private fun rmDir(dir: File, keep: (File) -> Boolean, indent : String) { private fun rmDir(dir: File, keep: (File) -> Boolean, indent : String) {
kobaltLog("rm -rf $dir") kobaltLog("rm -rf $dir")
require(dir.isDirectory, { -> println("$dir should be a directory")}) require(dir.isDirectory, { -> kobaltLog(1, "$dir should be a directory")})
dir.listFiles({ p0 -> ! keep(p0!!) }).forEach { dir.listFiles({ p0 -> ! keep(p0!!) }).forEach {
if (it.isDirectory) { if (it.isDirectory) {

View file

@ -1,8 +1,6 @@
package com.beust.kobalt.misc package com.beust.kobalt.misc
import com.beust.kobalt.Args import com.beust.kobalt.*
import com.beust.kobalt.AsciiArt
import com.beust.kobalt.KobaltException
import com.beust.kobalt.api.Kobalt import com.beust.kobalt.api.Kobalt
import com.beust.kobalt.maven.aether.Exceptions import com.beust.kobalt.maven.aether.Exceptions
import java.lang.Exception import java.lang.Exception
@ -10,7 +8,7 @@ import java.time.LocalDateTime
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
fun Any.log(level: Int, text: CharSequence, newLine : Boolean = true) { fun Any.log(level: Int, text: CharSequence, newLine : Boolean = true) {
if (level <= KobaltLogger.LOG_LEVEL) { if (level <= KobaltLogger.LOG_LEVEL && !KobaltLogger.isQuiet) {
KobaltLogger.logger.log(javaClass.simpleName, text, newLine) KobaltLogger.logger.log(javaClass.simpleName, text, newLine)
} }
} }
@ -25,11 +23,11 @@ fun Any.kobaltLog(tag: String, text: CharSequence, newLine : Boolean = true) {
} }
fun Any.logWrap(level: Int, text1: CharSequence, text2: CharSequence, function: () -> Unit) { fun Any.logWrap(level: Int, text1: CharSequence, text2: CharSequence, function: () -> Unit) {
if (level <= KobaltLogger.LOG_LEVEL) { if (level <= KobaltLogger.LOG_LEVEL && !KobaltLogger.isQuiet) {
KobaltLogger.logger.log(javaClass.simpleName, text1, newLine = false) KobaltLogger.logger.log(javaClass.simpleName, text1, newLine = false)
} }
function() function()
if (level <= KobaltLogger.LOG_LEVEL) { if (level <= KobaltLogger.LOG_LEVEL && !KobaltLogger.isQuiet) {
KobaltLogger.logger.log(javaClass.simpleName, text2, newLine = true) KobaltLogger.logger.log(javaClass.simpleName, text2, newLine = true)
} }
} }
@ -51,6 +49,8 @@ fun Any.error(text: CharSequence, e: Throwable? = null) {
object KobaltLogger { object KobaltLogger {
var LOG_LEVEL: Int = 1 var LOG_LEVEL: Int = 1
val isQuiet: Boolean get() = (LOG_LEVEL == Constants.LOG_QUIET_LEVEL)
val logger: Logger get() = val logger: Logger get() =
if (Kobalt.context != null) { if (Kobalt.context != null) {
Logger(Kobalt.context!!.args.dev) Logger(Kobalt.context!!.args.dev)

View file

@ -12,7 +12,7 @@ data class Node<T>(val value: T) {
} }
private fun p(s: String) { private fun p(s: String) {
println(s) kobaltLog(1, s)
} }
fun dump(r: T, children: List<Node<T>>, indent: Int) { fun dump(r: T, children: List<Node<T>>, indent: Int) {

View file

@ -36,6 +36,7 @@ public class Main {
private final Properties wrapperProperties = new Properties(); private final Properties wrapperProperties = new Properties();
private static int logQuietLevel = 0;
private static int logLevel = 1; private static int logLevel = 1;
private boolean noOverwrite = false; private boolean noOverwrite = false;
@ -487,7 +488,7 @@ public class Main {
} }
private static void p(int level, String s, boolean newLine) { private static void p(int level, String s, boolean newLine) {
if (level <= logLevel) { if (level != logQuietLevel && level <= logLevel) {
if (newLine) System.out.println(s); if (newLine) System.out.println(s);
else System.out.print(s); else System.out.print(s);
} }

View file

@ -27,7 +27,7 @@ private fun parseArgs(argv: Array<String>): Main.RunInfo {
val args = Args() val args = Args()
val result = JCommander(args) val result = JCommander(args)
result.parse(*argv) result.parse(*argv)
KobaltLogger.LOG_LEVEL = if (args.log < 0) { KobaltLogger.LOG_LEVEL = if (args.log < Constants.LOG_QUIET_LEVEL) {
Constants.LOG_DEFAULT_LEVEL Constants.LOG_DEFAULT_LEVEL
} else if (args.log > Constants.LOG_MAX_LEVEL) { } else if (args.log > Constants.LOG_MAX_LEVEL) {
Constants.LOG_MAX_LEVEL Constants.LOG_MAX_LEVEL
@ -112,7 +112,7 @@ private class Main @Inject constructor(
args.buildFile = p.absolutePath args.buildFile = p.absolutePath
if (!args.update) { if (!args.update) {
println(AsciiArt.banner + Kobalt.version + "\n") kobaltLog(1, AsciiArt.banner + Kobalt.version + "\n")
} }
return options.run(jc, args, argv) return options.run(jc, args, argv)

View file

@ -1,18 +1,14 @@
package com.beust.kobalt package com.beust.kobalt
import com.beust.jcommander.JCommander import com.beust.jcommander.JCommander
import com.beust.kobalt.api.Kobalt import com.beust.kobalt.api.*
import com.beust.kobalt.api.PluginTask import com.beust.kobalt.app.*
import com.beust.kobalt.api.Project
import com.beust.kobalt.app.ProjectFinder
import com.beust.kobalt.app.ProjectGenerator
import com.beust.kobalt.app.Templates
import com.beust.kobalt.app.UpdateKobalt
import com.beust.kobalt.app.remote.KobaltServer import com.beust.kobalt.app.remote.KobaltServer
import com.beust.kobalt.internal.PluginInfo import com.beust.kobalt.internal.PluginInfo
import com.beust.kobalt.internal.TaskManager import com.beust.kobalt.internal.TaskManager
import com.beust.kobalt.internal.build.BuildSources import com.beust.kobalt.internal.build.BuildSources
import com.beust.kobalt.misc.CheckVersions import com.beust.kobalt.misc.CheckVersions
import com.beust.kobalt.misc.kobaltLog
import com.beust.kobalt.wrapper.Main import com.beust.kobalt.wrapper.Main
import com.google.common.collect.HashMultimap import com.google.common.collect.HashMultimap
import com.google.inject.Inject import com.google.inject.Inject
@ -165,6 +161,6 @@ class Options @Inject constructor(
} }
} }
println(sb.toString()) kobaltLog(1, sb.toString())
} }
} }

View file

@ -4,16 +4,10 @@ import com.beust.kobalt.Args
import com.beust.kobalt.api.IClasspathDependency import com.beust.kobalt.api.IClasspathDependency
import com.beust.kobalt.api.Project import com.beust.kobalt.api.Project
import com.beust.kobalt.app.BuildFileCompiler import com.beust.kobalt.app.BuildFileCompiler
import com.beust.kobalt.internal.DynamicGraph import com.beust.kobalt.internal.*
import com.beust.kobalt.internal.GraphUtil
import com.beust.kobalt.internal.PluginInfo
import com.beust.kobalt.internal.TaskManager
import com.beust.kobalt.internal.build.BuildSources import com.beust.kobalt.internal.build.BuildSources
import com.beust.kobalt.maven.DependencyManager import com.beust.kobalt.maven.DependencyManager
import com.beust.kobalt.misc.KFiles import com.beust.kobalt.misc.*
import com.beust.kobalt.misc.KobaltExecutors
import com.beust.kobalt.misc.StringVersion
import com.beust.kobalt.misc.log
import com.google.inject.Inject import com.google.inject.Inject
import java.io.File import java.io.File
@ -170,7 +164,7 @@ class RemoteDependencyData @Inject constructor(val executors: KobaltExecutors, v
GraphUtil.displayGraph(it.compileDependencies, GraphUtil.displayGraph(it.compileDependencies,
{dd: DependencyData -> dd.children }, {dd: DependencyData -> dd.children },
{dd: DependencyData, indent: String -> {dd: DependencyData, indent: String ->
println(" " + indent + dd.id + " " + (if (! dd.isLatest) "(old)" else "")) log(1, " " + indent + dd.id + " " + (if (! dd.isLatest) "(old)" else ""))
}) })
} }

View file

@ -8,9 +8,7 @@ import com.beust.kobalt.archive.Archives
import com.beust.kobalt.internal.ActorUtils import com.beust.kobalt.internal.ActorUtils
import com.beust.kobalt.maven.DependencyManager import com.beust.kobalt.maven.DependencyManager
import com.beust.kobalt.maven.aether.Scope import com.beust.kobalt.maven.aether.Scope
import com.beust.kobalt.misc.KFiles import com.beust.kobalt.misc.*
import com.beust.kobalt.misc.KobaltExecutors
import com.beust.kobalt.misc.RunCommand
import com.beust.kobalt.plugin.packaging.PackageConfig import com.beust.kobalt.plugin.packaging.PackageConfig
import com.beust.kobalt.plugin.packaging.PackagingPlugin import com.beust.kobalt.plugin.packaging.PackagingPlugin
import com.google.inject.Inject import com.google.inject.Inject
@ -128,11 +126,11 @@ class ApplicationPlugin @Inject constructor(val configActor: ConfigActor<Applica
val args = contributorFlags + initialArgs + config.args val args = contributorFlags + initialArgs + config.args
val exitCode = RunCommand(java.absolutePath).run(args, val exitCode = RunCommand(java.absolutePath).run(args,
successCallback = { output: List<String> -> successCallback = { output: List<String> ->
println(output.joinToString("\n")) kobaltLog(1, output.joinToString("\n"))
}, },
errorCallback = { output: List<String> -> errorCallback = { output: List<String> ->
println("ERROR") kobaltLog(1, "ERROR")
println(output.joinToString("\n")) kobaltLog(1, output.joinToString("\n"))
} }
) )
return TaskResult(exitCode == 0) return TaskResult(exitCode == 0)

View file

@ -2,11 +2,10 @@ package com.beust.kobalt
import com.beust.kobalt.api.KobaltContext import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.app.MainModule import com.beust.kobalt.app.MainModule
import com.beust.kobalt.internal.ILogger import com.beust.kobalt.internal.*
import com.beust.kobalt.internal.KobaltSettings
import com.beust.kobalt.internal.KobaltSettingsXml
import com.beust.kobalt.maven.LocalRepo import com.beust.kobalt.maven.LocalRepo
import com.beust.kobalt.maven.aether.KobaltMavenResolver import com.beust.kobalt.maven.aether.KobaltMavenResolver
import com.beust.kobalt.misc.kobaltLog
import com.google.common.eventbus.EventBus import com.google.common.eventbus.EventBus
import com.google.inject.Provider import com.google.inject.Provider
import com.google.inject.Scopes import com.google.inject.Scopes
@ -32,7 +31,7 @@ class TestModule : MainModule(Args(), TEST_KOBALT_SETTINGS) {
resolver = testResolver resolver = testResolver
logger = object: ILogger { logger = object: ILogger {
override fun log(tag: CharSequence, level: Int, message: CharSequence, newLine: Boolean) { override fun log(tag: CharSequence, level: Int, message: CharSequence, newLine: Boolean) {
println("TestLog: [$tag $level] " + message) kobaltLog(1, "TestLog: [$tag $level] " + message)
} }
} }
} }

View file

@ -61,7 +61,7 @@ class DynamicGraphTest {
assertThat(transitiveClosure(3)).isEqualTo(listOf(3)) assertThat(transitiveClosure(3)).isEqualTo(listOf(3))
assertThat(transitiveClosure(6)).isEqualTo(listOf(6, 7)) assertThat(transitiveClosure(6)).isEqualTo(listOf(6, 7))
assertThat(transitiveClosure(7)).isEqualTo(listOf(7)) assertThat(transitiveClosure(7)).isEqualTo(listOf(7))
println("done") kobaltLog(1, "done")
} }
} }