From f4b5239c8946e1ae1ee7edcaaa703775db451309 Mon Sep 17 00:00:00 2001 From: Googler Date: Wed, 3 Aug 2022 01:33:21 -0700 Subject: [PATCH] Add convenience symlink for Skymeld. This will be done after execution. This is different from regular blaze, which does it before execution. PiperOrigin-RevId: 464996449 Change-Id: I1198e4b787598eef0ec1f5a6211e8743dc9bef84 --- .../build/lib/buildtool/BuildTool.java | 1 + .../build/lib/buildtool/ExecutionTool.java | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java b/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java index 70e2849adde1bf..67f3531f117150 100644 --- a/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java +++ b/src/main/java/com/google/devtools/build/lib/buildtool/BuildTool.java @@ -199,6 +199,7 @@ public void buildTargets(BuildRequest request, BuildResult result, TargetValidat buildCompleted = true; result.setBuildConfigurationCollection( analysisAndExecutionResult.getConfigurationCollection()); + executionTool.handleConvenienceSymlinks(analysisAndExecutionResult); } catch (InvalidConfigurationException | TargetParsingException | LoadingFailedException diff --git a/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java b/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java index c23d99f8a3009f..fb399ea8bb518e 100644 --- a/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java +++ b/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java @@ -673,19 +673,22 @@ private static BuildConfigurationValue getConfiguration( } /** - * Handles what action to perform on the convenience symlinks. If the the mode is {@link + * Handles what action to perform on the convenience symlinks. If the mode is {@link * ConvenienceSymlinksMode#IGNORE}, then skip any creating or cleaning of convenience symlinks. * Otherwise, manage the convenience symlinks and then post a {@link * ConvenienceSymlinksIdentifiedEvent} build event. */ - private void handleConvenienceSymlinks(AnalysisResult analysisResult) { - ImmutableList convenienceSymlinks = ImmutableList.of(); - if (request.getBuildOptions().experimentalConvenienceSymlinks - != ConvenienceSymlinksMode.IGNORE) { - convenienceSymlinks = createConvenienceSymlinks(request.getBuildOptions(), analysisResult); - } - if (request.getBuildOptions().experimentalConvenienceSymlinksBepEvent) { - env.getEventBus().post(new ConvenienceSymlinksIdentifiedEvent(convenienceSymlinks)); + public void handleConvenienceSymlinks(AnalysisResult analysisResult) { + try (SilentCloseable c = + Profiler.instance().profile("ExecutionTool.handleConvenienceSymlinks")) { + ImmutableList convenienceSymlinks = ImmutableList.of(); + if (request.getBuildOptions().experimentalConvenienceSymlinks + != ConvenienceSymlinksMode.IGNORE) { + convenienceSymlinks = createConvenienceSymlinks(request.getBuildOptions(), analysisResult); + } + if (request.getBuildOptions().experimentalConvenienceSymlinksBepEvent) { + env.getEventBus().post(new ConvenienceSymlinksIdentifiedEvent(convenienceSymlinks)); + } } }