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

initial work on parallel logs.

This commit is contained in:
Cedric Beust 2016-08-07 17:31:50 -07:00
parent fa86f90e31
commit b5e9962d31
11 changed files with 169 additions and 29 deletions

View file

@ -4,6 +4,7 @@ import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project import com.beust.kobalt.api.Project
import com.beust.kobalt.archive.Archives import com.beust.kobalt.archive.Archives
import com.beust.kobalt.archive.Jar import com.beust.kobalt.archive.Jar
import com.beust.kobalt.internal.KobaltLog
import com.beust.kobalt.maven.DependencyManager import com.beust.kobalt.maven.DependencyManager
import com.beust.kobalt.maven.aether.Scope import com.beust.kobalt.maven.aether.Scope
import com.beust.kobalt.misc.* import com.beust.kobalt.misc.*
@ -121,7 +122,7 @@ class JarGenerator @Inject constructor(val dependencyManager: DependencyManager)
return result return result
} }
fun generateJar(project: Project, context: KobaltContext, jar: Jar) : File { fun generateJar(project: Project, context: KobaltContext, jar: Jar, kobaltLog: KobaltLog) : File {
val includedFiles = findIncludedFiles(project, context, jar) val includedFiles = findIncludedFiles(project, context, jar)
// //
@ -158,7 +159,7 @@ class JarGenerator @Inject constructor(val dependencyManager: DependencyManager)
val jarFactory = { os: OutputStream -> JarOutputStream(os, manifest) } val jarFactory = { os: OutputStream -> JarOutputStream(os, manifest) }
return Archives.generateArchive(project, context, jar.name, ".jar", includedFiles, return Archives.generateArchive(project, context, jar.name, ".jar", includedFiles,
true /* expandJarFiles */, jarFactory) true /* expandJarFiles */, jarFactory, kobaltLog)
} }
} }

View file

