mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Add "name" property to CompilerDescription.
This commit is contained in:
parent
1cea9e7fad
commit
94e2e7081c
4 changed files with 18 additions and 18 deletions
|
@ -4,6 +4,11 @@ import com.beust.kobalt.TaskResult
|
|||
import com.beust.kobalt.misc.warn
|
||||
|
||||
interface ICompilerDescription : Comparable<ICompilerDescription> {
|
||||
/**
|
||||
* The name of the language compiled by this compiler.
|
||||
*/
|
||||
val name: String
|
||||
|
||||
/**
|
||||
* The suffixes handled by this compiler (without the dot, e.g. "java" or "kt").
|
||||
*/
|
||||
|
@ -44,17 +49,17 @@ interface ICompiler {
|
|||
fun compile(project: Project, context: KobaltContext, info: CompilerActionInfo): TaskResult
|
||||
}
|
||||
|
||||
class CompilerDescription(override val sourceSuffixes: List<String>, override val sourceDirectory: String,
|
||||
val compiler: ICompiler, override val priority: Int = ICompilerDescription.DEFAULT_PRIORITY)
|
||||
: ICompilerDescription {
|
||||
class CompilerDescription(override val name: String, override val sourceDirectory: String,
|
||||
override val sourceSuffixes: List<String>, val compiler: ICompiler,
|
||||
override val priority: Int = ICompilerDescription.DEFAULT_PRIORITY) : ICompilerDescription {
|
||||
override fun compile(project: Project, context: KobaltContext, info: CompilerActionInfo): TaskResult {
|
||||
val result =
|
||||
if (info.sourceFiles.size > 0) {
|
||||
compiler.compile(project, context, info)
|
||||
} else {
|
||||
warn("Couldn't find any source files to compile")
|
||||
TaskResult()
|
||||
}
|
||||
if (info.sourceFiles.size > 0) {
|
||||
compiler.compile(project, context, info)
|
||||
} else {
|
||||
warn("Couldn't find any source files to compile")
|
||||
TaskResult()
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class CompilerUtils @Inject constructor(val files: KFiles,
|
|||
failedResult = thisResult.failedResult
|
||||
}
|
||||
} else {
|
||||
log(2, "Compiler $compiler not running on ${project.name} since no source files were found")
|
||||
log(2, "${compiler.name} compiler not running on ${project.name} since no source files were found")
|
||||
}
|
||||
|
||||
return CompilerResult(results, failedResult)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue