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

Optimizing the performance of CoveragePublisher for all scenarios #18281

Merged
merged 12 commits into from
Jun 9, 2023
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
30 changes: 25 additions & 5 deletions Tasks/Common/coveragepublisher/coveragepublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as os from 'os';
import * as fs from 'fs';
import * as path from 'path';
import * as UUID from 'uuid/v4';
import {execSync} from 'child_process';

export async function PublishCodeCoverage(inputFiles: string[], sourceDirectory?: string) {
var reportDirectory = path.join(getTempFolder(), UUID());
Expand All @@ -28,19 +29,38 @@ async function publishCoverage(inputFiles: string[], reportDirectory: string, pa
return false;
}

if (!dotnetPath && osvar === 'win32') {
if (osvar === 'win32') {
// use full .NET to execute
dotnet = taskLib.tool(path.join(__dirname, 'CoveragePublisher', 'CoveragePublisher.Console.exe'));
} else {
}
else if(osvar==='linux')
{
// use full .NET to execute
var filepath=path.join(__dirname, 'CoveragePublisher','linux-x64', 'CoveragePublisher.Console');
execSync('chmod +x '+filepath);
dotnet=taskLib.tool(filepath);
}
else if(osvar==='darwin')
{
// use full .NET to execute
var filepath=path.join(__dirname, 'CoveragePublisher', 'osx-x64', 'CoveragePublisher.Console');
execSync('chmod +x '+filepath);
dotnet=taskLib.tool(filepath);
}
else{
dotnet = taskLib.tool(dotnetPath);
dotnet.arg(path.join(__dirname, "CoveragePublisher", 'CoveragePublisher.Console.dll'));
}

dotnet.arg('"' + inputFiles.join('" "') + '"');
dotnet.arg('--reportDirectory ' + reportDirectory);
for (const inputFile of inputFiles) {
dotnet.arg(inputFile);
}
dotnet.arg('--reportDirectory');
dotnet.arg(reportDirectory);

if(!isNullOrWhitespace(pathToSources)) {
dotnet.arg('--sourceDirectory ' + pathToSources);
dotnet.arg('--sourceDirectory');
dotnet.arg(pathToSources);
}

try {
Expand Down
2 changes: 1 addition & 1 deletion Tasks/Common/coveragepublisher/make.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"externals": {
"archivePackages": [
{
"url": "https://coveragepublishers.blob.core.windows.net/coveragepublisher/19631413/CoveragePublisher.zip",
"url": "https://coveragepublishers.blob.core.windows.net/coveragepublisher/20071190/CoveragePublisher.zip",
"dest": "./"
}
]
Expand Down
2 changes: 1 addition & 1 deletion Tasks/PublishCodeCoverageResultsV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 221,
"Minor": 223,
"Patch": 0
},
"demands": [],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/PublishCodeCoverageResultsV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 221,
"Minor": 223,
"Patch": 0
},
"demands": [],
Expand Down