mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Fix compiling messages.
This commit is contained in:
parent
2e58afa75c
commit
c6f9c88d2a
3 changed files with 8 additions and 7 deletions
|
@ -2,9 +2,10 @@ package com.beust.kobalt.misc
|
||||||
|
|
||||||
import com.google.common.base.CharMatcher
|
import com.google.common.base.CharMatcher
|
||||||
|
|
||||||
public class Strings {
|
class Strings {
|
||||||
companion object {
|
companion object {
|
||||||
fun pluralize(s: String, n: Int) = s + (if (n != 1) "s" else "")
|
fun pluralize(s: String, n: Int) = s + (if (n != 1) "s" else "")
|
||||||
|
fun pluralizeAll(s: String, n: Int) = "$n " + pluralize(s, n)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +13,6 @@ public class Strings {
|
||||||
/**
|
/**
|
||||||
* @Return the number of times the given character occurs in the string
|
* @Return the number of times the given character occurs in the string
|
||||||
*/
|
*/
|
||||||
public infix fun String.countChar(c: Char) : Int {
|
infix fun String.countChar(c: Char) : Int {
|
||||||
return CharMatcher.`is`(c).countIn(this)
|
return CharMatcher.`is`(c).countIn(this)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.beust.kobalt.api.Project
|
||||||
import com.beust.kobalt.internal.ICompilerAction
|
import com.beust.kobalt.internal.ICompilerAction
|
||||||
import com.beust.kobalt.internal.JvmCompiler
|
import com.beust.kobalt.internal.JvmCompiler
|
||||||
import com.beust.kobalt.misc.KFiles
|
import com.beust.kobalt.misc.KFiles
|
||||||
|
import com.beust.kobalt.misc.Strings
|
||||||
import com.beust.kobalt.misc.log
|
import com.beust.kobalt.misc.log
|
||||||
import com.beust.kobalt.misc.warn
|
import com.beust.kobalt.misc.warn
|
||||||
import com.google.inject.Inject
|
import com.google.inject.Inject
|
||||||
|
@ -52,7 +53,7 @@ class JavaCompiler @Inject constructor(val jvmCompiler: JvmCompiler) {
|
||||||
command = "javac " + allArgs.joinToString(" ") + " " + info.sourceFiles.joinToString(" ")
|
command = "javac " + allArgs.joinToString(" ") + " " + info.sourceFiles.joinToString(" ")
|
||||||
log(2, "Launching\n$command")
|
log(2, "Launching\n$command")
|
||||||
|
|
||||||
log(1, " Java compiling ${info.sourceFiles.size} files")
|
log(1, " Java compiling " + Strings.pluralizeAll("file", info.sourceFiles.size))
|
||||||
val result = task.call()
|
val result = task.call()
|
||||||
errorMessage = dc.diagnostics.joinToString("\n")
|
errorMessage = dc.diagnostics.joinToString("\n")
|
||||||
result
|
result
|
||||||
|
@ -72,7 +73,7 @@ class JavaCompiler @Inject constructor(val jvmCompiler: JvmCompiler) {
|
||||||
val pb = ProcessBuilder(allArgs)
|
val pb = ProcessBuilder(allArgs)
|
||||||
pb.inheritIO()
|
pb.inheritIO()
|
||||||
val line = allArgs.joinToString(" ")
|
val line = allArgs.joinToString(" ")
|
||||||
log(1, " Java compiling ${info.sourceFiles.size} files")
|
log(1, " Java compiling " + Strings.pluralizeAll("file", info.sourceFiles.size))
|
||||||
log(2, " Java compiling $line")
|
log(2, " Java compiling $line")
|
||||||
|
|
||||||
command = allArgs.joinToString(" ") + " " + info.sourceFiles.joinToString(" ")
|
command = allArgs.joinToString(" ") + " " + info.sourceFiles.joinToString(" ")
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.beust.kobalt.maven.DependencyManager
|
||||||
import com.beust.kobalt.maven.dependency.FileDependency
|
import com.beust.kobalt.maven.dependency.FileDependency
|
||||||
import com.beust.kobalt.misc.KFiles
|
import com.beust.kobalt.misc.KFiles
|
||||||
import com.beust.kobalt.misc.KobaltExecutors
|
import com.beust.kobalt.misc.KobaltExecutors
|
||||||
|
import com.beust.kobalt.misc.Strings
|
||||||
import com.beust.kobalt.misc.log
|
import com.beust.kobalt.misc.log
|
||||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||||
import org.jetbrains.kotlin.cli.common.ExitCode
|
import org.jetbrains.kotlin.cli.common.ExitCode
|
||||||
|
@ -38,9 +39,7 @@ class KotlinCompiler @Inject constructor(
|
||||||
|
|
||||||
val compilerAction = object: ICompilerAction {
|
val compilerAction = object: ICompilerAction {
|
||||||
override fun compile(projectName: String?, info: CompilerActionInfo): TaskResult {
|
override fun compile(projectName: String?, info: CompilerActionInfo): TaskResult {
|
||||||
if (info.sourceFiles.size > 1) {
|
log(1, " Kotlin compiling " + Strings.pluralizeAll("file", info.sourceFiles.size))
|
||||||
log(1, " Kotlin compiling ${info.sourceFiles.size} files")
|
|
||||||
}
|
|
||||||
val cp = compilerFirst(info.dependencies.map {it.jarFile.get()})
|
val cp = compilerFirst(info.dependencies.map {it.jarFile.get()})
|
||||||
val infoDir = info.directory
|
val infoDir = info.directory
|
||||||
val outputDir = if (infoDir != null) {
|
val outputDir = if (infoDir != null) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue