mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Make IClasspathContributor receive a Context.
This commit is contained in:
parent
0aaa49f25b
commit
c2312a8854
4 changed files with 6 additions and 7 deletions
|
@ -1,12 +1,10 @@
|
|||
package com.beust.kobalt.api
|
||||
|
||||
import com.beust.kobalt.api.IClasspathDependency
|
||||
|
||||
/**
|
||||
* Plugins that export classpath entries need to implement this interface.
|
||||
*/
|
||||
interface IClasspathContributor : IContributor {
|
||||
fun entriesFor(project: Project?) : Collection<IClasspathDependency>
|
||||
fun classpathEntriesFor(project: Project?, context: KobaltContext) : Collection<IClasspathDependency>
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public class DependencyManager @Inject constructor(val executors: KobaltExecutor
|
|||
Collection<IClasspathDependency> {
|
||||
val result = hashSetOf<IClasspathDependency>()
|
||||
context.pluginInfo.classpathContributors.forEach { it: IClasspathContributor ->
|
||||
result.addAll(it.entriesFor(project))
|
||||
result.addAll(it.classpathEntriesFor(project, context))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
|
|
@ -92,8 +92,9 @@ class KotlinPlugin @Inject constructor(val executors: KobaltExecutors)
|
|||
return result
|
||||
}
|
||||
|
||||
// interface IClasspathContributor
|
||||
override fun entriesFor(project: Project?): List<IClasspathDependency> =
|
||||
// IClasspathContributor
|
||||
|
||||
override fun classpathEntriesFor(project: Project?, context: KobaltContext): List<IClasspathDependency> =
|
||||
if (project == null || accept(project)) {
|
||||
// All Kotlin projects automatically get the Kotlin runtime added to their class path
|
||||
listOf(getKotlinCompilerJar("kotlin-stdlib"), getKotlinCompilerJar("kotlin-runtime"))
|
||||
|
|
|
@ -42,7 +42,7 @@ class WarGenerator @Inject constructor(val dependencyManager: DependencyManager)
|
|||
|
||||
// Run through all the classpath contributors and add their contributions to the libs/ directory
|
||||
context.pluginInfo.classpathContributors.map {
|
||||
it.entriesFor(project)
|
||||
it.classpathEntriesFor(project, context)
|
||||
}.map { deps : Collection<IClasspathDependency> ->
|
||||
deps.forEach { dep ->
|
||||
val jar = dep.jarFile.get()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue