mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Move a few methods in BaseJvmPlugin.
This commit is contained in:
parent
364c696a55
commit
c06e92b679
4 changed files with 14 additions and 26 deletions
|
@ -8,5 +8,5 @@ interface ISimpleAffinity<T> : IAffinity {
|
|||
* @return an integer indicating the affinity of your actor. The actor that returns
|
||||
* the highest affinity gets selected.
|
||||
*/
|
||||
fun affinity(arg: T) : Int
|
||||
fun affinity(project: T) : Int
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
package com.beust.kobalt.internal
|
||||
|
||||
import com.beust.kobalt.api.BasePlugin
|
||||
import com.beust.kobalt.api.ConfigActor
|
||||
import com.beust.kobalt.api.ICompilerFlagContributor
|
||||
import com.beust.kobalt.api.IConfigActor
|
||||
import com.beust.kobalt.api.*
|
||||
import com.beust.kobalt.misc.KFiles
|
||||
|
||||
/**
|
||||
* Base class for JVM language plug-ins.
|
||||
|
@ -23,4 +21,12 @@ abstract class BaseJvmPlugin<T>(open val configActor: ConfigActor<T>) :
|
|||
|
||||
override val flagPriority = FLAG_CONTRIBUTOR_PRIORITY
|
||||
|
||||
override fun accept(project: Project) = hasSourceFiles(project)
|
||||
|
||||
// IBuildConfigContributor
|
||||
|
||||
private fun hasSourceFiles(project: Project)
|
||||
= KFiles.findSourceFiles(project.directory, project.sourceDirectories, listOf("java")).size > 0
|
||||
|
||||
fun affinity(project: Project) = if (hasSourceFiles(project)) 1 else 0
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue