From 7807be3c01741a46db528a35f719a66789b832fe Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Thu, 29 Nov 2018 11:25:34 -0500 Subject: [PATCH] Fix relative paths in PublishCodeCoverageResultsV1 (#8913) --- .../publishcodecoverageresults.ts | 28 ++++++------------- Tasks/PublishCodeCoverageResultsV1/task.json | 4 +-- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/Tasks/PublishCodeCoverageResultsV1/publishcodecoverageresults.ts b/Tasks/PublishCodeCoverageResultsV1/publishcodecoverageresults.ts index 15fbd22c005b..a64280a0039f 100644 --- a/Tasks/PublishCodeCoverageResultsV1/publishcodecoverageresults.ts +++ b/Tasks/PublishCodeCoverageResultsV1/publishcodecoverageresults.ts @@ -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)); } @@ -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, @@ -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 { diff --git a/Tasks/PublishCodeCoverageResultsV1/task.json b/Tasks/PublishCodeCoverageResultsV1/task.json index b76896309e38..2af2f62f62d7 100644 --- a/Tasks/PublishCodeCoverageResultsV1/task.json +++ b/Tasks/PublishCodeCoverageResultsV1/task.json @@ -15,8 +15,8 @@ "author": "Microsoft Corporation", "version": { "Major": 1, - "Minor": 139, - "Patch": 2 + "Minor": 145, + "Patch": 0 }, "demands": [], "minimumAgentVersion": "2.102.0",