Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a new method for sending a coverage file to TeamCity #1195

Merged
merged 2 commits into from Apr 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/app/FakeLib/TeamCityHelper.fs
Expand Up @@ -12,12 +12,13 @@ let inline EncapsulateSpecialChars text =
|> replace "[" "|["
|> replace "]" "|]"

let scrub = RemoveLineBreaks >> EncapsulateSpecialChars

/// Send message to TeamCity
let sendToTeamCity format message =
if buildServer = TeamCity then
message
|> RemoveLineBreaks
|> EncapsulateSpecialChars
|> scrub
|> sprintf format
|> fun m -> postMessage (LogMessage(m, true))

Expand Down Expand Up @@ -77,8 +78,15 @@ let sendTeamCityPmdCpdImport path = sendToTeamCity "##teamcity[importData type='
let sendTeamCityDotNetDupFinderImport path = sendToTeamCity "##teamcity[importData type='DotNetDupFinder' path='%s']" path

/// Sends an dotcover, partcover, ncover or ncover3 results filename to TeamCity
[<System.Obsolete("This function does not specify the type of coverage tool used to generate the report. Use 'sendTeamCityDotNetCoverageImportForTool' instead")>]
let sendTeamCityDotNetCoverageImport path = sendToTeamCity "##teamcity[importData type='dotNetCoverage' path='%s']" path

type TeamCityDotNetCoverageTool = | DotCover | PartCover | NCover | NCover3 with override x.ToString() = match x with | DotCover -> "dotcover" | PartCover -> "partcover" | NCover -> "ncover" | NCover3 -> "ncover3"
/// Sends an dotcover, partcover, ncover or ncover3 results filename to TeamCity
let sendTeamCityDotNetCoverageImportForTool path (tool : TeamCityDotNetCoverageTool) =
sprintf "##teamcity[importData type='dotNetCoverage' tool='%s' path='%s']" (string tool |> scrub) (path |> scrub)
|> sendStrToTeamCity

/// Sends the full path to the dotCover home folder to override the bundled dotCover to TeamCity
let sendTeamCityDotCoverHome = sendToTeamCity "##teamcity[dotNetCoverage dotcover_home='%s']"

Expand Down