mirror of https://github.com/aminya/setup-cpp
fix: use utils/io instead of `@actions/core`
This commit is contained in:
parent
5b1c9b8d45
commit
682ca30420
|
@ -7,9 +7,8 @@ import semverMajor from "semver/functions/major"
|
||||||
import semverCoerce from "semver/functions/coerce"
|
import semverCoerce from "semver/functions/coerce"
|
||||||
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
import { warning } from "../utils/io/io"
|
import { warning, info } from "../utils/io/io"
|
||||||
import { isGitHubCI } from "../utils/env/isci"
|
import { isGitHubCI } from "../utils/env/isci"
|
||||||
import { info } from "@actions/core"
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
export async function setupGcc(version: string, _setupDir: string, arch: string) {
|
export async function setupGcc(version: string, _setupDir: string, arch: string) {
|
||||||
|
|
|
@ -8,9 +8,9 @@ import { getSpecificVersionAndUrl, getVersions, semverCoerceIfInvalid } from "..
|
||||||
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
||||||
import { addBinExtension } from "../utils/extension/extension"
|
import { addBinExtension } from "../utils/extension/extension"
|
||||||
import { addEnv } from "../utils/env/addEnv"
|
import { addEnv } from "../utils/env/addEnv"
|
||||||
import { info, setOutput } from "@actions/core"
|
import { setOutput } from "@actions/core"
|
||||||
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
|
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
|
||||||
import { warning } from "../utils/io/io"
|
import { info, warning } from "../utils/io/io"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import { isGitHubCI } from "../utils/env/isci"
|
import { isGitHubCI } from "../utils/env/isci"
|
||||||
import { setupGcc } from "../gcc/gcc"
|
import { setupGcc } from "../gcc/gcc"
|
||||||
|
|
13
src/main.ts
13
src/main.ts
|
@ -1,4 +1,4 @@
|
||||||
import * as core from "@actions/core"
|
import { getInput, endGroup, startGroup } from "@actions/core"
|
||||||
import { setupBrew } from "./brew/brew"
|
import { setupBrew } from "./brew/brew"
|
||||||
import { setupCcache } from "./ccache/ccache"
|
import { setupCcache } from "./ccache/ccache"
|
||||||
import { setupMake } from "./make/make"
|
import { setupMake } from "./make/make"
|
||||||
|
@ -40,7 +40,6 @@ import { setupVCVarsall } from "./vcvarsall/vcvarsall"
|
||||||
import { setupKcov } from "./kcov/kcov"
|
import { setupKcov } from "./kcov/kcov"
|
||||||
import { addEnv } from "./utils/env/addEnv"
|
import { addEnv } from "./utils/env/addEnv"
|
||||||
import { setupSevenZip } from "./sevenzip/sevenzip"
|
import { setupSevenZip } from "./sevenzip/sevenzip"
|
||||||
import { endGroup, startGroup } from "@actions/core"
|
|
||||||
import { setupGraphviz } from "./graphviz/graphviz"
|
import { setupGraphviz } from "./graphviz/graphviz"
|
||||||
|
|
||||||
/** The setup functions */
|
/** The setup functions */
|
||||||
|
@ -218,7 +217,7 @@ export async function main(args: string[]): Promise<number> {
|
||||||
}
|
}
|
||||||
case "appleclang":
|
case "appleclang":
|
||||||
case "applellvm": {
|
case "applellvm": {
|
||||||
core.info("Assuming apple-clang is already installed")
|
info("Assuming apple-clang is already installed")
|
||||||
addEnv("CC", "clang")
|
addEnv("CC", "clang")
|
||||||
addEnv("CXX", "clang++")
|
addEnv("CXX", "clang++")
|
||||||
successMessages.push(getSuccessMessage("apple-clang", undefined))
|
successMessages.push(getSuccessMessage("apple-clang", undefined))
|
||||||
|
@ -249,7 +248,7 @@ export async function main(args: string[]): Promise<number> {
|
||||||
successMessages.forEach((tool) => success(tool))
|
successMessages.forEach((tool) => success(tool))
|
||||||
errorMessages.forEach((tool) => error(tool))
|
errorMessages.forEach((tool) => error(tool))
|
||||||
|
|
||||||
core.info("setup_cpp finished")
|
info("setup_cpp finished")
|
||||||
|
|
||||||
if (!isGitHubCI()) {
|
if (!isGitHubCI()) {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
|
@ -290,7 +289,7 @@ export function getCompilerInfo(maybeCompiler: string) {
|
||||||
if (semverValid(maybeVersion) !== null) {
|
if (semverValid(maybeVersion) !== null) {
|
||||||
return { compiler, version: maybeVersion }
|
return { compiler, version: maybeVersion }
|
||||||
} else {
|
} else {
|
||||||
core.info(`Invalid semver version ${maybeVersion} used for the compiler.`)
|
info(`Invalid semver version ${maybeVersion} used for the compiler.`)
|
||||||
return { compiler, version: maybeVersion }
|
return { compiler, version: maybeVersion }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,7 +297,7 @@ export function getCompilerInfo(maybeCompiler: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function printHelp() {
|
function printHelp() {
|
||||||
core.info(`
|
info(`
|
||||||
setup_cpp [options]
|
setup_cpp [options]
|
||||||
setup_cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
setup_cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
||||||
|
|
||||||
|
@ -340,7 +339,7 @@ All the available tools:
|
||||||
|
|
||||||
/** Get an object from github actions */
|
/** Get an object from github actions */
|
||||||
function maybeGetInput(key: string) {
|
function maybeGetInput(key: string) {
|
||||||
const value = core.getInput(key.toLowerCase())
|
const value = getInput(key.toLowerCase())
|
||||||
if (value !== "false" && value !== "") {
|
if (value !== "false" && value !== "") {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
import { info } from "@actions/core"
|
|
||||||
import { setupVCVarsall } from "../vcvarsall/vcvarsall"
|
import { setupVCVarsall } from "../vcvarsall/vcvarsall"
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -7,7 +6,7 @@ import { vsversion_to_versionnumber, findVcvarsall } from "msvc-dev-cmd/lib.js"
|
||||||
import { isGitHubCI } from "../utils/env/isci"
|
import { isGitHubCI } from "../utils/env/isci"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import { error, warning } from "../utils/io/io"
|
import { error, info, warning } from "../utils/io/io"
|
||||||
|
|
||||||
type MSVCVersion = "2022" | "17.0" | "2019" | "16.0" | "2017" | "15.0" | "2015" | "14.0" | "2013" | "12.0" | string
|
type MSVCVersion = "2022" | "17.0" | "2019" | "16.0" | "2017" | "15.0" | "2015" | "14.0" | "2013" | "12.0" | string
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import * as core from "@actions/core"
|
|
||||||
import { addPath } from "../utils/env/addEnv"
|
import { addPath } from "../utils/env/addEnv"
|
||||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
import { isGitHubCI } from "../utils/env/isci"
|
import { isGitHubCI } from "../utils/env/isci"
|
||||||
import { warning } from "@actions/core"
|
import { warning, info } from "../utils/io/io"
|
||||||
|
|
||||||
export async function setupPython(version: string, setupDir: string, arch: string) {
|
export async function setupPython(version: string, setupDir: string, arch: string) {
|
||||||
if (!isGitHubCI()) {
|
if (!isGitHubCI()) {
|
||||||
|
@ -15,7 +14,7 @@ export async function setupPython(version: string, setupDir: string, arch: strin
|
||||||
const { setupActionsPython } = await import("./actions_python")
|
const { setupActionsPython } = await import("./actions_python")
|
||||||
return setupActionsPython(version, setupDir, arch)
|
return setupActionsPython(version, setupDir, arch)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
warning(err as Error)
|
warning((err as Error).toString())
|
||||||
return setupPythonViaSystem(version, setupDir, arch)
|
return setupPythonViaSystem(version, setupDir, arch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +49,6 @@ export function setupPythonViaSystem(version: string, setupDir: string, _arch: s
|
||||||
}
|
}
|
||||||
|
|
||||||
function activateWinPython(binDir: string) {
|
function activateWinPython(binDir: string) {
|
||||||
core.info(`Add ${binDir} to PATH`)
|
info(`Add ${binDir} to PATH`)
|
||||||
addPath(binDir)
|
addPath(binDir)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { info } from "@actions/core"
|
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { setupMSVCDevCmd } from "msvc-dev-cmd/lib.js"
|
import { setupMSVCDevCmd } from "msvc-dev-cmd/lib.js"
|
||||||
import { addEnv } from "../utils/env/addEnv"
|
import { addEnv } from "../utils/env/addEnv"
|
||||||
|
import { info } from "../utils/io/io"
|
||||||
|
|
||||||
function getArch(arch: string): string {
|
function getArch(arch: string): string {
|
||||||
switch (arch) {
|
switch (arch) {
|
||||||
|
|
Loading…
Reference in New Issue