Skip to content

Commit

Permalink
[Skymeld] Include the underlying IOException's details if it happens …
Browse files Browse the repository at this point in the history
…while planting the SymlinkForest.

The current behavior only prints out a generic "ERROR: Failed to prepare the symlink forest" without any further details of what's wrong.

PiperOrigin-RevId: 520577912
Change-Id: I7c124f601ad876b5ac4efd94a538ffee97b3ef0c
  • Loading branch information
joeleba authored and copybara-github committed Mar 30, 2023
1 parent 79e22a3 commit 6146e4a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,12 @@ public void prepareForExecution(UUID buildId, Stopwatch executionTimer)
SkyframeExecutor skyframeExecutor = env.getSkyframeExecutor();

try (SilentCloseable c = Profiler.instance().profile("preparingExecroot")) {
Root singleSourceRoot = Iterables.getOnlyElement(env.getPackageLocator().getPathEntries());
boolean shouldSymlinksBePlanted =
skyframeExecutor.getForcedSingleSourceRootIfNoExecrootSymlinkCreation() == null;
Root singleSourceRoot =
shouldSymlinksBePlanted
? Iterables.getOnlyElement(env.getPackageLocator().getPathEntries())
: skyframeExecutor.getForcedSingleSourceRootIfNoExecrootSymlinkCreation();
IncrementalPackageRoots incrementalPackageRoots =
IncrementalPackageRoots.createAndRegisterToEventBus(
getExecRoot(),
Expand All @@ -267,7 +272,9 @@ public void prepareForExecution(UUID buildId, Stopwatch executionTimer)
env.getDirectories().getProductName() + "-",
request.getOptions(BuildLanguageOptions.class).experimentalSiblingRepositoryLayout,
runtime.getWorkspace().doesAllowExternalRepositories());
incrementalPackageRoots.eagerlyPlantSymlinksToSingleSourceRoot();
if (shouldSymlinksBePlanted) {
incrementalPackageRoots.eagerlyPlantSymlinksToSingleSourceRoot();
}

// We don't plant the symlinks via the subscribers of this ExecRootPreparedEvent, but rather
// via IncrementalPackageRoots.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private static void throwAbruptExitException(IOException e) throws AbruptExitExc
throw new AbruptExitException(
DetailedExitCode.of(
FailureDetail.newBuilder()
.setMessage("Failed to prepare the symlink forest")
.setMessage("Failed to prepare the symlink forest: " + e)
.setSymlinkForest(
FailureDetails.SymlinkForest.newBuilder()
.setCode(FailureDetails.SymlinkForest.Code.CREATION_FAILED))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ protected boolean shouldDeleteActionNodesWhenDroppingAnalysis() {
*/
// TODO(wyv): To be safe, fail early if we're in a multi-repo setup but this is not being tracked.
@Nullable
protected Root getForcedSingleSourceRootIfNoExecrootSymlinkCreation() {
public Root getForcedSingleSourceRootIfNoExecrootSymlinkCreation() {
return null;
}

Expand Down

0 comments on commit 6146e4a

Please sign in to comment.