mirror of https://github.com/aminya/setup-cpp
Merge pull request #78 from aminya/spaces [skip ci]
fix: escape the spaces in LDFLAGS and CPPFLAGS
This commit is contained in:
commit
0286b4c7c4
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -37,6 +37,7 @@
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.2",
|
"@actions/io": "^1.1.2",
|
||||||
"@actions/tool-cache": "^1.7.2",
|
"@actions/tool-cache": "^1.7.2",
|
||||||
|
"escape-path-with-spaces": "^1.0.0",
|
||||||
"execa": "^5.1.1",
|
"execa": "^5.1.1",
|
||||||
"mri": "^1.2.0",
|
"mri": "^1.2.0",
|
||||||
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
|
||||||
|
|
|
@ -23,6 +23,7 @@ specifiers:
|
||||||
cross-env: 7.0.3
|
cross-env: 7.0.3
|
||||||
cross-spawn: ^7.0.3
|
cross-spawn: ^7.0.3
|
||||||
cspell: ^5.20.0
|
cspell: ^5.20.0
|
||||||
|
escape-path-with-spaces: ^1.0.0
|
||||||
eslint: ^8.14.0
|
eslint: ^8.14.0
|
||||||
eslint-config-atomic: ^1.17.1
|
eslint-config-atomic: ^1.17.1
|
||||||
execa: ^5.1.1
|
execa: ^5.1.1
|
||||||
|
@ -52,6 +53,7 @@ dependencies:
|
||||||
'@actions/exec': 1.1.1
|
'@actions/exec': 1.1.1
|
||||||
'@actions/io': 1.1.2
|
'@actions/io': 1.1.2
|
||||||
'@actions/tool-cache': 1.7.2
|
'@actions/tool-cache': 1.7.2
|
||||||
|
escape-path-with-spaces: 1.0.0
|
||||||
execa: 5.1.1
|
execa: 5.1.1
|
||||||
mri: 1.2.0
|
mri: 1.2.0
|
||||||
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
|
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
|
||||||
|
@ -3588,6 +3590,10 @@ packages:
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/escape-path-with-spaces/1.0.0:
|
||||||
|
resolution: {integrity: sha512-+98Hh0yzVa0hldJXlzr0M/8B8LVXW9vNT5boC9k6o896Z52DGRplm3NwMGX0590ryGSegzTf/uaUiusFj2SQbQ==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/escape-string-regexp/1.0.5:
|
/escape-string-regexp/1.0.5:
|
||||||
resolution: {integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=}
|
resolution: {integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=}
|
||||||
engines: {node: '>=0.8.0'}
|
engines: {node: '>=0.8.0'}
|
||||||
|
|
|
@ -317,8 +317,8 @@ export async function activateLLVM(directory: string, versionGiven: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addEnv("LDFLAGS", `-L${directory}/lib`)
|
addEnv("LDFLAGS", `-L"${directory}/lib"`)
|
||||||
addEnv("CPPFLAGS", `-I${directory}/include`)
|
addEnv("CPPFLAGS", `-I"${directory}/include"`)
|
||||||
|
|
||||||
addEnv("CC", `${directory}/bin/clang`)
|
addEnv("CC", `${directory}/bin/clang`)
|
||||||
addEnv("CXX", `${directory}/bin/clang++`)
|
addEnv("CXX", `${directory}/bin/clang++`)
|
||||||
|
|
|
@ -5,9 +5,11 @@ import { appendFileSync, existsSync, readFileSync } from "fs"
|
||||||
import { error, warning } from "../io/io"
|
import { error, warning } from "../io/io"
|
||||||
import { execPowershell } from "../exec/powershell"
|
import { execPowershell } from "../exec/powershell"
|
||||||
import { delimiter } from "path"
|
import { delimiter } from "path"
|
||||||
|
import { escapeSpace } from "../path/escape_space"
|
||||||
|
|
||||||
/** An add path function that works locally or inside GitHub Actions */
|
/** An add path function that works locally or inside GitHub Actions */
|
||||||
export function addEnv(name: string, val: string | undefined) {
|
export function addEnv(name: string, valGiven: string | undefined, shouldEscapeSpace: boolean = false) {
|
||||||
|
const val = shouldEscapeSpace ? escapeSpace(valGiven) : valGiven
|
||||||
try {
|
try {
|
||||||
if (isGitHubCI()) {
|
if (isGitHubCI()) {
|
||||||
exportVariable(name, val)
|
exportVariable(name, val)
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
import escape from "escape-path-with-spaces"
|
||||||
|
|
||||||
|
/// Escape the spaces in the given path
|
||||||
|
export function escapeSpace(path: string | undefined): string {
|
||||||
|
if (path === undefined) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return escape(path)
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ import spawn from "cross-spawn"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
|
|
||||||
export async function setupTmpDir(testName: string) {
|
export async function setupTmpDir(testName: string) {
|
||||||
const tempDirectory = path.join(tmpdir(), "setup-cpp", testName)
|
const tempDirectory = path.join(tmpdir(), "setup cpp temp", testName)
|
||||||
try {
|
try {
|
||||||
await io.rmRF(tempDirectory)
|
await io.rmRF(tempDirectory)
|
||||||
await io.mkdirP(tempDirectory)
|
await io.mkdirP(tempDirectory)
|
||||||
|
|
Loading…
Reference in New Issue