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

Make IClasspathContributor receive a Context.

This commit is contained in:
Cedric Beust 2016-02-10 21:42:29 +04:00
parent 0aaa49f25b
commit c2312a8854
4 changed files with 6 additions and 7 deletions

View file

@ -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>
}

View file

@ -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
}

View file

@ -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"))

View file

@ -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()