mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Pull a few functions up in BaseJvmPlugin.
This commit is contained in:
parent
23360b6077
commit
86dec889f2
4 changed files with 4 additions and 8 deletions
|
@ -24,12 +24,14 @@ abstract class BaseJvmPlugin<T>(open val configActor: ConfigActor<T>) :
|
||||||
override fun accept(project: Project) = sourceFileCount(project) > 0
|
override fun accept(project: Project) = sourceFileCount(project) > 0
|
||||||
|
|
||||||
// IBuildConfigContributor
|
// IBuildConfigContributor
|
||||||
|
|
||||||
protected fun sourceFileCount(project: Project)
|
protected fun sourceFileCount(project: Project)
|
||||||
= KFiles.findSourceFiles(project.directory, project.sourceDirectories, sourceSuffixes()).size +
|
= KFiles.findSourceFiles(project.directory, project.sourceDirectories, sourceSuffixes()).size +
|
||||||
KFiles.findSourceFiles(project.directory, project.sourceDirectoriesTest, sourceSuffixes()).size
|
KFiles.findSourceFiles(project.directory, project.sourceDirectoriesTest, sourceSuffixes()).size
|
||||||
|
|
||||||
fun affinity(project: Project) = sourceFileCount(project)
|
fun affinity(project: Project) = sourceFileCount(project)
|
||||||
|
|
||||||
|
// IDocContributor
|
||||||
|
open fun affinity(project: Project, context: KobaltContext) = sourceFileCount(project)
|
||||||
|
|
||||||
abstract fun sourceSuffixes() : List<String>
|
abstract fun sourceSuffixes() : List<String>
|
||||||
}
|
}
|
|
@ -21,9 +21,6 @@ class GroovyPlugin @Inject constructor(val groovyCompiler: GroovyCompiler,
|
||||||
|
|
||||||
override fun sourceSuffixes() = SOURCE_SUFFIXES
|
override fun sourceSuffixes() = SOURCE_SUFFIXES
|
||||||
|
|
||||||
// IDocContributor
|
|
||||||
override fun affinity(project: Project, context: KobaltContext) = sourceFileCount(project)
|
|
||||||
|
|
||||||
// ICompilerFlagsContributor
|
// ICompilerFlagsContributor
|
||||||
override fun compilerFlagsFor(project: Project, context: KobaltContext, currentFlags: List<String>,
|
override fun compilerFlagsFor(project: Project, context: KobaltContext, currentFlags: List<String>,
|
||||||
suffixesBeingCompiled: List<String>) =
|
suffixesBeingCompiled: List<String>) =
|
||||||
|
|
|
@ -23,9 +23,6 @@ class JavaPlugin @Inject constructor(val javaCompiler: JavaCompiler, override va
|
||||||
|
|
||||||
override val name = PLUGIN_NAME
|
override val name = PLUGIN_NAME
|
||||||
|
|
||||||
// IDocContributor
|
|
||||||
override fun affinity(project: Project, context: KobaltContext) = sourceFileCount(project)
|
|
||||||
|
|
||||||
override fun sourceSuffixes() = SOURCE_SUFFIXES
|
override fun sourceSuffixes() = SOURCE_SUFFIXES
|
||||||
|
|
||||||
override fun generateDoc(project: Project, context: KobaltContext, info: CompilerActionInfo) : TaskResult {
|
override fun generateDoc(project: Project, context: KobaltContext, info: CompilerActionInfo) : TaskResult {
|
||||||
|
|
|
@ -33,7 +33,7 @@ class KotlinPlugin @Inject constructor(val executors: KobaltExecutors, val depen
|
||||||
|
|
||||||
// IDocContributor
|
// IDocContributor
|
||||||
override fun affinity(project: Project, context: KobaltContext) =
|
override fun affinity(project: Project, context: KobaltContext) =
|
||||||
if (project.sourceDirectories.any { it.contains("kotlin") }) 2 else 0
|
if (sourceFileCount(project) > 0) 2 else 0
|
||||||
|
|
||||||
override fun generateDoc(project: Project, context: KobaltContext, info: CompilerActionInfo) : TaskResult {
|
override fun generateDoc(project: Project, context: KobaltContext, info: CompilerActionInfo) : TaskResult {
|
||||||
return TaskResult()
|
return TaskResult()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue