Skip to content

Commit

Permalink
Fix relative paths in PublishCodeCoverageResultsV1 (#8913)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmgross authored Nov 29, 2018
1 parent 518aa6a commit 7807be3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
28 changes: 8 additions & 20 deletions Tasks/PublishCodeCoverageResultsV1/publishcodecoverageresults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,13 @@ async function run() {

// Get any 'Additional Files' to publish as build artifacts
if (additionalFiles) {
// Does the 'Additional Files' value contain wildcards?
if (containsWildcard(additionalFiles)) {
// Resolve matches of the 'Additional Files' pattern
var additionalFileMatches: string[] = tl.findMatch(
workingDirectory,
additionalFiles,
{ followSymbolicLinks: false, followSpecifiedSymbolicLink: false },
{ matchBase: true });
}
else {
// Use the specific additional file (no wildcards)
var additionalFileMatches: string[] = [additionalFiles];
}
// Resolve matches of the 'Additional Files' pattern
var additionalFileMatches: string[] = tl.findMatch(
workingDirectory,
additionalFiles,
{ followSymbolicLinks: false, followSpecifiedSymbolicLink: false },
{ matchBase: true });

additionalFileMatches = additionalFileMatches.filter(file => pathExistsAsFile(file));
tl.debug(tl.loc('FoundNMatchesForPattern', additionalFileMatches.length, additionalFiles));
}
Expand All @@ -65,7 +59,7 @@ function resolvePathToSingleItem(workingDirectory:string, pathInput: string) : s
var resolvedPath: string = pathInput;

// Does the pathInput value contain wildcards?
if (pathInput && containsWildcard(pathInput)) {
if (pathInput) {
// Resolve matches of the pathInput pattern
var pathMatches: string[] = tl.findMatch(
workingDirectory,
Expand All @@ -92,12 +86,6 @@ function resolvePathToSingleItem(workingDirectory:string, pathInput: string) : s
return resolvedPath;
}

// Gets whether the specified input value contains a wildcard character.
function containsWildcard(inputValue: string) : boolean {
return inputValue.indexOf('*') >= 0 ||
inputValue.indexOf('?') >= 0;
}

// Gets whether the specified path exists as file.
function pathExistsAsFile(path: string) {
try {
Expand Down
4 changes: 2 additions & 2 deletions Tasks/PublishCodeCoverageResultsV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 139,
"Patch": 2
"Minor": 145,
"Patch": 0
},
"demands": [],
"minimumAgentVersion": "2.102.0",
Expand Down

1 comment on commit 7807be3

@petrce
Copy link

@petrce petrce commented on 7807be3 Jan 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this commit introduced this bug:
#9389

Please sign in to comment.