@@ -14,7 +14,8 @@ import { isArch } from "../utils/env/isArch"
14
14
import { hasDnf } from "../utils/env/hasDnf"
15
15
import { setupDnfPack } from "../utils/setup/setupDnfPack"
16
16
import { isUbuntu } from "../utils/env/isUbuntu"
17
- import { removeVPrefix } from "../utils/setup/version"
17
+ import { addVPrefix , removeVPrefix } from "../utils/setup/version"
18
+ import { info } from "../utils/io/io"
18
19
19
20
function getDownloadKcovPackageInfo ( version_number : string ) : PackageInfo {
20
21
return {
@@ -62,36 +63,34 @@ async function buildKcov(file: string, dest: string) {
62
63
}
63
64
64
65
export async function setupKcov ( versionGiven : string , setupDir : string , arch : string ) {
65
- switch ( process . platform ) {
66
- case "linux" : {
67
- // parse version
68
- const versionSplit = versionGiven . split ( "-" )
69
- let version = versionSplit [ 0 ]
70
- const installMethod = versionSplit [ 1 ] as "binary" | undefined
71
- const version_number = removeVPrefix ( version )
72
- // fix inconsistency in tagging
73
- if ( version_number === 38 ) {
74
- version = "v38"
75
- }
66
+ if ( process . platform === "win32" ) {
67
+ info ( "Kcov is not supported on Windows" )
68
+ return
69
+ }
76
70
77
- let installationInfo : InstallationInfo
78
- if ( installMethod === "binary" && version_number >= 39 ) {
79
- installationInfo = await setupBin ( "kcov" , version , getDownloadKcovPackageInfo , setupDir , arch )
80
- if ( isArch ( ) ) {
81
- setupPacmanPack ( "binutils" )
82
- } else if ( hasDnf ( ) ) {
83
- setupDnfPack ( "binutils" )
84
- } else if ( isUbuntu ( ) ) {
85
- setupAptPack ( "libbinutils" )
86
- }
87
- return installationInfo
88
- } else {
89
- installationInfo = await setupBin ( "kcov" , version , getBuildKcovPackageInfo , setupDir , arch )
90
- }
91
- return installationInfo
92
- }
93
- default : {
94
- throw new Error ( `Unsupported platform for ${ arch } ` )
71
+ // parse version
72
+ const versionSplit = versionGiven . split ( "-" )
73
+ let version = addVPrefix ( versionSplit [ 0 ] )
74
+ const installMethod = versionSplit [ 1 ] as "binary" | undefined
75
+ const version_number = removeVPrefix ( version )
76
+ // fix inconsistency in tagging
77
+ if ( version_number === 38 ) {
78
+ version = "v38"
79
+ }
80
+
81
+ let installationInfo : InstallationInfo
82
+ if ( installMethod === "binary" && version_number >= 39 ) {
83
+ installationInfo = await setupBin ( "kcov" , version , getDownloadKcovPackageInfo , setupDir , arch )
84
+ if ( isArch ( ) ) {
85
+ setupPacmanPack ( "binutils" )
86
+ } else if ( hasDnf ( ) ) {
87
+ setupDnfPack ( "binutils" )
88
+ } else if ( isUbuntu ( ) ) {
89
+ setupAptPack ( "libbinutils" )
95
90
}
91
+ return installationInfo
92
+ } else {
93
+ installationInfo = await setupBin ( "kcov" , version , getBuildKcovPackageInfo , setupDir , arch )
96
94
}
95
+ return installationInfo
97
96
}
0 commit comments