Merge pull request #142 from aminya/gcov [skip ci]

This commit is contained in:
Amin Yahyaabadi 2022-11-08 17:22:04 -08:00 committed by GitHub
commit b82e63f041
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 6 deletions

View File

@ -34,6 +34,7 @@ words:
- esmodule - esmodule
- execa - execa
- ftxui - ftxui
- GCOV
- gcovr - gcovr
- ghes - ghes
- Graphviz - Graphviz

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,21 @@
import { addEnv } from "../utils/env/addEnv"
import { setupPipPack } from "../utils/setup/setupPipPack" import { setupPipPack } from "../utils/setup/setupPipPack"
import semverValid from "semver/functions/valid"
import semverMajor from "semver/functions/major"
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export function setupGcovr(version: string | undefined, _setupDir: string, _arch: string) { export function setupGcovr(version: string | undefined, _setupDir: string, _arch: string) {
return setupPipPack("gcovr", version) return setupPipPack("gcovr", version)
} }
export function activateGcovLLVM() {
return addEnv("GCOV", "llvm-cov gcov")
}
export function activateGcovGCC(gccVersion: string) {
const gccSemver = semverValid(gccVersion)
const gccMajor = gccSemver !== null ? semverMajor(gccSemver) : gccVersion
const gcov = gccMajor !== "" ? `gcov-${gccMajor}` : "gcov"
return addEnv("GCOV", gcov)
}

View File

@ -8,7 +8,7 @@ import { setupCmake } from "./cmake/cmake"
import { setupConan } from "./conan/conan" import { setupConan } from "./conan/conan"
import { setupCppcheck } from "./cppcheck/cppcheck" import { setupCppcheck } from "./cppcheck/cppcheck"
import { setupDoxygen } from "./doxygen/doxygen" import { setupDoxygen } from "./doxygen/doxygen"
import { setupGcovr } from "./gcovr/gcovr" import { activateGcovGCC, activateGcovLLVM, setupGcovr } from "./gcovr/gcovr"
import { setupLLVM, setupClangTools } from "./llvm/llvm" import { setupLLVM, setupClangTools } from "./llvm/llvm"
import { setupMeson } from "./meson/meson" import { setupMeson } from "./meson/meson"
import { setupMSVC } from "./msvc/msvc" import { setupMSVC } from "./msvc/msvc"
@ -201,6 +201,9 @@ export async function main(args: string[]): Promise<number> {
join(setupCppDir, "llvm"), join(setupCppDir, "llvm"),
arch arch
) )
await activateGcovLLVM()
successMessages.push(getSuccessMessage("llvm", installationInfo)) successMessages.push(getSuccessMessage("llvm", installationInfo))
break break
} }
@ -208,13 +211,16 @@ export async function main(args: string[]): Promise<number> {
case "mingw": case "mingw":
case "cygwin": case "cygwin":
case "msys": { case "msys": {
const installationInfo = await setupGcc(getVersion("gcc", version, osVersion), join(setupCppDir, "gcc"), arch) const gccVersion = getVersion("gcc", version, osVersion)
const installationInfo = await setupGcc(gccVersion, join(setupCppDir, "gcc"), arch)
if (hasLLVM) { if (hasLLVM) {
// remove the CPPFLAGS of LLVM that include the LLVM headers // remove the CPPFLAGS of LLVM that include the LLVM headers
await addEnv("CPPFLAGS", "") await addEnv("CPPFLAGS", "")
} }
await activateGcovGCC(gccVersion)
successMessages.push(getSuccessMessage("gcc", installationInfo)) successMessages.push(getSuccessMessage("gcc", installationInfo))
break break
} }