@ -5,12 +5,8 @@ import com.beust.kobalt.IFileSpec
import com.beust.kobalt.api.KobaltContext import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project import com.beust.kobalt.api.Project
import com.beust.kobalt.api.annotation.ExportedProjectProperty import com.beust.kobalt.api.annotation.ExportedProjectProperty
import com.beust.kobalt.misc.From import com.beust.kobalt.internal.KobaltLog
import com.beust.kobalt.misc.IncludedFile import com.beust.kobalt.misc.*
import com.beust.kobalt.misc.JarUtils
import com.beust.kobalt.misc.KFiles
import com.beust.kobalt.misc.log
import com.beust.kobalt.misc.To
import java.io.File import java.io.File
import java.io.FileOutputStream import java.io.FileOutputStream
import java.io.OutputStream import java.io.OutputStream
@ -32,7 +28,8 @@ class Archives {
suffix: String, suffix: String,
includedFiles: List<IncludedFile>, includedFiles: List<IncludedFile>,
expandJarFiles : Boolean = false, expandJarFiles : Boolean = false,
outputStreamFactory: (OutputStream) -> ZipOutputStream = DEFAULT_STREAM_FACTORY) : File { outputStreamFactory: (OutputStream) -> ZipOutputStream = DEFAULT_STREAM_FACTORY,
kobaltLog: KobaltLog) : File {
val fullArchiveName = context.variant.archiveName(project, archiveName, suffix) val fullArchiveName = context.variant.archiveName(project, archiveName, suffix)
val archiveDir = File(KFiles.libsDir(project)) val archiveDir = File(KFiles.libsDir(project))
val result = File(archiveDir.path, fullArchiveName) val result = File(archiveDir.path, fullArchiveName)
@ -42,7 +39,7 @@ class Archives {
outputStreamFactory(FileOutputStream(result)).use { outputStreamFactory(FileOutputStream(result)).use {
JarUtils.addFiles(project.directory, includedFiles, it, expandJarFiles) JarUtils.addFiles(project.directory, includedFiles, it, expandJarFiles)
log(2, text = "Added ${includedFiles.size} files to $result") log(2, text = "Added ${includedFiles.size} files to $result")
log(1, " Created $result") kobaltLog.log(project.name, 1, " Created $result")
} }
} catch (e: Throwable) { } catch (e: Throwable) {
// make sure that incomplete archive is deleted // make sure that incomplete archive is deleted

View file

@ -0,0 +1,125 @@
package com.beust.kobalt.internal
import com.beust.kobalt.Args
import com.beust.kobalt.KobaltException
import com.beust.kobalt.misc.kobaltError
import com.beust.kobalt.misc.kobaltLog
import com.beust.kobalt.misc.kobaltWarn
import com.google.inject.Inject
import com.google.inject.Singleton
import java.util.*
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ConcurrentLinkedQueue
/**
* This class manages logs for parallel builds. These logs come from multiple projects interwoven as
* they are being scheduled on different threads. This class maintains a "current" project which has
* its logs always displayed instantaneously while logs from other projects are being stored for later display.
* Once the current project is done, this class will catch up all the finished project logs and then
* pick the next current project to be displayed live.
*
* Yes, this code was pretty painful to write and I'm pretty sure it still have a few bugs left.
*/
@Singleton
class KobaltLog @Inject constructor(val args: Args) {
enum class Type { LOG, WARN, ERROR }
class LogLine(val name: String? = null, val level: Int, val message: String, val type: Type)
private val logLines = ConcurrentHashMap<String, ArrayList<LogLine>>()
private val runningProjects = ConcurrentLinkedQueue<String>()
var startTime: Long? = null
fun onProjectStarted(name: String) {
if (startTime == null) {
startTime = System.currentTimeMillis()
}
runningProjects.add(name)
logLines[name] = arrayListOf()
if (currentName == null) {
currentName = name
}
}
val stoppedProjects = ConcurrentHashMap<String, String>()
fun onProjectStopped(name: String) {
debug("onProjectStopped($name)")
stoppedProjects[name] = name
if (name == currentName && runningProjects.any()) {
emptyProjectLog(name)
var nextProject = runningProjects.peek()
while (nextProject != null && stoppedProjects.containsKey(nextProject)) {
val sp = runningProjects.remove()
emptyProjectLog(sp)
nextProject = runningProjects.peek()
}
currentName = nextProject
} else {
debug("Non current project $name stopping, not doing anything")
}
}
private fun debug(s: String) {
val time = System.currentTimeMillis() - startTime!!
println(" @@@ [$time] $s")
}
val LOCK = Any()
var currentName: String? = null
set(newName) {
field = newName
}
private fun displayLine(ll: LogLine) {
val time = System.currentTimeMillis() - startTime!!
val m = "### [$time] " + ll.message
when(ll.type) {
Type.LOG -> kobaltLog(ll.level, m)
Type.WARN -> kobaltWarn(m)
Type.ERROR -> kobaltError(m)
}
}
private fun emptyProjectLog(name: String?) {
val lines = logLines[name]
if (lines != null && lines.any()) {
debug("EMPTY PROJECT LOG FOR $name")
lines.forEach {
displayLine(it)
}
lines.clear()
debug("DONE EMPTY PROJECT LOG FOR $name")
// logLines.remove(name)
} else if (lines == null) {
throw KobaltException("Didn't call onStartProject() for $name")
}
}
private fun addLogLine(name: String, ll: LogLine) {
if (name != currentName) {
val list = logLines[name] ?: arrayListOf()
logLines[name] = list
list.add(ll)
} else {
emptyProjectLog(name)
displayLine(ll)
}
}
fun log(name: String, level: Int, message: String) {
if (args.parallel) {
addLogLine(name, LogLine(name, level, message, Type.LOG))
} else {
kobaltLog(level, message)
}
}
fun shutdown() {
runningProjects.forEach {
emptyProjectLog(it)
}
println("")
}
}

View file

@ -6,7 +6,6 @@ import com.beust.kobalt.api.ITask
import com.beust.kobalt.api.Kobalt import com.beust.kobalt.api.Kobalt
import com.beust.kobalt.api.Project import com.beust.kobalt.api.Project
import com.beust.kobalt.api.ProjectBuildStatus import com.beust.kobalt.api.ProjectBuildStatus
import com.beust.kobalt.misc.log
import com.google.common.collect.ListMultimap import com.google.common.collect.ListMultimap
import com.google.common.collect.TreeMultimap import com.google.common.collect.TreeMultimap
import java.util.concurrent.Callable import java.util.concurrent.Callable
@ -21,7 +20,8 @@ class ParallelProjectRunner(val tasksByNames: (Project) -> ListMultimap<String,
val dependsOn: TreeMultimap<String, String>, val dependsOn: TreeMultimap<String, String>,
val reverseDependsOn: TreeMultimap<String, String>, val runBefore: TreeMultimap<String, String>, val reverseDependsOn: TreeMultimap<String, String>, val runBefore: TreeMultimap<String, String>,
val runAfter: TreeMultimap<String, String>, val runAfter: TreeMultimap<String, String>,
val alwaysRunAfter: TreeMultimap<String, String>, val args: Args, val pluginInfo: PluginInfo) val alwaysRunAfter: TreeMultimap<String, String>, val args: Args, val pluginInfo: PluginInfo,
val kobaltLog: KobaltLog)
: BaseProjectRunner() { : BaseProjectRunner() {
override fun runProjects(taskInfos: List<TaskManager.TaskInfo>, projects: List<Project>) override fun runProjects(taskInfos: List<TaskManager.TaskInfo>, projects: List<Project>)
: TaskManager .RunTargetResult { : TaskManager .RunTargetResult {
@ -38,9 +38,11 @@ class ParallelProjectRunner(val tasksByNames: (Project) -> ListMultimap<String,
val tasksByNames = tasksByNames(project) val tasksByNames = tasksByNames(project)
val graph = createTaskGraph(project.name, taskInfos, tasksByNames, val graph = createTaskGraph(project.name, taskInfos, tasksByNames,
dependsOn, reverseDependsOn, runBefore, runAfter, alwaysRunAfter, dependsOn, reverseDependsOn, runBefore, runAfter, alwaysRunAfter,
{ task: ITask -> task.name }, ITask::name,
{ task: ITask -> task.plugin.accept(project) }) { task: ITask -> task.plugin.accept(project) })
var lastResult = TaskResult() var lastResult = TaskResult()
kobaltLog.onProjectStarted(project.name)
kobaltLog.log(project.name, 1, "Parallel build of ${project.name} starting")
while (graph.freeNodes.any()) { while (graph.freeNodes.any()) {
val toProcess = graph.freeNodes val toProcess = graph.freeNodes
toProcess.forEach { node -> toProcess.forEach { node ->
@ -48,7 +50,8 @@ class ParallelProjectRunner(val tasksByNames: (Project) -> ListMultimap<String,
tasks.forEach { task -> tasks.forEach { task ->
runBuildListenersForTask(project, context, task.name, start = true) runBuildListenersForTask(project, context, task.name, start = true)
log(1, "===== " + project.name + ":" + task.name) kobaltLog.log(project.name, 1, "===== " + project.name + ":" + task.name)
// log(1, "===== " + project.name + ":" + task.name)
val thisResult = if (dryRun) TaskResult2(true, null, task) else task.call() val thisResult = if (dryRun) TaskResult2(true, null, task) else task.call()
if (lastResult.success) { if (lastResult.success) {
lastResult = thisResult lastResult = thisResult
@ -60,9 +63,12 @@ class ParallelProjectRunner(val tasksByNames: (Project) -> ListMultimap<String,
graph.freeNodes.forEach { graph.removeNode(it) } graph.freeNodes.forEach { graph.removeNode(it) }
} }
kobaltLog.onProjectStopped(project.name)
runBuildListenersForProject(project, context, false, runBuildListenersForProject(project, context, false,
if (lastResult.success) ProjectBuildStatus.SUCCESS else ProjectBuildStatus.FAILED) if (lastResult.success) ProjectBuildStatus.SUCCESS else ProjectBuildStatus.FAILED)
kobaltLog.log(project.name, 1, "Parallel build of ${project.name} ending")
return TaskResult2(lastResult.success, lastResult.errorMessage, this) return TaskResult2(lastResult.success, lastResult.errorMessage, this)
} }
@ -96,6 +102,8 @@ class ParallelProjectRunner(val tasksByNames: (Project) -> ListMultimap<String,
val executor = DynamicGraphExecutor(projectGraph, factory, 5) val executor = DynamicGraphExecutor(projectGraph, factory, 5)
val taskResult = executor.run() val taskResult = executor.run()
kobaltLog.shutdown()
if (args.parallel) { if (args.parallel) {
executor.dumpHistory() executor.dumpHistory()
} }

View file

@ -17,7 +17,7 @@ import javax.inject.Singleton
@Singleton @Singleton
class TaskManager @Inject constructor(val args: Args, class TaskManager @Inject constructor(val args: Args,
val incrementalManagerFactory: IncrementalManager.IFactory, val incrementalManagerFactory: IncrementalManager.IFactory,
val pluginInfo: PluginInfo) { val pluginInfo: PluginInfo, val kobaltLog: KobaltLog) {
private val dependsOn = TreeMultimap.create<String, String>() private val dependsOn = TreeMultimap.create<String, String>()
private val reverseDependsOn = TreeMultimap.create<String, String>() private val reverseDependsOn = TreeMultimap.create<String, String>()
private val runBefore = TreeMultimap.create<String, String>() private val runBefore = TreeMultimap.create<String, String>()
@ -99,7 +99,7 @@ class TaskManager @Inject constructor(val args: Args,
val projectsToRun = findProjectsToRun(taskInfos, allProjects) val projectsToRun = findProjectsToRun(taskInfos, allProjects)
val projectRunner = val projectRunner =
if (args.parallel) ParallelProjectRunner({ p -> tasksByNames(p) }, dependsOn, if (args.parallel) ParallelProjectRunner({ p -> tasksByNames(p) }, dependsOn,
reverseDependsOn, runBefore, runAfter, alwaysRunAfter, args, pluginInfo) reverseDependsOn, runBefore, runAfter, alwaysRunAfter, args, pluginInfo, kobaltLog)
else SequentialProjectRunner({ p -> tasksByNames(p) }, dependsOn, else SequentialProjectRunner({ p -> tasksByNames(p) }, dependsOn,
reverseDependsOn, runBefore, runAfter, alwaysRunAfter, args, pluginInfo) reverseDependsOn, runBefore, runAfter, alwaysRunAfter, args, pluginInfo)
return projectRunner.runProjects(taskInfos, projectsToRun) return projectRunner.runProjects(taskInfos, projectsToRun)

View file

@ -12,6 +12,8 @@ fun Any.log(level: Int, text: CharSequence, newLine : Boolean = true) {
} }
} }
fun Any.kobaltLog(level: Int, text: CharSequence, newLine : Boolean = true) = log(level, text, newLine)
fun Any.logWrap(level: Int, text1: CharSequence, text2: CharSequence, function: () -> Unit) { fun Any.logWrap(level: Int, text1: CharSequence, text2: CharSequence, function: () -> Unit) {
if (level <= KobaltLogger.LOG_LEVEL) { if (level <= KobaltLogger.LOG_LEVEL) {
KobaltLogger.logger.log(javaClass.simpleName, text1, newLine = false) KobaltLogger.logger.log(javaClass.simpleName, text1, newLine = false)

View file

@ -9,6 +9,7 @@ import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project import com.beust.kobalt.api.Project
import com.beust.kobalt.internal.ICompilerAction import com.beust.kobalt.internal.ICompilerAction
import com.beust.kobalt.internal.JvmCompiler import com.beust.kobalt.internal.JvmCompiler
import com.beust.kobalt.internal.KobaltLog
import com.beust.kobalt.misc.KFiles import com.beust.kobalt.misc.KFiles
import com.beust.kobalt.misc.Strings import com.beust.kobalt.misc.Strings
import com.beust.kobalt.misc.log import com.beust.kobalt.misc.log
@ -22,7 +23,8 @@ import javax.tools.JavaFileObject
import javax.tools.ToolProvider import javax.tools.ToolProvider
@Singleton @Singleton
class JavaCompiler @Inject constructor(val jvmCompiler: JvmCompiler) : ICompiler { class JavaCompiler @Inject constructor(val jvmCompiler: JvmCompiler,
val kobaltLog: KobaltLog) : ICompiler {
fun compilerAction(executable: File) = object : ICompilerAction { fun compilerAction(executable: File) = object : ICompilerAction {
override fun compile(projectName: String?, info: CompilerActionInfo): TaskResult { override fun compile(projectName: String?, info: CompilerActionInfo): TaskResult {
if (info.sourceFiles.isEmpty()) { if (info.sourceFiles.isEmpty()) {
@ -58,7 +60,8 @@ class JavaCompiler @Inject constructor(val jvmCompiler: JvmCompiler) : ICompiler
command = "javac " + allArgs.joinToString(" ") + " " + info.sourceFiles.joinToString(" ") command = "javac " + allArgs.joinToString(" ") + " " + info.sourceFiles.joinToString(" ")
log(2, "Launching\n$command") log(2, "Launching\n$command")
log(1, " Java compiling " + Strings.pluralizeAll(info.sourceFiles.size, "file")) kobaltLog.log(projectName!!, 1,
" Java compiling " + Strings.pluralizeAll(info.sourceFiles.size, "file"))
val result = task.call() val result = task.call()
errorMessage = dc.diagnostics.joinToString("\n") errorMessage = dc.diagnostics.joinToString("\n")
result result

View file

@ -3,10 +3,7 @@ package com.beust.kobalt.plugin.kotlin
import com.beust.kobalt.KobaltException import com.beust.kobalt.KobaltException
import com.beust.kobalt.TaskResult import com.beust.kobalt.TaskResult
import com.beust.kobalt.api.* import com.beust.kobalt.api.*
import com.beust.kobalt.internal.ICompilerAction import com.beust.kobalt.internal.*
import com.beust.kobalt.internal.JvmCompiler
import com.beust.kobalt.internal.KobaltSettings
import com.beust.kobalt.internal.KotlinJarFiles
import com.beust.kobalt.kotlin.ParentLastClassLoader import com.beust.kobalt.kotlin.ParentLastClassLoader
import com.beust.kobalt.maven.DependencyManager import com.beust.kobalt.maven.DependencyManager
import com.beust.kobalt.maven.dependency.FileDependency import com.beust.kobalt.maven.dependency.FileDependency
@ -38,14 +35,16 @@ class KotlinCompiler @Inject constructor(
val executors: KobaltExecutors, val executors: KobaltExecutors,
val settings: KobaltSettings, val settings: KobaltSettings,
val jvmCompiler: JvmCompiler, val jvmCompiler: JvmCompiler,
val kotlinJarFiles: KotlinJarFiles) { val kotlinJarFiles: KotlinJarFiles,
val kobaltLog: KobaltLog) {
val compilerAction = object: ICompilerAction { val compilerAction = object: ICompilerAction {
override fun compile(projectName: String?, info: CompilerActionInfo): TaskResult { override fun compile(projectName: String?, info: CompilerActionInfo): TaskResult {
val version = settings.kobaltCompilerVersion val version = settings.kobaltCompilerVersion
if (! info.outputDir.path.endsWith("ript.jar")) { if (! info.outputDir.path.endsWith("ript.jar")) {
// Don't display the message if compiling Build.kt // Don't display the message if compiling Build.kt
log(1, " Kotlin $version compiling " + Strings.pluralizeAll(info.sourceFiles.size, "file")) kobaltLog.log(projectName!!, 1,
" Kotlin $version compiling " + Strings.pluralizeAll(info.sourceFiles.size, "file"))
} }
val cp = compilerFirst(info.dependencies.map { it.jarFile.get() }) val cp = compilerFirst(info.dependencies.map { it.jarFile.get() })
val infoDir = info.directory val infoDir = info.directory

View file

@ -9,6 +9,7 @@ import com.beust.kobalt.api.annotation.Task
import com.beust.kobalt.archive.* import com.beust.kobalt.archive.*
import com.beust.kobalt.internal.IncrementalManager import com.beust.kobalt.internal.IncrementalManager
import com.beust.kobalt.internal.JvmCompilerPlugin import com.beust.kobalt.internal.JvmCompilerPlugin
import com.beust.kobalt.internal.KobaltLog
import com.beust.kobalt.maven.DependencyManager import com.beust.kobalt.maven.DependencyManager
import com.beust.kobalt.maven.PomGenerator import com.beust.kobalt.maven.PomGenerator
import com.beust.kobalt.misc.KFiles import com.beust.kobalt.misc.KFiles
@ -23,6 +24,7 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
val incrementalManagerFactory: IncrementalManager.IFactory, val incrementalManagerFactory: IncrementalManager.IFactory,
val executors: KobaltExecutors, val jarGenerator: JarGenerator, val warGenerator: WarGenerator, val executors: KobaltExecutors, val jarGenerator: JarGenerator, val warGenerator: WarGenerator,
val zipGenerator: ZipGenerator, val taskContributor: TaskContributor, val zipGenerator: ZipGenerator, val taskContributor: TaskContributor,
val kobaltLog: KobaltLog,
val pomFactory: PomGenerator.IFactory, val configActor: ConfigActor<InstallConfig>) val pomFactory: PomGenerator.IFactory, val configActor: ConfigActor<InstallConfig>)
: BasePlugin(), ITaskContributor, IIncrementalAssemblyContributor, : BasePlugin(), ITaskContributor, IIncrementalAssemblyContributor,
IConfigActor<InstallConfig> by configActor { IConfigActor<InstallConfig> by configActor {
@ -73,7 +75,8 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
{ project -> { project ->
try { try {
packages.filter { it.project.name == project.name }.forEach { packageConfig -> packages.filter { it.project.name == project.name }.forEach { packageConfig ->
packageConfig.jars.forEach { jarGenerator.generateJar(packageConfig.project, context, it) } packageConfig.jars.forEach { jarGenerator.generateJar(packageConfig.project, context, it,
kobaltLog) }
packageConfig.wars.forEach { warGenerator.generateWar(packageConfig.project, context, it) } packageConfig.wars.forEach { warGenerator.generateWar(packageConfig.project, context, it) }
packageConfig.zips.forEach { zipGenerator.generateZip(packageConfig.project, context, it) } packageConfig.zips.forEach { zipGenerator.generateZip(packageConfig.project, context, it) }
if (packageConfig.generatePom) { if (packageConfig.generatePom) {

View file

@ -7,6 +7,7 @@ import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project import com.beust.kobalt.api.Project
import com.beust.kobalt.archive.Archives import com.beust.kobalt.archive.Archives
import com.beust.kobalt.archive.War import com.beust.kobalt.archive.War
import com.beust.kobalt.internal.KobaltLog
import com.beust.kobalt.maven.DependencyManager import com.beust.kobalt.maven.DependencyManager
import com.beust.kobalt.misc.From import com.beust.kobalt.misc.From
import com.beust.kobalt.misc.IncludedFile import com.beust.kobalt.misc.IncludedFile
@ -18,7 +19,7 @@ import java.io.OutputStream
import java.nio.file.Paths import java.nio.file.Paths
import java.util.jar.JarOutputStream import java.util.jar.JarOutputStream
class WarGenerator @Inject constructor(val dependencyManager: DependencyManager){ class WarGenerator @Inject constructor(val dependencyManager: DependencyManager, val kobaltLog: KobaltLog) {
companion object { companion object {
val WEB_INF = "WEB-INF" val WEB_INF = "WEB-INF"
@ -88,7 +89,7 @@ class WarGenerator @Inject constructor(val dependencyManager: DependencyManager)
val allFiles = findIncludedFiles(project, context, war) val allFiles = findIncludedFiles(project, context, war)
val jarFactory = { os: OutputStream -> JarOutputStream(os, manifest) } val jarFactory = { os: OutputStream -> JarOutputStream(os, manifest) }
return Archives.generateArchive(project, context, war.name, ".war", allFiles, return Archives.generateArchive(project, context, war.name, ".war", allFiles,
false /* don't expand jar files */, jarFactory) false /* don't expand jar files */, jarFactory, kobaltLog)
} }
} }

View file

@ -5,12 +5,13 @@ import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project import com.beust.kobalt.api.Project
import com.beust.kobalt.archive.Archives import com.beust.kobalt.archive.Archives
import com.beust.kobalt.archive.Zip import com.beust.kobalt.archive.Zip
import com.beust.kobalt.internal.KobaltLog
import com.beust.kobalt.maven.DependencyManager import com.beust.kobalt.maven.DependencyManager
import com.google.inject.Inject import com.google.inject.Inject
class ZipGenerator @Inject constructor(val dependencyManager: DependencyManager){ class ZipGenerator @Inject constructor(val dependencyManager: DependencyManager, val kobaltLog: KobaltLog) {
fun generateZip(project: Project, context: KobaltContext, zip: Zip) { fun generateZip(project: Project, context: KobaltContext, zip: Zip) {
val allFiles = JarGenerator.findIncludedFiles(project.directory, zip.includedFiles, zip.excludes) val allFiles = JarGenerator.findIncludedFiles(project.directory, zip.includedFiles, zip.excludes)
Archives.generateArchive(project, context, zip.name, ".zip", allFiles) Archives.generateArchive(project, context, zip.name, ".zip", allFiles, kobaltLog = kobaltLog)
} }
} }