Damien Martin-Guillerez | f88f4d8 | 2015-09-25 13:56:55 +0000 | [diff] [blame] | 1 | // Copyright 2014 The Bazel Authors. All rights reserved. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | package com.google.devtools.build.lib.runtime; |
| 15 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 16 | import com.google.common.collect.ImmutableList; |
philwo | d3de5cc | 2018-04-16 06:40:19 -0700 | [diff] [blame] | 17 | import com.google.devtools.build.lib.actions.ExecutorInitException; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 18 | import com.google.devtools.build.lib.analysis.BlazeDirectories; |
| 19 | import com.google.devtools.build.lib.analysis.BlazeVersionInfo; |
| 20 | import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider; |
Ulf Adams | 15a23b9 | 2016-08-09 11:46:00 +0000 | [diff] [blame] | 21 | import com.google.devtools.build.lib.analysis.ServerDirectories; |
mjhalupka | 5d7fa7b | 2018-03-22 13:37:38 -0700 | [diff] [blame] | 22 | import com.google.devtools.build.lib.analysis.config.BuildOptions; |
ulfjack | ab21d18 | 2017-08-10 15:36:14 +0200 | [diff] [blame] | 23 | import com.google.devtools.build.lib.analysis.test.CoverageReportActionFactory; |
Ulf Adams | a0e3af4 | 2016-10-31 16:52:48 +0000 | [diff] [blame] | 24 | import com.google.devtools.build.lib.buildtool.BuildRequest; |
philwo | 3bcb9f6 | 2017-09-06 12:52:21 +0200 | [diff] [blame] | 25 | import com.google.devtools.build.lib.clock.Clock; |
Lukacs Berki | 6e91eb9 | 2015-09-21 09:12:37 +0000 | [diff] [blame] | 26 | import com.google.devtools.build.lib.cmdline.Label; |
Ulf Adams | dba3c83 | 2016-12-21 16:50:02 +0000 | [diff] [blame] | 27 | import com.google.devtools.build.lib.exec.ExecutorBuilder; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 28 | import com.google.devtools.build.lib.packages.NoSuchThingException; |
Nathan Harmata | 42fb560 | 2016-05-25 20:32:08 +0000 | [diff] [blame] | 29 | import com.google.devtools.build.lib.packages.Package; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 30 | import com.google.devtools.build.lib.packages.PackageFactory; |
Nathan Harmata | caa000a | 2016-06-07 17:46:19 +0000 | [diff] [blame] | 31 | import com.google.devtools.build.lib.packages.RuleClassProvider; |
ulfjack | bc4eb27 | 2017-08-10 17:33:22 +0200 | [diff] [blame] | 32 | import com.google.devtools.build.lib.skyframe.OutputService; |
kchodorow | dfcd5da8 | 2017-04-19 18:58:50 +0200 | [diff] [blame] | 33 | import com.google.devtools.build.lib.skyframe.PrecomputedValue; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 34 | import com.google.devtools.build.lib.util.AbruptExitException; |
Klaus Aehlig | d000e0c | 2017-04-28 13:35:05 +0200 | [diff] [blame] | 35 | import com.google.devtools.build.lib.util.io.OutErr; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 36 | import com.google.devtools.build.lib.vfs.FileSystem; |
| 37 | import com.google.devtools.build.lib.vfs.Path; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 38 | import com.google.devtools.common.options.OptionsBase; |
Ulf Adams | 33644a4 | 2016-08-10 11:32:41 +0000 | [diff] [blame] | 39 | import com.google.devtools.common.options.OptionsClassProvider; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 40 | import com.google.devtools.common.options.OptionsProvider; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 41 | import java.io.IOException; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 42 | import java.util.UUID; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 43 | import javax.annotation.Nullable; |
| 44 | |
| 45 | /** |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 46 | * A module Bazel can load at the beginning of its execution. Modules are supplied with extension |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 47 | * points to augment the functionality at specific, well-defined places. |
| 48 | * |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 49 | * <p>The constructors of individual Bazel modules should be empty. All work should be done in the |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 50 | * methods (e.g. {@link #blazeStartup}). |
| 51 | */ |
| 52 | public abstract class BlazeModule { |
| 53 | |
| 54 | /** |
| 55 | * Returns the extra startup options this module contributes. |
| 56 | * |
Ulf Adams | 124bd0a | 2016-08-10 13:10:46 +0000 | [diff] [blame] | 57 | * <p>This method will be called at the beginning of Blaze startup (before {@link #globalInit}). |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 58 | * The startup options need to be parsed very early in the process, which requires this to be |
| 59 | * separate from {@link #serverInit}. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 60 | */ |
| 61 | public Iterable<Class<? extends OptionsBase>> getStartupOptions() { |
| 62 | return ImmutableList.of(); |
| 63 | } |
| 64 | |
| 65 | /** |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 66 | * Called at the beginning of Bazel startup, before {@link #getFileSystem} and |
| 67 | * {@link #blazeStartup}. |
Ulf Adams | 124bd0a | 2016-08-10 13:10:46 +0000 | [diff] [blame] | 68 | * |
| 69 | * @param startupOptions the server's startup options |
| 70 | * |
| 71 | * @throws AbruptExitException to shut down the server immediately |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 72 | */ |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 73 | public void globalInit(OptionsProvider startupOptions) throws AbruptExitException { |
| 74 | } |
| 75 | |
| 76 | /** |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 77 | * Returns the file system implementation used by Bazel. It is an error if more than one module |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 78 | * returns a file system. If all return null, the default unix file system is used. |
| 79 | * |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 80 | * <p>This method will be called at the beginning of Bazel startup (in-between {@link #globalInit} |
| 81 | * and {@link #blazeStartup}). |
Ulf Adams | 124bd0a | 2016-08-10 13:10:46 +0000 | [diff] [blame] | 82 | * |
| 83 | * @param startupOptions the server's startup options |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 84 | */ |
buchgr | 559a07d | 2017-11-30 11:09:35 -0800 | [diff] [blame] | 85 | public FileSystem getFileSystem(OptionsProvider startupOptions) throws AbruptExitException { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 86 | return null; |
| 87 | } |
| 88 | |
| 89 | /** |
tomlu | f903eb5 | 2017-10-27 12:12:11 -0400 | [diff] [blame] | 90 | * Called when Bazel starts up after {@link #getStartupOptions}, {@link #globalInit}, and {@link |
| 91 | * #getFileSystem}. |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 92 | * |
| 93 | * @param startupOptions the server's startup options |
| 94 | * @param versionInfo the Bazel version currently running |
| 95 | * @param instanceId the id of the current Bazel server |
tomlu | f903eb5 | 2017-10-27 12:12:11 -0400 | [diff] [blame] | 96 | * @param fileSystem |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 97 | * @param directories the install directory |
| 98 | * @param clock the clock |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 99 | * @throws AbruptExitException to shut down the server immediately |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 100 | */ |
tomlu | f903eb5 | 2017-10-27 12:12:11 -0400 | [diff] [blame] | 101 | public void blazeStartup( |
| 102 | OptionsProvider startupOptions, |
| 103 | BlazeVersionInfo versionInfo, |
| 104 | UUID instanceId, |
| 105 | FileSystem fileSystem, |
| 106 | ServerDirectories directories, |
| 107 | Clock clock) |
| 108 | throws AbruptExitException {} |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 109 | |
| 110 | /** |
Ulf Adams | 345e15e | 2016-07-07 13:27:28 +0000 | [diff] [blame] | 111 | * Called to initialize a new server ({@link BlazeRuntime}). Modules can override this method to |
| 112 | * affect how the server is configured. This is called after the startup options have been |
| 113 | * collected and parsed, and after the file system was setup. |
| 114 | * |
| 115 | * @param startupOptions the server startup options |
| 116 | * @param builder builder class that collects the server configuration |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 117 | * |
| 118 | * @throws AbruptExitException to shut down the server immediately |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 119 | */ |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 120 | public void serverInit(OptionsProvider startupOptions, ServerBuilder builder) |
| 121 | throws AbruptExitException { |
| 122 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 123 | |
| 124 | /** |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 125 | * Sets up the configured rule class provider, which contains the built-in rule classes, aspects, |
philwo | 3bcb9f6 | 2017-09-06 12:52:21 +0200 | [diff] [blame] | 126 | * configuration fragments, and other things; called during Blaze startup (after {@link |
| 127 | * #blazeStartup}). |
| 128 | * |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 129 | * <p>Bazel only creates one provider per server, so it is not possible to have different contents |
| 130 | * for different workspaces. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 131 | * |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 132 | * @param builder the configured rule class provider builder |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 133 | */ |
philwo | 3bcb9f6 | 2017-09-06 12:52:21 +0200 | [diff] [blame] | 134 | public void initializeRuleClasses(ConfiguredRuleClassProvider.Builder builder) {} |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 135 | |
| 136 | /** |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 137 | * Called when Bazel initializes a new workspace; this is only called after {@link #serverInit}, |
| 138 | * and only if the server initialization was successful. Modules can override this method to |
| 139 | * affect how the workspace is configured. |
| 140 | * |
ulfjack | 94bee75 | 2017-06-13 19:13:35 +0200 | [diff] [blame] | 141 | * @param runtime the blaze runtime |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 142 | * @param directories the workspace directories |
| 143 | * @param builder the workspace builder |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 144 | */ |
ulfjack | 94bee75 | 2017-06-13 19:13:35 +0200 | [diff] [blame] | 145 | public void workspaceInit( |
| 146 | BlazeRuntime runtime, BlazeDirectories directories, WorkspaceBuilder builder) { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | /** |
ulfjack | a6a9910 | 2017-06-13 17:15:45 +0200 | [diff] [blame] | 150 | * Called to notify modules that the given command is about to be executed. This allows capturing |
| 151 | * the {@link com.google.common.eventbus.EventBus}, {@link Command}, or {@link OptionsProvider}. |
| 152 | * |
| 153 | * @param env the command |
| 154 | * @throws AbruptExitException modules can throw this exception to abort the command |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 155 | */ |
ulfjack | a6a9910 | 2017-06-13 17:15:45 +0200 | [diff] [blame] | 156 | public void beforeCommand(CommandEnvironment env) throws AbruptExitException { |
Ulf Adams | 633f539 | 2015-09-15 11:13:08 +0000 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | /** |
Klaus Aehlig | d000e0c | 2017-04-28 13:35:05 +0200 | [diff] [blame] | 160 | * Returns additional listeners to the console output stream. Called at the beginning of each |
| 161 | * command (after #beforeCommand). |
| 162 | */ |
| 163 | @SuppressWarnings("unused") |
| 164 | @Nullable |
| 165 | public OutErr getOutputListener() { |
| 166 | return null; |
| 167 | } |
| 168 | |
| 169 | /** |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 170 | * Returns the output service to be used. It is an error if more than one module returns an |
| 171 | * output service. |
| 172 | * |
| 173 | * <p>This method will be called at the beginning of each command (after #beforeCommand). |
| 174 | */ |
| 175 | @SuppressWarnings("unused") |
| 176 | public OutputService getOutputService() throws AbruptExitException { |
| 177 | return null; |
| 178 | } |
| 179 | |
| 180 | /** |
Ulf Adams | 755dd84 | 2016-06-22 13:43:38 +0000 | [diff] [blame] | 181 | * Returns extra options this module contributes to a specific command. Note that option |
| 182 | * inheritance applies: if this method returns a non-empty list, then the returned options are |
| 183 | * added to every command that depends on this command. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 184 | * |
Ulf Adams | 755dd84 | 2016-06-22 13:43:38 +0000 | [diff] [blame] | 185 | * <p>This method may be called at any time, and the returned value may be cached. Implementations |
| 186 | * must be thread-safe and never return different lists for the same command object. Typical |
| 187 | * implementations look like this: |
Philipp Wollermann | 49c20aa | 2016-08-25 12:59:52 +0000 | [diff] [blame] | 188 | * |
Ulf Adams | 755dd84 | 2016-06-22 13:43:38 +0000 | [diff] [blame] | 189 | * <pre> |
| 190 | * return "build".equals(command.name()) |
| 191 | * ? ImmutableList.<Class<? extends OptionsBase>>of(MyOptions.class) |
| 192 | * : ImmutableList.<Class<? extends OptionsBase>>of(); |
| 193 | * </pre> |
Philipp Wollermann | 49c20aa | 2016-08-25 12:59:52 +0000 | [diff] [blame] | 194 | * |
Ulf Adams | 755dd84 | 2016-06-22 13:43:38 +0000 | [diff] [blame] | 195 | * Note that this example adds options to all commands that inherit from the build command. |
| 196 | * |
| 197 | * <p>This method is also used to generate command-line documentation; in order to avoid |
| 198 | * duplicated options descriptions, this method should never return the same options class for two |
| 199 | * different commands if one of them inherits the other. |
| 200 | * |
| 201 | * <p>If you want to add options to all commands, override {@link #getCommonCommandOptions} |
| 202 | * instead. |
| 203 | * |
| 204 | * @param command the command |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 205 | */ |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 206 | public Iterable<Class<? extends OptionsBase>> getCommandOptions(Command command) { |
| 207 | return ImmutableList.of(); |
| 208 | } |
| 209 | |
| 210 | /** |
Ulf Adams | 755dd84 | 2016-06-22 13:43:38 +0000 | [diff] [blame] | 211 | * Returns extra options this module contributes to all commands. |
| 212 | */ |
| 213 | public Iterable<Class<? extends OptionsBase>> getCommonCommandOptions() { |
| 214 | return ImmutableList.of(); |
| 215 | } |
| 216 | |
| 217 | /** |
mjhalupka | 5d7fa7b | 2018-03-22 13:37:38 -0700 | [diff] [blame] | 218 | * Returns an instance of BuildOptions to be used to create {@link |
| 219 | * BuildOptions.OptionsDiffForReconstruction} with. Only one installed Module should override |
| 220 | * this. |
| 221 | */ |
| 222 | public BuildOptions getDefaultBuildOptions(BlazeRuntime runtime) { |
| 223 | return null; |
| 224 | } |
| 225 | |
| 226 | /** |
Ulf Adams | a0e3af4 | 2016-10-31 16:52:48 +0000 | [diff] [blame] | 227 | * Called when Bazel initializes the action execution subsystem. This is called once per build if |
| 228 | * action execution is enabled. Modules can override this method to affect how execution is |
| 229 | * performed. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 230 | * |
Ulf Adams | a0e3af4 | 2016-10-31 16:52:48 +0000 | [diff] [blame] | 231 | * @param env the command environment |
| 232 | * @param request the build request |
| 233 | * @param builder the builder to add action context providers and consumers to |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 234 | */ |
philwo | d3de5cc | 2018-04-16 06:40:19 -0700 | [diff] [blame] | 235 | public void executorInit(CommandEnvironment env, BuildRequest request, ExecutorBuilder builder) |
| 236 | throws ExecutorInitException {} |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 237 | |
| 238 | /** |
| 239 | * Called after each command. |
| 240 | */ |
| 241 | public void afterCommand() { |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * Called when Blaze shuts down. |
Julio Merino | d1619b75 | 2016-10-17 09:50:11 +0000 | [diff] [blame] | 246 | * |
ajmichael | b31e465 | 2017-11-01 16:45:02 -0400 | [diff] [blame] | 247 | * <p>If you are also implementing {@link #blazeShutdownOnCrash()}, consider putting the common |
Julio Merino | d1619b75 | 2016-10-17 09:50:11 +0000 | [diff] [blame] | 248 | * shutdown code in the latter and calling that other hook from here. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 249 | */ |
| 250 | public void blazeShutdown() { |
| 251 | } |
| 252 | |
| 253 | /** |
Julio Merino | d1619b75 | 2016-10-17 09:50:11 +0000 | [diff] [blame] | 254 | * Called when Blaze shuts down due to a crash. |
| 255 | * |
| 256 | * <p>Modules may use this to flush pending state, but they must be careful to only do a minimal |
| 257 | * number of things. Keep in mind that we are crashing so who knows what state we are in. Modules |
| 258 | * rarely need to implement this. |
| 259 | */ |
| 260 | public void blazeShutdownOnCrash() {} |
| 261 | |
| 262 | /** |
Ulf Adams | 4b004af | 2015-09-16 10:22:26 +0000 | [diff] [blame] | 263 | * Perform module specific check of current command environment. |
Marian Lobur | 7beee71 | 2015-08-17 11:48:57 +0000 | [diff] [blame] | 264 | */ |
Ulf Adams | 4b004af | 2015-09-16 10:22:26 +0000 | [diff] [blame] | 265 | public void checkEnvironment(CommandEnvironment env) { |
Marian Lobur | 7beee71 | 2015-08-17 11:48:57 +0000 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | /** |
Nathan Harmata | 42fb560 | 2016-05-25 20:32:08 +0000 | [diff] [blame] | 269 | * Returns a helper that the {@link PackageFactory} will use during package loading. If the module |
Nathan Harmata | caa000a | 2016-06-07 17:46:19 +0000 | [diff] [blame] | 270 | * does not provide any helper, it should return null. Note that only one helper per Bazel/Blaze |
Nathan Harmata | 42fb560 | 2016-05-25 20:32:08 +0000 | [diff] [blame] | 271 | * runtime is allowed. |
| 272 | */ |
nharmata | e57e9a3 | 2018-04-02 15:10:24 -0700 | [diff] [blame] | 273 | public Package.Builder.Helper getPackageBuilderHelper(RuleClassProvider ruleClassProvider) { |
Nathan Harmata | 42fb560 | 2016-05-25 20:32:08 +0000 | [diff] [blame] | 274 | return null; |
| 275 | } |
| 276 | |
| 277 | /** |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 278 | * Optionally returns a provider for project files that can be used to bundle targets and |
| 279 | * command-line options. |
| 280 | */ |
| 281 | @Nullable |
| 282 | public ProjectFile.Provider createProjectFileProvider() { |
| 283 | return null; |
| 284 | } |
| 285 | |
| 286 | /** |
Ulf Adams | 33644a4 | 2016-08-10 11:32:41 +0000 | [diff] [blame] | 287 | * Optionally returns a factory to create coverage report actions; this is called once per build, |
philwo | 3bcb9f6 | 2017-09-06 12:52:21 +0200 | [diff] [blame] | 288 | * such that it can be affected by command options. |
Ulf Adams | 33644a4 | 2016-08-10 11:32:41 +0000 | [diff] [blame] | 289 | * |
| 290 | * <p>It is an error if multiple modules return non-null values. |
| 291 | * |
| 292 | * @param commandOptions the options for the current command |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 293 | */ |
| 294 | @Nullable |
Ulf Adams | 33644a4 | 2016-08-10 11:32:41 +0000 | [diff] [blame] | 295 | public CoverageReportActionFactory getCoverageReportFactory(OptionsClassProvider commandOptions) { |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 296 | return null; |
| 297 | } |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 298 | |
| 299 | /** |
| 300 | * Services provided for Blaze modules via BlazeRuntime. |
| 301 | */ |
| 302 | public interface ModuleEnvironment { |
| 303 | /** |
| 304 | * Gets a file from the depot based on its label and returns the {@link Path} where it can |
| 305 | * be found. |
| 306 | */ |
| 307 | Path getFileFromWorkspace(Label label) |
| 308 | throws NoSuchThingException, InterruptedException, IOException; |
| 309 | |
| 310 | /** |
Michael Staib | 6e5e8fb | 2016-10-04 21:26:37 +0000 | [diff] [blame] | 311 | * Exits Blaze as early as possible by sending an interrupt to the command's main thread. |
Ulf Adams | 5c54c1c | 2016-08-17 13:31:22 +0000 | [diff] [blame] | 312 | */ |
| 313 | void exit(AbruptExitException exception); |
| 314 | } |
kchodorow | dfcd5da8 | 2017-04-19 18:58:50 +0200 | [diff] [blame] | 315 | |
| 316 | public ImmutableList<PrecomputedValue.Injected> getPrecomputedValues() { |
| 317 | return ImmutableList.of(); |
| 318 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 319 | } |