mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Fix tests.
This commit is contained in:
parent
4db516a3fb
commit
a38889e94f
7 changed files with 22 additions and 14 deletions
|
@ -10,7 +10,8 @@ import com.google.inject.Inject
|
|||
* Plug-ins that are ITaskContributor can use this class to manage their collection of tasks and
|
||||
* implement the interface by delegating to an instance of this class (if injection permits).
|
||||
*/
|
||||
class TaskContributor @Inject constructor(val incrementalManager: IncrementalManager) : ITaskContributor {
|
||||
class TaskContributor @Inject constructor(val incrementalManagerFactory: IncrementalManager.IFactory)
|
||||
: ITaskContributor {
|
||||
val dynamicTasks = arrayListOf<DynamicTask>()
|
||||
|
||||
/**
|
||||
|
@ -50,7 +51,7 @@ class TaskContributor @Inject constructor(val incrementalManager: IncrementalMan
|
|||
runBefore = runBefore.map { variant.toTask(it) },
|
||||
runAfter = runAfter.map { variant.toTask(it) },
|
||||
alwaysRunAfter = alwaysRunAfter.map { variant.toTask(it) },
|
||||
closure = incrementalManager.toIncrementalTaskClosure(taskName, runTask, variant)))
|
||||
closure = incrementalManagerFactory.create().toIncrementalTaskClosure(taskName, runTask, variant)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.beust.kobalt.misc.log
|
|||
import com.google.gson.Gson
|
||||
import com.google.gson.GsonBuilder
|
||||
import com.google.inject.Inject
|
||||
import com.google.inject.Singleton
|
||||
import com.google.inject.assistedinject.Assisted
|
||||
import java.io.File
|
||||
import java.io.FileReader
|
||||
import java.nio.charset.Charset
|
||||
|
@ -27,9 +27,11 @@ class BuildInfo(var tasks: List<TaskInfo>)
|
|||
* Manage the file .kobalt/buildInfo.json, which keeps track of input and output checksums to manage
|
||||
* incremental builds.
|
||||
*/
|
||||
@Singleton
|
||||
class IncrementalManager @Inject constructor(val args: Args) {
|
||||
val fileName = IncrementalManager.BUILD_INFO_FILE
|
||||
class IncrementalManager @Inject constructor(val args: Args, @Assisted val fileName : String) {
|
||||
|
||||
interface IFactory {
|
||||
fun create(@Assisted fileName: String = IncrementalManager.BUILD_INFO_FILE) : IncrementalManager
|
||||
}
|
||||
|
||||
companion object {
|
||||
val BUILD_INFO_FILE = KFiles.joinDir(KFiles.KOBALT_DOT_DIR, "buildInfo.json")
|
||||
|
|
|
@ -21,7 +21,8 @@ import javax.inject.Inject
|
|||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
public class TaskManager @Inject constructor(val args: Args, val incrementalManager: IncrementalManager) {
|
||||
public class TaskManager @Inject constructor(val args: Args,
|
||||
val incrementalManagerFactory: IncrementalManager.IFactory) {
|
||||
private val runBefore = TreeMultimap.create<String, String>()
|
||||
private val alwaysRunAfter = TreeMultimap.create<String, String>()
|
||||
|
||||
|
@ -280,7 +281,7 @@ public class TaskManager @Inject constructor(val args: Args, val incrementalMana
|
|||
*/
|
||||
fun toTaskAnnotation(method: Method, plugin: IPlugin, ta: IncrementalTask)
|
||||
= TaskAnnotation(method, plugin, ta.name, ta.description, ta.runBefore, ta.runAfter, ta.alwaysRunAfter,
|
||||
incrementalManager.toIncrementalTaskClosure(ta.name, { project ->
|
||||
incrementalManagerFactory.create().toIncrementalTaskClosure(ta.name, { project ->
|
||||
method.invoke(plugin, project) as IncrementalTaskInfo
|
||||
}))
|
||||
|
||||
|
|
|
@ -33,7 +33,9 @@ class DependencyManager @Inject constructor(val executors: KobaltExecutors, val
|
|||
}
|
||||
return createFile(path.path)
|
||||
} else {
|
||||
return createMaven(id)
|
||||
// Convert to a Kobalt id first (so that if it doesn't have a version, it gets translated to
|
||||
// an Aether ranged id "[0,)")
|
||||
return createMaven(MavenId.create(id).toId)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue