2021-11-22 01:06:16 +08:00
|
|
|
import { getExecOutput } from "@actions/exec"
|
2022-08-08 16:22:28 +08:00
|
|
|
import { error } from "ci-log"
|
2024-08-15 09:22:33 +08:00
|
|
|
import { addEnv } from "os-env"
|
2024-08-16 06:22:07 +08:00
|
|
|
import { rcOptions } from "../cli-options.js"
|
2021-11-22 01:06:16 +08:00
|
|
|
|
|
|
|
export async function setupMacOSSDK() {
|
|
|
|
if (process.platform === "darwin") {
|
|
|
|
try {
|
|
|
|
const xcrun = await getExecOutput("xcrun --sdk macosx --show-sdk-path")
|
|
|
|
const sdkroot = xcrun.stdout || xcrun.stderr
|
2021-12-11 19:46:00 +08:00
|
|
|
if (sdkroot) {
|
2024-08-15 09:43:53 +08:00
|
|
|
await addEnv("SDKROOT", sdkroot.trim(), rcOptions)
|
2021-12-11 19:46:00 +08:00
|
|
|
} else {
|
2024-08-07 14:44:32 +08:00
|
|
|
error("SDKROOT not set")
|
2021-11-22 01:06:16 +08:00
|
|
|
}
|
|
|
|
} catch (e) {
|
2022-01-30 07:15:35 +08:00
|
|
|
error(e as Error | string)
|
2021-11-22 01:06:16 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|