Skip to content

Commit b82e63f

Browse files
authored
Merge pull request #142 from aminya/gcov [skip ci]
2 parents 8c9d48b + e2bc974 commit b82e63f

File tree

7 files changed

+28
-6
lines changed

7 files changed

+28
-6
lines changed

cspell.config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ words:
3434
- esmodule
3535
- execa
3636
- ftxui
37+
- GCOV
3738
- gcovr
3839
- ghes
3940
- Graphviz

dist/node12/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node12/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node16/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/node16/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gcovr/gcovr.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1+
import { addEnv } from "../utils/env/addEnv"
12
import { setupPipPack } from "../utils/setup/setupPipPack"
3+
import semverValid from "semver/functions/valid"
4+
import semverMajor from "semver/functions/major"
25

36
// eslint-disable-next-line @typescript-eslint/no-unused-vars
47
export function setupGcovr(version: string | undefined, _setupDir: string, _arch: string) {
58
return setupPipPack("gcovr", version)
69
}
10+
11+
export function activateGcovLLVM() {
12+
return addEnv("GCOV", "llvm-cov gcov")
13+
}
14+
15+
export function activateGcovGCC(gccVersion: string) {
16+
const gccSemver = semverValid(gccVersion)
17+
const gccMajor = gccSemver !== null ? semverMajor(gccSemver) : gccVersion
18+
const gcov = gccMajor !== "" ? `gcov-${gccMajor}` : "gcov"
19+
20+
return addEnv("GCOV", gcov)
21+
}

src/main.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { setupCmake } from "./cmake/cmake"
88
import { setupConan } from "./conan/conan"
99
import { setupCppcheck } from "./cppcheck/cppcheck"
1010
import { setupDoxygen } from "./doxygen/doxygen"
11-
import { setupGcovr } from "./gcovr/gcovr"
11+
import { activateGcovGCC, activateGcovLLVM, setupGcovr } from "./gcovr/gcovr"
1212
import { setupLLVM, setupClangTools } from "./llvm/llvm"
1313
import { setupMeson } from "./meson/meson"
1414
import { setupMSVC } from "./msvc/msvc"
@@ -201,20 +201,26 @@ export async function main(args: string[]): Promise<number> {
201201
join(setupCppDir, "llvm"),
202202
arch
203203
)
204+
205+
await activateGcovLLVM()
206+
204207
successMessages.push(getSuccessMessage("llvm", installationInfo))
205208
break
206209
}
207210
case "gcc":
208211
case "mingw":
209212
case "cygwin":
210213
case "msys": {
211-
const installationInfo = await setupGcc(getVersion("gcc", version, osVersion), join(setupCppDir, "gcc"), arch)
214+
const gccVersion = getVersion("gcc", version, osVersion)
215+
const installationInfo = await setupGcc(gccVersion, join(setupCppDir, "gcc"), arch)
212216

213217
if (hasLLVM) {
214218
// remove the CPPFLAGS of LLVM that include the LLVM headers
215219
await addEnv("CPPFLAGS", "")
216220
}
217221

222+
await activateGcovGCC(gccVersion)
223+
218224
successMessages.push(getSuccessMessage("gcc", installationInfo))
219225
break
220226
}

0 commit comments

Comments
 (0)