forked from microsoft/vscode-java-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoverageUtils.ts
More file actions
36 lines (29 loc) · 1.19 KB
/
coverageUtils.ts
File metadata and controls
36 lines (29 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
import { DebugConfiguration } from 'vscode';
import { extensionContext } from '../extension';
import * as path from 'path';
const jacocoAgentRegex: RegExp = /org\.jacoco\.agent-\d+\.\d+\.\d+-runtime\.jar$/;
export function getJacocoAgentPath(debugConfiguration: DebugConfiguration): string {
if (debugConfiguration.classPaths) {
for (const classPath of debugConfiguration.classPaths) {
if (jacocoAgentRegex.test(classPath)) {
return classPath;
}
}
}
if (debugConfiguration.modulePaths) {
for (const modulePath of debugConfiguration.modulePaths) {
if (jacocoAgentRegex.test(modulePath)) {
return modulePath;
}
}
}
return extensionContext.asAbsolutePath('server/jacocoagent.jar');
}
export function getJacocoReportBasePath(projectName: string): string {
return path.join(extensionContext.storageUri!.fsPath, projectName, 'coverage');
}
export function getJacocoDataFilePath(projectName: string): string {
return path.join(getJacocoReportBasePath(projectName), 'jacoco.exec');
}