Skip to content

Commit

Permalink
Add process listener to analyze tools output
Browse files Browse the repository at this point in the history
Issue: #4
  • Loading branch information
dtretyakov committed Oct 27, 2016
1 parent f758fe3 commit c1f1778
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import jetbrains.buildServer.RunBuildException
import jetbrains.buildServer.agent.ToolCannotBeFoundException
import jetbrains.buildServer.agent.runner.*
import jetbrains.buildServer.dotnet.dotnet.*
import jetbrains.buildServer.dotnet.logger.DotnetLogger

/**
* Dotnet runner service.
Expand Down Expand Up @@ -53,4 +54,8 @@ class DotnetRunnerBuildService : BuildServiceAdapter() {
val environment = DotnetUtils.updateEnvironment(environmentVariables)
return SimpleProgramCommandLine(environment, workingDirectory.absolutePath, toolPath, arguments)
}

override fun getListeners(): List<ProcessListener> {
return listOf<ProcessListener>(DotnetLogger(logger))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* See LICENSE in the project root for license information.
*/

package jetbrains.buildServer.dotnet.logger

import jetbrains.buildServer.agent.BuildProgressLogger
import jetbrains.buildServer.agent.runner.ProcessListenerAdapter

/**
* .NET Core logger.
*/
open class DotnetLogger(private val myLogger: BuildProgressLogger) : ProcessListenerAdapter() {
override fun onStandardOutput(text: String) {
myLogger.message(text)
}

override fun onErrorOutput(text: String) {
myLogger.error(text)
}

override fun processFinished(exitCode: Int) {
super.processFinished(exitCode)
}
}

0 comments on commit c1f1778

Please sign in to comment.