-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from RobertK66/initial-import
initial version transferred from local repos
- Loading branch information
Showing
31 changed files
with
1,240 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
############################################################################### | ||
# Set default behavior to automatically normalize line endings. | ||
############################################################################### | ||
* text=auto | ||
|
||
############################################################################### | ||
# Set default behavior for command prompt diff. | ||
# | ||
# This is need for earlier builds of msysgit that does not have it on by | ||
# default for csharp files. | ||
# Note: This is only used by command line | ||
############################################################################### | ||
#*.cs diff=csharp | ||
|
||
############################################################################### | ||
# Set the merge driver for project and solution files | ||
# | ||
# Merging from the command prompt will add diff markers to the files if there | ||
# are conflicts (Merging from VS is not affected by the settings below, in VS | ||
# the diff markers are never inserted). Diff markers may cause the following | ||
# file extensions to fail to load in VS. An alternative would be to treat | ||
# these files as binary and thus will always conflict and require user | ||
# intervention with every merge. To do so, just uncomment the entries below | ||
############################################################################### | ||
#*.sln merge=binary | ||
#*.csproj merge=binary | ||
#*.vbproj merge=binary | ||
#*.vcxproj merge=binary | ||
#*.vcproj merge=binary | ||
#*.dbproj merge=binary | ||
#*.fsproj merge=binary | ||
#*.lsproj merge=binary | ||
#*.wixproj merge=binary | ||
#*.modelproj merge=binary | ||
#*.sqlproj merge=binary | ||
#*.wwaproj merge=binary | ||
|
||
############################################################################### | ||
# behavior for image files | ||
# | ||
# image files are treated as binary by default. | ||
############################################################################### | ||
#*.jpg binary | ||
#*.png binary | ||
#*.gif binary | ||
|
||
############################################################################### | ||
# diff behavior for common document formats | ||
# | ||
# Convert binary document formats to text before diffing them. This feature | ||
# is only available from the command line. Turn it on by uncommenting the | ||
# entries below. | ||
############################################################################### | ||
#*.doc diff=astextplain | ||
#*.DOC diff=astextplain | ||
#*.docx diff=astextplain | ||
#*.DOCX diff=astextplain | ||
#*.dot diff=astextplain | ||
#*.DOT diff=astextplain | ||
#*.pdf diff=astextplain | ||
#*.PDF diff=astextplain | ||
#*.rtf diff=astextplain | ||
#*.RTF diff=astextplain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "build-results-enhancer", | ||
"homepage": "https://github.com/Microsoft/vso-extension-samples", | ||
"description": "", | ||
"main": "", | ||
"moduleType": [], | ||
"license": "MIT", | ||
"private": true, | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
], | ||
"dependencies": { | ||
"vss-web-extension-sdk": "^1.95.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.form-inline { | ||
display: table; | ||
font-size: 14px; | ||
} | ||
|
||
.form-inline .form-pair { | ||
display: table-row; | ||
} | ||
|
||
.form-inline .form-key { | ||
display: table-cell; | ||
vertical-align: top; | ||
padding: 6px 16px 0px 10px; | ||
font-weight: bold | ||
} | ||
|
||
.form-inline .form-value { | ||
display: table-cell; | ||
padding-top: 6px; | ||
} | ||
|
||
.grid-caption { | ||
margin-left: 6px; | ||
font-family: "Segoe UI Light", "Segoe UI", sans-serif; | ||
font-size: 14px; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html style="overflow:scroll"> | ||
<head> | ||
<script src="bower_components/vss-web-extension-sdk/lib/VSS.SDK.min.js"></script> | ||
|
||
<script type="text/javascript"> | ||
VSS.init( { | ||
usePlatformScripts: true, | ||
moduleLoaderConfig: { | ||
paths: { "enhancer": "BuildResultsEnhancer/dist/enhancer" } | ||
} | ||
}); | ||
|
||
VSS.ready(function() { | ||
require(["enhancer/tab"], function () { }); | ||
require(["enhancer/common"], function () { }); | ||
}); | ||
</script> | ||
|
||
<style> | ||
.build-info { | ||
padding: 10px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body > | ||
<div class="build-info"> | ||
<pre id="roberts-info-container"></pre> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/// <reference path='../../typings/main.d.ts' /> | ||
|
||
import TFS_BuildContracts = require("TFS/Build/Contracts"); | ||
import TFSTestMgmtClient = require("TFS/TestManagement/RestClient"); | ||
import TFS_TestMgmtContracts = require("TFS/TestManagement/Contracts"); | ||
|
||
export class OpenCoverResult extends Object { | ||
private resdoc: XMLDocument; | ||
public sequenceCoverage: string; | ||
public visitedSequencePoints: string; | ||
public sequencePoints: string; | ||
public branchCoverage: string; | ||
public visitedBranchPoints: string; | ||
public branchPoints: string; | ||
public minCyclomaticComplexity: string; | ||
public maxCyclomaticComplexity: string; | ||
public visitedClasses: string; | ||
public classes: string; | ||
public visitedMethods: string; | ||
public methods: string; | ||
|
||
constructor(buffer: ArrayBuffer) { | ||
super(); | ||
|
||
var cont = String.fromCharCode.apply(null, new Uint8Array(buffer)); | ||
this.resdoc = $.parseXML(cont); | ||
var $xml = $(this.resdoc); | ||
this.sequenceCoverage = $xml.find("Summary").attr("sequenceCoverage"); | ||
this.visitedSequencePoints = $xml.find("Summary").attr("visitedSequencePoints"); | ||
this.sequencePoints = $xml.find("Summary").attr("numSequencePoints"); | ||
|
||
this.branchCoverage = $xml.find("Summary").attr("branchCoverage"); | ||
this.visitedBranchPoints = $xml.find("Summary").attr("visitedBranchPoints"); | ||
this.branchPoints = $xml.find("Summary").attr("numBranchPoints"); | ||
|
||
this.minCyclomaticComplexity = $xml.find("Summary").attr("minCyclomaticComplexity"); | ||
this.maxCyclomaticComplexity = $xml.find("Summary").attr("maxCyclomaticComplexity"); | ||
this.visitedClasses = $xml.find("Summary").attr("visitedClasses"); | ||
this.visitedMethods = $xml.find("Summary").attr("visitedMethods"); | ||
this.classes = $xml.find("Summary").attr("numClasses"); | ||
this.methods = $xml.find("Summary").attr("numMethods"); | ||
} | ||
|
||
public doSomethingElse(): string { | ||
return "Hallo It's me. An Object Child"; | ||
} | ||
|
||
|
||
|
||
} | ||
|
||
|
||
export class CustomTestRunAttachment extends Object { | ||
private tagPrefix: string = "traid_"; | ||
private build: TFS_BuildContracts.Build; | ||
private testrunAttachmentId: any; | ||
|
||
constructor(build: TFS_BuildContracts.Build) { | ||
super(); | ||
this.build = build; | ||
$.each(build.tags, (ix, tag) => { | ||
if (tag.indexOf(this.tagPrefix) == 0) { | ||
this.testrunAttachmentId = tag.substr(6); // There should only be one testrunAttachment with an Tag pointing to it... | ||
} | ||
}); | ||
} | ||
|
||
public getTestRunsAsync(callback: any): void { | ||
var testrunid; | ||
var tc = TFSTestMgmtClient.getClient(); | ||
|
||
|
||
tc.getTestRuns(this.build.project.id, this.build.uri).then((tr) => { | ||
$.each(tr, (ix, tr) => { | ||
if (tr.name.indexOf("OpenCover_TestRun_") >= 0) { | ||
testrunid = tr.id; | ||
return false; // We take the first one as we only provide a single result ..... | ||
} | ||
}); | ||
tc.getTestRunAttachmentContent(this.build.project.id, testrunid, this.testrunAttachmentId).then((ab) => { | ||
callback(ab); | ||
}); | ||
}); | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/// <reference path='../../typings/main.d.ts' /> | ||
|
||
import Controls = require("VSS/Controls"); | ||
import TFS_Build_Contracts = require("TFS/Build/Contracts"); | ||
import TFS_Build_Extension_Contracts = require("TFS/Build/ExtensionContracts"); | ||
|
||
// Die eigenen imports sind als ts/js im selben Verzeichnis. | ||
import MyCommon = require("enhancer/common"); | ||
|
||
export class StatusSection extends Controls.BaseControl { | ||
constructor() { | ||
super(); | ||
} | ||
|
||
public initialize(): void { | ||
super.initialize(); | ||
|
||
|
||
// Get configuration that's shared between extension and the extension host | ||
var sharedConfig: TFS_Build_Extension_Contracts.IBuildResultsViewExtensionConfig = VSS.getConfiguration(); | ||
|
||
if(sharedConfig) { | ||
// register your extension with host through callback | ||
sharedConfig.onBuildChanged((build: TFS_Build_Contracts.Build) => { | ||
var ctra = new MyCommon.CustomTestRunAttachment(build); | ||
ctra.getTestRunsAsync((ab) => { | ||
var ocr = new MyCommon.OpenCoverResult(ab); | ||
|
||
var sc = Number(ocr.sequenceCoverage) * 255 / 100; | ||
var bc = Number(ocr.branchCoverage) * 255 / 100; | ||
|
||
|
||
|
||
$("#robert-cov-seq").text(ocr.sequenceCoverage + "%").css("background-color", this.rgbToHex(255 - sc, sc, 0)); | ||
$("#robert-cov-bra").text(ocr.branchCoverage + "%").css("background-color", this.rgbToHex(255 - bc,bc, 0)); | ||
}); | ||
|
||
}); | ||
} | ||
} | ||
|
||
private componentToHex(c :number) :string { | ||
var hex = c.toString(16); | ||
return hex.length == 1 ? "0" + hex : hex; | ||
} | ||
|
||
private rgbToHex(r :number, g: number, b : number) :string { | ||
return "#" + this.componentToHex(Math.floor(r)) + this.componentToHex(Math.floor(g)) + this.componentToHex(Math.floor(b)); | ||
} | ||
|
||
} | ||
|
||
StatusSection.enhance(StatusSection, $(".build-status"), {}); | ||
|
||
// Notify the parent frame that the host has been loaded | ||
VSS.notifyLoadSucceeded(); | ||
|
||
|
Oops, something went wrong.