mirror of https://github.com/aminya/setup-cpp
fix: fix all the linting errors
This commit is contained in:
parent
36a5b861ce
commit
11b44434f5
|
@ -1,4 +1,16 @@
|
|||
{
|
||||
"extends": "eslint-config-atomic",
|
||||
"ignorePatterns": ["dist/", "node_modules/", "dev/cpp_vcpkg_project"]
|
||||
"ignorePatterns": ["dist/", "node_modules/", "dev/cpp_vcpkg_project"],
|
||||
"rules": {
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
"argsIgnorePattern": "^_",
|
||||
"varsIgnorePattern": "^_",
|
||||
"caughtErrorsIgnorePattern": "^_",
|
||||
"destructuredArrayIgnorePattern": "^_"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
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
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.9.1",
|
||||
"@npmcli/ci-detect": "github:aminya/ci-detect#37fe40075bebec96794ba0a7c4a6d5c70cbea00d"
|
||||
"ci-info": "^3.8.0"
|
||||
},
|
||||
"keywords": [
|
||||
"log",
|
||||
|
|
|
@ -187,9 +187,9 @@ importers:
|
|||
'@actions/core':
|
||||
specifier: ^1.9.1
|
||||
version: 1.9.1
|
||||
'@npmcli/ci-detect':
|
||||
specifier: github:aminya/ci-detect#37fe40075bebec96794ba0a7c4a6d5c70cbea00d
|
||||
version: github.com/aminya/ci-detect/37fe40075bebec96794ba0a7c4a6d5c70cbea00d
|
||||
ci-info:
|
||||
specifier: ^3.8.0
|
||||
version: 3.8.0
|
||||
|
||||
packages/exec-powershell:
|
||||
dependencies:
|
||||
|
@ -3612,7 +3612,6 @@ packages:
|
|||
/ci-info@3.8.0:
|
||||
resolution: {integrity: sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==}
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/cjs-module-lexer@1.2.2:
|
||||
resolution: {integrity: sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==}
|
||||
|
@ -10620,13 +10619,6 @@ packages:
|
|||
'@babel/core': 7.21.4
|
||||
dev: true
|
||||
|
||||
github.com/aminya/ci-detect/37fe40075bebec96794ba0a7c4a6d5c70cbea00d:
|
||||
resolution: {tarball: https://codeload.github.com/aminya/ci-detect/tar.gz/37fe40075bebec96794ba0a7c4a6d5c70cbea00d}
|
||||
name: '@npmcli/ci-detect'
|
||||
version: 2.0.0
|
||||
engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
|
||||
dev: false
|
||||
|
||||
github.com/aminya/msvc-dev-cmd/9f672c1:
|
||||
resolution: {tarball: https://codeload.github.com/aminya/msvc-dev-cmd/tar.gz/9f672c1}
|
||||
name: msvc-dev-cmd
|
||||
|
|
|
@ -7,6 +7,7 @@ import { mkdirP } from "@actions/io"
|
|||
import { readFileSync } from "fs"
|
||||
import { addPath } from "../utils/env/addEnv"
|
||||
|
||||
/* eslint-disable require-atomic-updates */
|
||||
let binDir: string | undefined
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
|
|
|
@ -17,6 +17,7 @@ import { isUbuntu } from "../utils/env/isUbuntu"
|
|||
import { hasDnf } from "../utils/env/hasDnf"
|
||||
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
||||
import { pathExists } from "path-exists"
|
||||
import { ExecaReturnValue } from "execa"
|
||||
|
||||
interface MingwInfo {
|
||||
releaseName: string
|
||||
|
@ -109,7 +110,7 @@ export async function setupGcc(version: string, setupDir: string, arch: string)
|
|||
} else {
|
||||
info(`Install g++-multilib because gcc for ${arch} was requested`)
|
||||
if (isArch()) {
|
||||
setupPacmanPack("gcc-multilib", version)
|
||||
await setupPacmanPack("gcc-multilib", version)
|
||||
} else if (isUbuntu()) {
|
||||
await setupAptPack([{ name: "gcc-multilib", version, repositories: ["ppa:ubuntu-toolchain-r/test"] }])
|
||||
}
|
||||
|
@ -157,7 +158,7 @@ async function setupChocoMingw(version: string, arch: string): Promise<Installat
|
|||
}
|
||||
|
||||
async function activateGcc(version: string, binDir: string) {
|
||||
const promises: Promise<any>[] = []
|
||||
const promises: Promise<void | ExecaReturnValue<string>>[] = []
|
||||
// Setup gcc as the compiler
|
||||
|
||||
// TODO
|
||||
|
|
|
@ -44,8 +44,7 @@ async function buildKcov(file: string, dest: string) {
|
|||
|
||||
if (process.platform === "linux") {
|
||||
if (isArch()) {
|
||||
setupPacmanPack("libdwarf")
|
||||
setupPacmanPack("libcurl-openssl")
|
||||
await Promise.all([setupPacmanPack("libdwarf"), setupPacmanPack("libcurl-openssl")])
|
||||
} else if (hasDnf()) {
|
||||
setupDnfPack("libdwarf-devel")
|
||||
setupDnfPack("libcurl-devel")
|
||||
|
@ -97,7 +96,7 @@ export async function setupKcov(versionGiven: string, setupDir: string, arch: st
|
|||
if (installMethod === "binary" && version_number >= 39) {
|
||||
installationInfo = await setupBin("kcov", version, getDownloadKcovPackageInfo, setupDir, arch)
|
||||
if (isArch()) {
|
||||
setupPacmanPack("binutils")
|
||||
await setupPacmanPack("binutils")
|
||||
} else if (hasDnf()) {
|
||||
setupDnfPack("binutils")
|
||||
} else if (isUbuntu()) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { join, addExeExt } from "patha"
|
||||
import { delimiter } from "path"
|
||||
import semverMajor from "semver/functions/major"
|
||||
import { InstallationInfo, setupBin } from "../utils/setup/setupBin"
|
||||
import { semverCoerceIfInvalid } from "../utils/setup/version"
|
||||
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
||||
|
@ -59,12 +58,12 @@ async function setupLLVMDeps(arch: string, version: string) {
|
|||
}
|
||||
}
|
||||
// TODO: install libtinfo on other distros
|
||||
// setupPacmanPack("ncurses")
|
||||
// await setupPacmanPack("ncurses")
|
||||
}
|
||||
}
|
||||
|
||||
export async function activateLLVM(directory: string, versionGiven: string) {
|
||||
const version = semverCoerceIfInvalid(versionGiven)
|
||||
const _version = semverCoerceIfInvalid(versionGiven)
|
||||
|
||||
const lib = join(directory, "lib")
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ export async function main(args: string[]): Promise<number> {
|
|||
|
||||
if (isArch() && typeof opts.cppcheck === "string" && typeof opts.gcovr === "string") {
|
||||
info("installing python-pygments to avoid conflicts with cppcheck and gcovr on Arch linux")
|
||||
setupPacmanPack("python-pygments")
|
||||
await setupPacmanPack("python-pygments")
|
||||
}
|
||||
|
||||
// loop over the tools and run their setup function
|
||||
|
|
|
@ -64,7 +64,7 @@ export async function setupPythonViaSystem(
|
|||
let installInfo: InstallationInfo
|
||||
if (isArch()) {
|
||||
installInfo = await setupPacmanPack("python", version)
|
||||
setupPacmanPack("python-pip")
|
||||
await setupPacmanPack("python-pip")
|
||||
} else if (hasDnf()) {
|
||||
installInfo = setupDnfPack("python3", version)
|
||||
setupDnfPack("python3-pip")
|
||||
|
@ -113,7 +113,7 @@ export async function setupPythonAndPip(): Promise<string> {
|
|||
} else if (process.platform === "linux") {
|
||||
// ensure that pip is installed on Linux (happens when python is found but pip not installed)
|
||||
if (isArch()) {
|
||||
setupPacmanPack("python-pip")
|
||||
await setupPacmanPack("python-pip")
|
||||
} else if (hasDnf()) {
|
||||
setupDnfPack("python3-pip")
|
||||
} else if (isUbuntu()) {
|
||||
|
|
|
@ -111,6 +111,7 @@ async function addPathSystem(path: string) {
|
|||
}
|
||||
}
|
||||
|
||||
/* eslint-disable require-atomic-updates */
|
||||
let setupCppInProfile_called = false
|
||||
|
||||
/// handles adding conditions to source .cpprc file from .bashrc and .profile
|
||||
|
|
|
@ -62,7 +62,7 @@ async function getAptArg(name: string, version: string | undefined) {
|
|||
const { stdout } = await execa("apt-cache", [
|
||||
"search",
|
||||
"--names-only",
|
||||
`^${escapeRegex(name)}\-${escapeRegex(version)}$`,
|
||||
`^${escapeRegex(name)}-${escapeRegex(version)}$`,
|
||||
])
|
||||
if (stdout.trim() !== "") {
|
||||
return `${name}-${version}`
|
||||
|
@ -103,7 +103,7 @@ async function initApt(apt: string) {
|
|||
"ca-certificates",
|
||||
"gnupg",
|
||||
])
|
||||
const promises: Promise<any>[] = [
|
||||
const promises: Promise<string | void>[] = [
|
||||
addAptKeyViaServer(["3B4FE6ACC0B21F32", "40976EAF437D05B5"], "setup-cpp-ubuntu-archive.gpg"),
|
||||
addAptKeyViaServer(["1E9377A2BA9EF27F"], "launchpad-toolchain.gpg"),
|
||||
]
|
||||
|
|
|
@ -104,9 +104,7 @@ export async function setupBin(
|
|||
info(`Installing extraction dependencies`)
|
||||
if (process.platform === "linux") {
|
||||
if (isArch()) {
|
||||
setupPacmanPack("unzip")
|
||||
setupPacmanPack("tar")
|
||||
setupPacmanPack("xz")
|
||||
await Promise.all([setupPacmanPack("unzip"), setupPacmanPack("tar"), setupPacmanPack("xz")])
|
||||
} else if (hasDnf()) {
|
||||
setupDnfPack("unzip")
|
||||
setupDnfPack("tar")
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable require-atomic-updates */
|
||||
import { info } from "@actions/core"
|
||||
import { execaSync } from "execa"
|
||||
import { pathExists } from "path-exists"
|
||||
|
@ -8,6 +7,7 @@ import { addPythonBaseExecPrefix, setupPythonAndPip } from "../../python/python"
|
|||
import { addPath } from "../env/addEnv"
|
||||
import { InstallationInfo } from "./setupBin"
|
||||
|
||||
/* eslint-disable require-atomic-updates */
|
||||
let python: string | undefined
|
||||
let binDirs: string[] | undefined
|
||||
|
||||
|
@ -37,9 +37,8 @@ export async function setupPipPack(name: string, version?: string): Promise<Inst
|
|||
async function findBinDir(dirs: string[], name: string) {
|
||||
const exists = await Promise.all(dirs.map((dir) => pathExists(join(dir, addExeExt(name)))))
|
||||
const dirIndex = exists.findIndex((exist) => exist)
|
||||
if (dirIndex !== -1) {
|
||||
const foundDir = dirs[dirIndex]
|
||||
|
||||
if (foundDir !== undefined) {
|
||||
return foundDir
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,13 @@ import { info } from "ci-log"
|
|||
export function getSpecificVersions(versions: Set<string>, semversion: string): string[] {
|
||||
return Array.from(versions)
|
||||
.filter((v) => /^\d+\.\d+\.\d+$/.test(v) && v.startsWith(semversion))
|
||||
.sort()
|
||||
.sort((a, b) => {
|
||||
try {
|
||||
return semverCompare(a, b)
|
||||
} catch (err) {
|
||||
return a.localeCompare(b)
|
||||
}
|
||||
})
|
||||
.reverse()
|
||||
}
|
||||
|
||||
|
@ -58,11 +64,12 @@ export async function getSpecificVersionAndUrl(
|
|||
|
||||
const offlineUrls: string[] = []
|
||||
|
||||
// TODO use Promise.any
|
||||
for (const specificVersion of getSpecificVersions(versions, version)) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const url = await getUrl(platform, specificVersion)
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
if (url !== null) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
if (await isUrlOnline(url)) {
|
||||
return [specificVersion, url]
|
||||
} else {
|
||||
|
|
|
@ -21,12 +21,14 @@ export async function setupVcpkg(_version: string, setupDir: string, _arch: stri
|
|||
if (process.platform === "linux") {
|
||||
// vcpkg download and extraction dependencies
|
||||
if (isArch()) {
|
||||
setupPacmanPack("curl")
|
||||
setupPacmanPack("zip")
|
||||
setupPacmanPack("unzip")
|
||||
setupPacmanPack("tar")
|
||||
setupPacmanPack("git")
|
||||
setupPacmanPack("pkg-config")
|
||||
await Promise.all([
|
||||
setupPacmanPack("curl"),
|
||||
setupPacmanPack("zip"),
|
||||
setupPacmanPack("unzip"),
|
||||
setupPacmanPack("tar"),
|
||||
setupPacmanPack("git"),
|
||||
setupPacmanPack("pkg-config"),
|
||||
])
|
||||
} else if (hasDnf()) {
|
||||
setupDnfPack("curl")
|
||||
setupDnfPack("zip")
|
||||
|
|
Loading…
Reference in New Issue