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:
parent
ab43d5c994
commit
45cd429d08
6 changed files with 23 additions and 38 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
package com.beust.kobalt.plugin
|
||||
|
||||
import com.beust.kobalt.TaskResult
|
||||
import com.beust.kobalt.api.CompilerActionInfo
|
||||
import com.beust.kobalt.api.ICompilerDescription
|
||||
import com.beust.kobalt.api.KobaltContext
|
||||
import com.beust.kobalt.api.Project
|
||||
import com.beust.kobalt.misc.warn
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,11 @@
|
|||
package com.beust.kobalt.plugin.groovy
|
||||
|
||||
import com.beust.kobalt.TaskResult
|
||||
import com.beust.kobalt.api.CompilerActionInfo
|
||||
import com.beust.kobalt.api.ICompilerContributor
|
||||
import com.beust.kobalt.api.KobaltContext
|
||||
import com.beust.kobalt.api.Project
|
||||
import com.beust.kobalt.api.*
|
||||
import com.beust.kobalt.maven.DependencyManager
|
||||
import com.beust.kobalt.misc.KFiles
|
||||
import com.beust.kobalt.misc.Strings
|
||||
import com.beust.kobalt.misc.log
|
||||
import com.beust.kobalt.plugin.CompilerDescription
|
||||
import com.beust.kobalt.plugin.ICompiler
|
||||
import com.google.inject.Inject
|
||||
import com.google.inject.Singleton
|
||||
import java.io.File
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.beust.kobalt.JavaInfo
|
|||
import com.beust.kobalt.SystemProperties
|
||||
import com.beust.kobalt.TaskResult
|
||||
import com.beust.kobalt.api.CompilerActionInfo
|
||||
import com.beust.kobalt.api.ICompiler
|
||||
import com.beust.kobalt.api.KobaltContext
|
||||
import com.beust.kobalt.api.Project
|
||||
import com.beust.kobalt.internal.ICompilerAction
|
||||
|
@ -12,7 +13,6 @@ import com.beust.kobalt.misc.KFiles
|
|||
import com.beust.kobalt.misc.Strings
|
||||
import com.beust.kobalt.misc.log
|
||||
import com.beust.kobalt.misc.warn
|
||||
import com.beust.kobalt.plugin.ICompiler
|
||||
import com.google.inject.Inject
|
||||
import com.google.inject.Singleton
|
||||
import java.io.File
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.beust.kobalt.internal.BaseJvmPlugin
|
|||
import com.beust.kobalt.internal.JvmCompilerPlugin
|
||||
import com.beust.kobalt.misc.KFiles
|
||||
import com.beust.kobalt.misc.warn
|
||||
import com.beust.kobalt.plugin.CompilerDescription
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
|
|
@ -14,8 +14,6 @@ import com.beust.kobalt.misc.KFiles
|
|||
import com.beust.kobalt.misc.KobaltExecutors
|
||||
import com.beust.kobalt.misc.log
|
||||
import com.beust.kobalt.misc.warn
|
||||
import com.beust.kobalt.plugin.CompilerDescription
|
||||
import com.beust.kobalt.plugin.ICompiler
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue