mirror of https://github.com/aminya/setup-cpp
fix: fix macos-sdk
This commit is contained in:
parent
75bad90eef
commit
ab471df24f
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,13 @@
|
||||||
|
import { setupMacOSSDK } from "../macos-sdk"
|
||||||
|
|
||||||
|
jest.setTimeout(300000)
|
||||||
|
describe("setup-macos-sdk", () => {
|
||||||
|
it("should setup macos-sdk", async () => {
|
||||||
|
if (process.platform === "darwin") {
|
||||||
|
process.env.SDKROOT = undefined
|
||||||
|
await setupMacOSSDK()
|
||||||
|
expect(process.env.SDKROOT).toBeTruthy()
|
||||||
|
expect(typeof process.env.SDKROOT).toBe("string")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
|
@ -1,5 +1,4 @@
|
||||||
import { getExecOutput } from "@actions/exec"
|
import { getExecOutput } from "@actions/exec"
|
||||||
import { existsSync } from "fs"
|
|
||||||
import * as core from "@actions/core"
|
import * as core from "@actions/core"
|
||||||
|
|
||||||
export async function setupMacOSSDK() {
|
export async function setupMacOSSDK() {
|
||||||
|
@ -7,8 +6,10 @@ export async function setupMacOSSDK() {
|
||||||
try {
|
try {
|
||||||
const xcrun = await getExecOutput("xcrun --sdk macosx --show-sdk-path")
|
const xcrun = await getExecOutput("xcrun --sdk macosx --show-sdk-path")
|
||||||
const sdkroot = xcrun.stdout || xcrun.stderr
|
const sdkroot = xcrun.stdout || xcrun.stderr
|
||||||
if (existsSync(sdkroot)) {
|
if (sdkroot) {
|
||||||
core.exportVariable("SDKROOT", sdkroot)
|
core.exportVariable("SDKROOT", sdkroot)
|
||||||
|
} else {
|
||||||
|
core.error(`SDKROOT not set`)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
core.error(e as Error | string)
|
core.error(e as Error | string)
|
||||||
|
|
Loading…
Reference in New Issue