mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Introducing JarFinder.
This commit is contained in:
parent
db4df19671
commit
c8cdaeda27
3 changed files with 28 additions and 3 deletions
24
src/main/kotlin/com/beust/kobalt/api/JarFinder.kt
Normal file
24
src/main/kotlin/com/beust/kobalt/api/JarFinder.kt
Normal file
|
@ -0,0 +1,24 @@
|
|||
package com.beust.kobalt.api
|
||||
|
||||
import com.beust.kobalt.maven.DepFactory
|
||||
import com.beust.kobalt.misc.KobaltExecutors
|
||||
import java.io.File
|
||||
import java.util.concurrent.Future
|
||||
|
||||
public class JarFinder {
|
||||
companion object {
|
||||
/**
|
||||
* @return a Future for the jar file corresponding to this id.
|
||||
*/
|
||||
fun byIdFuture(id: String) : Future<File> {
|
||||
val executor = Kobalt.INJECTOR.getInstance(KobaltExecutors::class.java).miscExecutor
|
||||
val depFactory = Kobalt.INJECTOR.getInstance(DepFactory::class.java)
|
||||
return depFactory.create(id, executor).jarFile
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the jar file corresponding to this id. This might cause a network call.
|
||||
*/
|
||||
fun byId(id: String) = byIdFuture(id).get()
|
||||
}
|
||||
}
|
|
@ -37,9 +37,9 @@ public class AptPlugin @Inject constructor(val depFactory: DepFactory, val execu
|
|||
val result = arrayListOf<String>()
|
||||
configs[project.name]?.let { config ->
|
||||
aptDependencies.get(key = project.name)?.let { aptDependency ->
|
||||
val dependency = depFactory.create(aptDependency, executors.miscExecutor)
|
||||
val dependencyJarFile = JarFinder.byId(aptDependency)
|
||||
result.add("-processorpath")
|
||||
result.add(dependency.jarFile.get().absolutePath)
|
||||
result.add(dependencyJarFile.absolutePath)
|
||||
val generated = KFiles.joinAndMakeDir(project.directory, project.buildDirectory!!, config.outputDir)
|
||||
result.add("-s")
|
||||
result.add(generated)
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.beust.kobalt.JavaInfo
|
|||
import com.beust.kobalt.SystemProperties
|
||||
import com.beust.kobalt.TaskResult
|
||||
import com.beust.kobalt.api.ConfigPlugin
|
||||
import com.beust.kobalt.api.JarFinder
|
||||
import com.beust.kobalt.api.Kobalt
|
||||
import com.beust.kobalt.api.Project
|
||||
import com.beust.kobalt.api.annotation.Directive
|
||||
|
@ -40,7 +41,7 @@ class DokkaPlugin @Inject constructor(val depFactory: DepFactory) : ConfigPlugin
|
|||
val classpathString = (classpath.map { it.jarFile.get().absolutePath } +
|
||||
listOf(buildDir))
|
||||
.joinToString(File.pathSeparator)
|
||||
val dokkaJar = depFactory.create(DOKKA_ID, context.executors.miscExecutor).jarFile.get().absolutePath
|
||||
val dokkaJar = JarFinder.byId(DOKKA_ID)
|
||||
if (config != null) {
|
||||
val args = listOf(
|
||||
"-classpath", classpathString,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue