forked from Nexus/nexus
Handle xcrun failures via getXCodeSDK/getXCodeClang helpers
This commit is contained in:
parent
f3ea9d67a6
commit
f3787d7f83
2 changed files with 17 additions and 15 deletions
|
|
@ -1,11 +1,22 @@
|
|||
import "dart:io";
|
||||
|
||||
Future<String> getXCodeSDK() async {
|
||||
final result = await Process.run("xcrun", ["--show-sdk-path"]);
|
||||
Future<String> _runXcrun(List<String> args, String errorContext) async {
|
||||
final result = await Process.run("xcrun", args);
|
||||
|
||||
if (result.exitCode != 0) {
|
||||
throw Exception("Failed to get XCode SDK\n${result.stderr}");
|
||||
throw Exception("Failed to $errorContext\n${result.stderr}");
|
||||
}
|
||||
|
||||
return result.stdout.trim();
|
||||
return result.stdout.toString().trim();
|
||||
}
|
||||
|
||||
Future<String> getXCodeSDK({String? sdkType}) => _runXcrun([
|
||||
if (sdkType != null) ...["--sdk", sdkType],
|
||||
"--show-sdk-path",
|
||||
], "get XCode SDK");
|
||||
|
||||
Future<String> getXCodeClang({String? sdkType}) => _runXcrun([
|
||||
if (sdkType != null) ...["--sdk", sdkType],
|
||||
"-f",
|
||||
"clang",
|
||||
], "get XCode clang");
|
||||
|
|
|
|||
Loading…
Reference in a new issue