diff options
author | 2016-03-30 12:23:50 +0000 | |
---|---|---|
committer | 2016-03-30 15:23:50 +0000 | |
commit | ab43b97040a04d21cb951e1c59b760fc67dfaa3d (patch) | |
tree | 0acf85e9804cad3ef40f9f9f79249f2329cee82f /src/main/java/com/google/devtools/build/lib/runtime/commands | |
parent | 94b72db92b54af7a6b1e7a5a48b218b26ac761e5 (diff) |
Move most of the workspace-handling code from BlazeRuntime to a new class.
--
MOS_MIGRATED_REVID=118563271
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/commands')
3 files changed, 14 insertions, 13 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java index 12630051e6..5ebac2c953 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java @@ -20,7 +20,6 @@ import com.google.devtools.build.lib.buildtool.OutputDirectoryLinksUtils; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.runtime.BlazeCommand; import com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.ShutdownBlazeServerException; -import com.google.devtools.build.lib.runtime.BlazeRuntime; import com.google.devtools.build.lib.runtime.Command; import com.google.devtools.build.lib.runtime.CommandEnvironment; import com.google.devtools.build.lib.shell.CommandException; @@ -125,7 +124,6 @@ public final class CleanCommand implements BlazeCommand { private void actuallyClean(CommandEnvironment env, Path outputBase, Options cleanOptions, String symlinkPrefix) throws IOException, ShutdownBlazeServerException, CommandException, ExecException, InterruptedException { - BlazeRuntime runtime = env.getRuntime(); if (env.getOutputService() != null) { env.getOutputService().clean(); } @@ -162,7 +160,7 @@ public final class CleanCommand implements BlazeCommand { .build().execute(); } else { LOG.info("Output cleaning..."); - runtime.clearCaches(); + env.getBlazeWorkspace().clearCaches(); // In order to be sure that we delete everything, delete the workspace directory both for // --deep_execroot and for --nodeep_execroot. for (String directory : new String[] { diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java index 6acf54658b..b18714e695 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java @@ -23,6 +23,7 @@ import com.google.devtools.build.lib.runtime.BlazeCommandUtils; import com.google.devtools.build.lib.runtime.BlazeRuntime; import com.google.devtools.build.lib.runtime.Command; import com.google.devtools.build.lib.runtime.CommandEnvironment; +import com.google.devtools.build.lib.skyframe.SkyframeExecutor; import com.google.devtools.build.lib.util.ExitCode; import com.google.devtools.build.lib.vfs.FileSystemUtils; import com.google.devtools.common.options.EnumConverter; @@ -166,7 +167,9 @@ public class DumpCommand implements BlazeCommand { } if (dumpOptions.dumpSkyframe != SkyframeDumpOption.OFF) { - success &= dumpSkyframe(runtime, dumpOptions.dumpSkyframe == SkyframeDumpOption.SUMMARY, + success &= dumpSkyframe( + env.getSkyframeExecutor(), + dumpOptions.dumpSkyframe == SkyframeDumpOption.SUMMARY, out); out.println(); } @@ -188,8 +191,8 @@ public class DumpCommand implements BlazeCommand { return true; } - private boolean dumpSkyframe(BlazeRuntime runtime, boolean summarize, PrintStream out) { - runtime.getSkyframeExecutor().dump(summarize, out); + private boolean dumpSkyframe(SkyframeExecutor executor, boolean summarize, PrintStream out) { + executor.dump(summarize, out); return true; } diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java index 65d72552f2..f9b217d1d5 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java @@ -284,11 +284,11 @@ public class InfoCommand implements BlazeCommand { Supplier<BuildConfiguration> configurationSupplier, OptionsProvider options) { switch (key) { // directories - case WORKSPACE : return runtime.getDirectories().getWorkspace(); - case INSTALL_BASE : return runtime.getDirectories().getInstallBase(); - case OUTPUT_BASE : return runtime.getDirectories().getOutputBase(); - case EXECUTION_ROOT : return runtime.getDirectories().getExecRoot(); - case OUTPUT_PATH : return runtime.getDirectories().getOutputPath(); + case WORKSPACE : return runtime.getWorkspace().getWorkspace(); + case INSTALL_BASE : return runtime.getWorkspace().getInstallBase(); + case OUTPUT_BASE : return runtime.getWorkspace().getOutputBase(); + case EXECUTION_ROOT : return runtime.getWorkspace().getExecRoot(); + case OUTPUT_PATH : return runtime.getWorkspace().getOutputPath(); // These are the only (non-hidden) info items that require a configuration, because the // corresponding paths contain the short name. Maybe we should recommend using the symlinks // or make them hidden by default? @@ -298,10 +298,10 @@ public class InfoCommand implements BlazeCommand { // logs case COMMAND_LOG : return BlazeCommandDispatcher.getCommandLogPath( - runtime.getDirectories().getOutputBase()); + runtime.getWorkspace().getOutputBase()); case MESSAGE_LOG : // NB: Duplicated in EventLogModule - return runtime.getDirectories().getOutputBase().getRelative("message.log"); + return runtime.getWorkspace().getOutputBase().getRelative("message.log"); // misc case RELEASE : return BlazeVersionInfo.instance().getReleaseName(); |