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

Fix relative paths in PublishCodeCoverageResultsV1 #8913

Merged
merged 1 commit into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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