diff options
author | philwo <philwo@google.com> | 2018-05-03 01:05:55 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-05-03 01:06:55 -0700 |
commit | dfa8dcde7388d0f57c2e2f21d96f388a566a4fb6 (patch) | |
tree | 280a917b8e8d9afa13e58ee509986a85358f273e /src/main/java | |
parent | 0810170875fa8c6415369601889377525b26c9c4 (diff) |
Print more debugging info when xcode-locator fails.
It wasn't very helpful to print only stderr, considering that xcode-locator only ever prints to stdout...
PiperOrigin-RevId: 195213838
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/exec/apple/XcodeLocalEnvProvider.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/apple/XcodeLocalEnvProvider.java b/src/main/java/com/google/devtools/build/lib/exec/apple/XcodeLocalEnvProvider.java index a6baec70bb..646b50b1e3 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/apple/XcodeLocalEnvProvider.java +++ b/src/main/java/com/google/devtools/build/lib/exec/apple/XcodeLocalEnvProvider.java @@ -151,17 +151,20 @@ public final class XcodeLocalEnvProvider implements LocalEnvProvider { + "This most likely indicates that SDK version [%s] for platform [%s] is " + "unsupported for the target version of xcode.\n" + "%s\n" - + "Stderr: %s", + + "stdout: %s" + + "stderr: %s", terminationStatus.getExitCode(), sdkVersion, appleSdkPlatform, terminationStatus.toString(), + new String(e.getResult().getStdout(), StandardCharsets.UTF_8), new String(e.getResult().getStderr(), StandardCharsets.UTF_8))); } String message = String.format( - "xcrun failed.\n%s\n%s", + "xcrun failed.\n" + "%s\n" + "stdout: %s\n" + "stderr: %s", e.getResult().getTerminationStatus(), + new String(e.getResult().getStdout(), StandardCharsets.UTF_8), new String(e.getResult().getStderr(), StandardCharsets.UTF_8)); throw new IOException(message, e); } catch (CommandException e) { @@ -220,13 +223,10 @@ public final class XcodeLocalEnvProvider implements LocalEnvProvider { */ private static String queryDeveloperDir(Path execRoot, DottedVersion version) throws IOException { + String xcodeLocatorPath = execRoot.getRelative("_bin/xcode-locator").getPathString(); try { CommandResult xcodeLocatorResult = - new Command( - new String[] { - execRoot.getRelative("_bin/xcode-locator").getPathString(), version.toString() - }) - .execute(); + new Command(new String[] {xcodeLocatorPath, version.toString()}).execute(); return new String(xcodeLocatorResult.getStdout(), StandardCharsets.UTF_8).trim(); } catch (AbnormalTerminationException e) { @@ -236,20 +236,27 @@ public final class XcodeLocalEnvProvider implements LocalEnvProvider { if (e.getResult().getTerminationStatus().exited()) { message = String.format( - "xcode-locator failed with code %s.\n" + "Running '%s %s' failed with code %s.\n" + "This most likely indicates that xcode version %s is not available on the " + "host machine.\n" + "%s\n" + + "stdout: %s\n" + "stderr: %s", + xcodeLocatorPath, + version, terminationStatus.getExitCode(), version, terminationStatus.toString(), + new String(e.getResult().getStdout(), StandardCharsets.UTF_8), new String(e.getResult().getStderr(), StandardCharsets.UTF_8)); } else { message = String.format( - "xcode-locator failed. %s\nstderr: %s", + "Running '%s %s' failed.\n" + "%s\n" + "stdout: %s\n" + "stderr: %s", + xcodeLocatorPath, + version, e.getResult().getTerminationStatus(), + new String(e.getResult().getStdout(), StandardCharsets.UTF_8), new String(e.getResult().getStderr(), StandardCharsets.UTF_8)); } throw new IOException(message, e); |