Skip to content

Commit c0763d6

Browse files
committed
Adapt to new full paths in GNATcoverage reports
1 parent 1b5e411 commit c0763d6

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

integration/vscode/ada/src/gnatcov.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as vscode from 'vscode';
55
import { CancellationToken } from 'vscode-languageclient';
66
import { parallelize, staggerProgress } from './helpers';
77
import { cpus } from 'os';
8+
import { assert } from 'console';
89

910
/**
1011
* TypeScript types to represent data from GNATcoverage XML reports
@@ -307,16 +308,24 @@ export async function addCoverageData(run: vscode.TestRun, covDir: string) {
307308
throw new vscode.CancellationError();
308309
}
309310

310-
const found = await vscode.workspace.findFiles(
311-
`**/${file['@_name']!}`,
312-
null,
313-
1,
314-
);
315-
if (found.length == 0) {
316-
return undefined;
311+
assert(file['@_name']);
312+
313+
let srcUri: vscode.Uri;
314+
if (path.isAbsolute(file['@_name']!)) {
315+
srcUri = vscode.Uri.file(file['@_name']!);
316+
} else {
317+
const found = await vscode.workspace.findFiles(
318+
`**/${file['@_name']!}`,
319+
null,
320+
1,
321+
);
322+
if (found.length == 0) {
323+
return undefined;
324+
}
325+
326+
srcUri = found[0];
317327
}
318328

319-
const srcUri = found[0];
320329
const total = file.metric.find(
321330
(m) => m['@_kind'] == 'total_lines_of_relevance',
322331
)!['@_count'];
@@ -325,7 +334,7 @@ export async function addCoverageData(run: vscode.TestRun, covDir: string) {
325334
];
326335

327336
const fileReportBasename = data.coverage_report.sources!['xi:include'].find(
328-
(inc) => inc['@_href'] == `${file['@_name']!}.xml`,
337+
(inc) => inc['@_href'] == `${path.basename(file['@_name']!)}.xml`,
329338
)!['@_href'];
330339
const fileReportPath = path.join(covDir, fileReportBasename);
331340

0 commit comments

Comments
 (0)