mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Merge branch 'master' of github.com:cbeust/kobalt
This commit is contained in:
commit
2a545b6638
4 changed files with 22 additions and 19 deletions
|
@ -1 +1 @@
|
||||||
kobalt.version=1.0.72
|
kobalt.version=1.0.73
|
||||||
|
|
|
@ -242,9 +242,6 @@ class KFiles {
|
||||||
private fun isWindows() = System.getProperty("os.name").contains("Windows")
|
private fun isWindows() = System.getProperty("os.name").contains("Windows")
|
||||||
|
|
||||||
fun copy(from: Path?, to: Path?, option: StandardCopyOption = StandardCopyOption.REPLACE_EXISTING) {
|
fun copy(from: Path?, to: Path?, option: StandardCopyOption = StandardCopyOption.REPLACE_EXISTING) {
|
||||||
if (isWindows() && to!!.toFile().exists()) {
|
|
||||||
kobaltLog(2, "Windows detected, not overwriting $to")
|
|
||||||
} else {
|
|
||||||
try {
|
try {
|
||||||
if (from != null && to != null) {
|
if (from != null && to != null) {
|
||||||
if (!Files.exists(to) || Md5.toMd5(from.toFile()) != Md5.toMd5(to.toFile())) {
|
if (!Files.exists(to) || Md5.toMd5(from.toFile()) != Md5.toMd5(to.toFile())) {
|
||||||
|
@ -259,7 +256,6 @@ class KFiles {
|
||||||
kobaltLog(1, "Couldn't copy $from to $to: ${ex.message}")
|
kobaltLog(1, "Couldn't copy $from to $to: ${ex.message}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun copy(from: InputStream, to: OutputStream) {
|
fun copy(from: InputStream, to: OutputStream) {
|
||||||
var read = from.read()
|
var read = from.read()
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package com.beust.kobalt.misc
|
package com.beust.kobalt.misc
|
||||||
|
|
||||||
import com.beust.kobalt.*
|
import com.beust.kobalt.Args
|
||||||
|
import com.beust.kobalt.AsciiArt
|
||||||
|
import com.beust.kobalt.Constants
|
||||||
|
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
|
||||||
|
@ -75,7 +78,8 @@ class Logger(val dev: Boolean) {
|
||||||
|
|
||||||
fun error(tag: String, message: CharSequence, e: Throwable? = null) {
|
fun error(tag: String, message: CharSequence, e: Throwable? = null) {
|
||||||
val docUrl = if (e is KobaltException && e.docUrl != null) e.docUrl else null
|
val docUrl = if (e is KobaltException && e.docUrl != null) e.docUrl else null
|
||||||
val text = if (! message.isBlank()) message
|
val text =
|
||||||
|
if (message.isNotBlank()) message
|
||||||
else if (e != null && (! e.message.isNullOrBlank())) e.message
|
else if (e != null && (! e.message.isNullOrBlank())) e.message
|
||||||
else { e?.toString() }
|
else { e?.toString() }
|
||||||
val shortMessage = "***** E $text " + if (docUrl != null) " Documentation: $docUrl" else ""
|
val shortMessage = "***** E $text " + if (docUrl != null) " Documentation: $docUrl" else ""
|
||||||
|
@ -88,7 +92,10 @@ class Logger(val dev: Boolean) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun warn(tag: String, message: CharSequence, e: Throwable? = null) {
|
fun warn(tag: String, message: CharSequence, e: Throwable? = null) {
|
||||||
val fullMessage = "***** WARNING " + (e?.message ?: message)
|
val fullMessage = "***** WARNING " +
|
||||||
|
if (message.isNotBlank()) message
|
||||||
|
else if (e != null && (!e.message.isNullOrBlank())) e.message
|
||||||
|
else e?.toString()
|
||||||
println(AsciiArt.Companion.warnColor(getPattern("W", fullMessage, fullMessage, tag)))
|
println(AsciiArt.Companion.warnColor(getPattern("W", fullMessage, fullMessage, tag)))
|
||||||
if (KobaltLogger.LOG_LEVEL > 1 && e != null) {
|
if (KobaltLogger.LOG_LEVEL > 1 && e != null) {
|
||||||
Exceptions.printStackTrace(e)
|
Exceptions.printStackTrace(e)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
kobalt.version=1.0.72
|
kobalt.version=1.0.73
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue