mirror of
https://github.com/github/codeql-action.git
synced 2026-11-05 04:29:40 +00:00
Add xcodeVersionFromXcodeBuild
This commit is contained in:
60
lib/entry-points.js
generated
60
lib/entry-points.js
generated
@@ -183478,6 +183478,64 @@ function xcodeVersionFromLink(logger2) {
|
||||
return void 0;
|
||||
}
|
||||
}
|
||||
async function xcodeVersionFromXcodeBuild(logger2) {
|
||||
try {
|
||||
const xcrun = await io4.which("xcrun", true);
|
||||
let stdout = "";
|
||||
let stderr = "";
|
||||
const exitCode = await new toolrunner3.ToolRunner(
|
||||
xcrun,
|
||||
["xcodebuild", "-version"],
|
||||
{
|
||||
silent: true,
|
||||
ignoreReturnCode: true,
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
stdout += data.toString("utf-8");
|
||||
},
|
||||
stderr: (data) => {
|
||||
stderr += data.toString("utf-8");
|
||||
}
|
||||
}
|
||||
}
|
||||
).exec();
|
||||
if (exitCode !== 0) {
|
||||
logger2.debug(`xcodebuild returned exit code ${exitCode}`);
|
||||
logger2.debug(`stdout:
|
||||
${stdout}`);
|
||||
logger2.debug(`stderr:
|
||||
${stderr}`);
|
||||
return void 0;
|
||||
}
|
||||
const match2 = stdout.match(/^Xcode (\d+(\.\d+)?)/);
|
||||
if (match2 === null) {
|
||||
logger2.debug(
|
||||
`Output doesn't appear to contain the Xcode product version.`
|
||||
);
|
||||
logger2.debug(`stdout:
|
||||
${stdout}`);
|
||||
logger2.debug(`stderr:
|
||||
${stderr}`);
|
||||
return void 0;
|
||||
}
|
||||
const version = semver6.coerce(match2[1].trim());
|
||||
if (version === null) {
|
||||
logger2.debug(
|
||||
`xcodebuild's output couldn't be parsed as a version:
|
||||
${stdout}`
|
||||
);
|
||||
logger2.debug(`stderr:
|
||||
${stderr}`);
|
||||
return void 0;
|
||||
}
|
||||
return version;
|
||||
} catch (err) {
|
||||
logger2.debug(
|
||||
`Unable to determine Xcode version from xcodebuild: ${getErrorMessage(err)}`
|
||||
);
|
||||
return void 0;
|
||||
}
|
||||
}
|
||||
async function xcodeVersionFromSdk(logger2) {
|
||||
try {
|
||||
const xcrun = await io4.which("xcrun", true);
|
||||
@@ -194063,7 +194121,7 @@ async function checkRunnerSupportsTracedAnalysis(action, config, codeql) {
|
||||
);
|
||||
return;
|
||||
}
|
||||
const xcodeVer = xcodeVersionFromLink(action.logger) ?? await xcodeVersionFromSdk(action.logger);
|
||||
const xcodeVer = xcodeVersionFromLink(action.logger) ?? await xcodeVersionFromXcodeBuild(action.logger) ?? await xcodeVersionFromSdk(action.logger);
|
||||
if (xcodeVer !== void 0 && xcodeVer.major >= UNSUPPORTED_XCODE_FOR_TRACED) {
|
||||
handleUnsupportedVersion(
|
||||
action.logger,
|
||||
|
||||
Reference in New Issue
Block a user