mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Display the javac command.
This commit is contained in:
parent
4b122ac231
commit
1b4abd102c
1 changed files with 16 additions and 4 deletions
|
@ -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.log
|
||||||
import com.beust.kobalt.misc.warn
|
import com.beust.kobalt.misc.warn
|
||||||
import com.google.inject.Inject
|
import com.google.inject.Inject
|
||||||
import com.google.inject.Singleton
|
import com.google.inject.Singleton
|
||||||
|
@ -40,17 +41,28 @@ class JavaCompiler @Inject constructor(val jvmCompiler: JvmCompiler) {
|
||||||
val fileObjects = fileManager.getJavaFileObjectsFromFiles(info.sourceFiles.map { File(it) })
|
val fileObjects = fileManager.getJavaFileObjectsFromFiles(info.sourceFiles.map { File(it) })
|
||||||
val dc = DiagnosticCollector<JavaFileObject>()
|
val dc = DiagnosticCollector<JavaFileObject>()
|
||||||
val classes = arrayListOf<String>()
|
val classes = arrayListOf<String>()
|
||||||
val task = compiler.getTask(PrintWriter(System.out), fileManager, dc, allArgs, classes, fileObjects)
|
val writer = PrintWriter(System.out)
|
||||||
|
val task = compiler.getTask(writer, fileManager, dc, allArgs, classes, fileObjects)
|
||||||
|
|
||||||
|
val command = "javac " + allArgs.joinToString(" ") + " " + info.sourceFiles.joinToString(" ")
|
||||||
|
log(2, "Launching\n$command")
|
||||||
|
|
||||||
val result = task.call()
|
val result = task.call()
|
||||||
|
|
||||||
return if (result) TaskResult(true, "Compilation succeeded")
|
return if (result) {
|
||||||
else TaskResult(false, "There were errors")
|
TaskResult(true, "Compilation succeeded")
|
||||||
|
} else {
|
||||||
|
val message = "Compilation errors, command:\n$command" +
|
||||||
|
dc.diagnostics.joinToString("\n")
|
||||||
|
log(1, message)
|
||||||
|
TaskResult(false, message)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoke the given executale on the CompilerActionInfo.
|
* Invoke the given executable on the CompilerActionInfo.
|
||||||
*/
|
*/
|
||||||
private fun run(project: Project?, context: KobaltContext?, cai: CompilerActionInfo, executable: File): TaskResult {
|
private fun run(project: Project?, context: KobaltContext?, cai: CompilerActionInfo, executable: File): TaskResult {
|
||||||
return jvmCompiler.doCompile(project, context, compilerAction(executable), cai)
|
return jvmCompiler.doCompile(project, context, compilerAction(executable), cai)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue