xcode-select copiable command

Reviewed By: ivanmisuno

Differential Revision: D50383695

fbshipit-source-id: 094c0477e44180591b479468fd365959e485da8a
This commit is contained in:
Anton Kastritskiy
2023-10-18 05:55:23 -07:00
committed by Facebook GitHub Bot
parent 683fbfd6fb
commit b9952410b3

View File

@@ -178,23 +178,32 @@ export function getHealthchecks(): FlipperDoctor.Healthchecks {
isRequired: true, isRequired: true,
run: async (_: FlipperDoctor.EnvironmentInfo) => { run: async (_: FlipperDoctor.EnvironmentInfo) => {
const result = await tryExecuteCommand('xcode-select -p'); const result = await tryExecuteCommand('xcode-select -p');
const selectXcodeCommands = [
{
title: 'Select Xcode version',
command: `sudo xcode-select -switch <path/to/>Xcode.app`,
},
];
if (result.hasProblem) { if (result.hasProblem) {
return { return {
hasProblem: true, hasProblem: true,
message: `Xcode version is not selected. You can select it using command "sudo xcode-select -switch <path/to/>Xcode.app". ${result.message}.`, message: `Xcode version is not selected. ${result.message}.`,
commands: selectXcodeCommands,
}; };
} }
const selectedXcode = result.stdout.toString().trim(); const selectedXcode = result.stdout.toString().trim();
if (selectedXcode == '/Library/Developer/CommandLineTools') { if (selectedXcode == '/Library/Developer/CommandLineTools') {
return { return {
hasProblem: true, hasProblem: true,
message: `xcode-select has no Xcode selected, You can select it using command "sudo xcode-select -switch <path/to/>Xcode.app".`, message: `xcode-select has no Xcode selected.`,
commands: selectXcodeCommands,
}; };
} }
if ((await fs_extra.pathExists(selectedXcode)) == false) { if ((await fs_extra.pathExists(selectedXcode)) == false) {
return { return {
hasProblem: true, hasProblem: true,
message: `xcode-select has path of ${selectedXcode}, however this path does not exist on disk. Run "sudo xcode-select --switch" with a valid Xcode.app path.`, message: `xcode-select has path of ${selectedXcode}, however this path does not exist on disk.`,
commands: selectXcodeCommands,
}; };
} }
const validatedXcodeVersion = const validatedXcodeVersion =