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

Move the compiler interfaces in kobalt-plugin-api.

This commit is contained in:
Cedric Beust 2016-06-24 01:47:03 -08:00
parent ab43d5c994
commit 45cd429d08
6 changed files with 23 additions and 38 deletions

View file

@ -1,6 +1,7 @@
package com.beust.kobalt.api
import com.beust.kobalt.TaskResult
import com.beust.kobalt.misc.warn
interface ICompilerDescription : Comparable<ICompilerDescription> {
/**
@ -38,3 +39,23 @@ interface ICompilerDescription : Comparable<ICompilerDescription> {
interface ICompilerContributor : IProjectAffinity, IContributor {
fun compilersFor(project: Project, context: KobaltContext): List<ICompilerDescription>
}
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 {
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()
}
return result
}
}