aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java
Commit message (Collapse)AuthorAge
* Remove the need for discoverInputsStage2(). Much like every other SkyframeGravatar Googler2018-08-01
| | | | | | | | function, discoverInputs() can be implemented to return null upon encountering missing ActionExecutionValues. RELNOTES: None. PiperOrigin-RevId: 206913969
* Instead of depending on mutable inputs of upstream CppCompileAction instances,Gravatar shahan2018-06-26
| | | | | | | | | CppCompileAction.discoverInputsStage2 retrieves values of discovered modules from ActionExecutionValue. This addresses a possible a correctness issue. PiperOrigin-RevId: 202162180
* Remove support for --discard_actions_after_execution.Gravatar tomlu2018-06-18
| | | | | | | The memory savings from this flag are not worth the complexity, and it interferes with action restarting. RELNOTES: Remove support for --discard_actions_after_execution. PiperOrigin-RevId: 201077905
* Remove some dead AbstractAction constructorsGravatar ulfjack2018-05-23
| | | | | | | | The constructors which don't accept an action environment should not be called, with the exception of subclasses that don't run any subprocesses, and therefore don't need an environment. PiperOrigin-RevId: 197706734
* Rename CommandAction.getEnvironment, add AbstractAction.getEnvironmentGravatar ulfjack2018-05-17
| | | | | | | | | | | | | | | This is a cleanup to clarify the code. 1. The getEnvironment method in the CommandAction interface does not have access to the clientEnv, so it's return value is necessarily incomplete. Rename to getIncompleteEnvironmentForTesting. 2. Add a final getEnvironment method to AbstractAction, which returns the ActionEnvironment, which is intended to be a complete description of the intended final environment of the action (technically, of any spawn running within the action). This is not currently used, but is provided to prevent action subclasses to add such a method (it may be used in the future). PiperOrigin-RevId: 196991091
* Fix Cpp{Compile,Link}Action environment and cache key computationGravatar ulfjack2018-05-17
| | | | | | | | | | These were previously ignoring the inhertied environment, i.e., --action_env=PATH did _not_ result in the PATH variable being forwarded from the client environment. Fixes #5142. PiperOrigin-RevId: 196966822
* Migrate AbstractAction and SkylarkActionFactory to buildapiGravatar cparsons2018-05-01
| | | | | RELNOTES: None. PiperOrigin-RevId: 195011200
* Clean up code that directly imports nested classes like Builder, Entry, etc.Gravatar jcater2018-05-01
| | | | PiperOrigin-RevId: 194985157
* Plumbs ActionExecutionContext into AbstractAction.checkOutputsForDirectories.Gravatar shahan2018-04-12
| | | | PiperOrigin-RevId: 192628723
* Expose "mnemonic" and "env" on skylark "Action" objects.Gravatar cparsons2018-04-11
| | | | | RELNOTES: Exposed "mnemonic" and "env" fields on skylark "Action" objects. PiperOrigin-RevId: 192479783
* Fix broken links and formattingGravatar brandjon2018-03-10
| | | | | RELNOTES: None PiperOrigin-RevId: 188625855
* Revamp discussion of executable/test rulesGravatar brandjon2018-03-02
| | | | | | | Rewrite that part of rules.md and update rule() docs. Also clarify the Action object's docs to put it in context. RELNOTES: None PiperOrigin-RevId: 187636896
* Add execution platform information to the action key.Gravatar John Cater2018-03-02
| | | | | | | | | | Needed so that actions are properly invalidated and re-run when the platform's remote execution properties change. Fixes #4756. Closes #4728. Change-Id: Ia227d110c10c9aad2164cefa8a90361cc4359332 PiperOrigin-RevId: 187621349
* Refactor the AbstractAction computeKey method to be easier to add invariantsGravatar jcater2018-02-28
| | | | | | for every type of action. PiperOrigin-RevId: 187368369
* Deletes POLYMORPHIC strategy. ObjectCodec now uses runtime type information ↵Gravatar shahan2018-02-20
| | | | | | to select a codec. PiperOrigin-RevId: 186378153
* Serialize MiddlemanAction and add strategy=Strategy.Polymorphic for Action andGravatar mjhalupka2018-02-20
| | | | | | AbstractAction. PiperOrigin-RevId: 186316435
* Add a CODEC for CppCompileAction.Gravatar cpeyser2018-02-14
| | | | PiperOrigin-RevId: 185733313
* Introduce Root class.Gravatar tomlu2018-01-17
| | | | | | | | | | | This class represents a root (such as a package path or an output root) used for file lookups and artifacts. It is meant to be as opaque as possible in order to hide the user's environment from sky keys and sky functions. Roots are used by RootedPaths and ArtifactRoots. This CL attempts to make the minimum number of modifications necessary to change RootedPath and ArtifactRoot to use these fields. Deprecated methods and invasive accessors are permitted to minimise the risk of any observable changes. RELNOTES: None PiperOrigin-RevId: 182271759
* Fix Action subclasses so that the execution platform is properly set inGravatar John Cater2018-01-04
| | | | | | | | | more cases. Part of #4128. Change-Id: Ife5e4581f91ac07931d193ed5eaa256aab3ad047 PiperOrigin-RevId: 180826445
* Move FileStateValue.Type to Metadata; add Metadata.getType()Gravatar ulfjack2017-12-21
| | | | | | | | This is in preparation for merging FileArtifactValue and FileStateValue. Progress on #3360. PiperOrigin-RevId: 179832948
* Added execution platform to the ActionExecutionMetadata.Gravatar John Cater2017-12-04
| | | | | | | Part of #4128. Change-Id: Id822d3ae6f8daf7c92a75bd8bd28590d4f625845 PiperOrigin-RevId: 177905460
* Add ActionKeyContext to Action#getKey.Gravatar tomlu2017-11-29
| | | | | | | This key context can be used by actions to share partial key computations, for instance when computing MD5s for nested sets. RELNOTES: None PiperOrigin-RevId: 177359607
* Remove some unused extension points.Gravatar Googler2017-11-29
| | | | | RELNOTES: None. PiperOrigin-RevId: 177326265
* Replace all usages of Blaze's Preconditions class with guava.Gravatar tomlu2017-11-09
| | | | | | | | Blaze had its own class to avoid GC from varargs array creation for the precondition happy path. Guava now (mostly) implements these, making it unnecessary to maintain our own. This change was almost entirely automated by search-and-replace. A few BUILD files needed fixing up since I removed an export of preconditions from lib:util, which was all done by add_deps. There was one incorrect usage of Preconditions that was caught by error prone (which checks Guava's version of Preconditions) that I had to change manually. PiperOrigin-RevId: 175033526
* Thread FileSystem through to a single Path#delete call site.Gravatar tomlu2017-10-30
| | | | | | This requires a fairly large amount of changes to fundamental objects like BlazeRuntime, Executor, and so on, as well as changing a lot of test code to thread the file system through. I expect future CLs to be much smaller. PiperOrigin-RevId: 173678144
* ActionInputFileCache: move getMetadata to a new super-interfaceGravatar ulfjack2017-09-11
| | | | | | Update the callers that only need getMetadata to use the new interface. PiperOrigin-RevId: 167992239
* AbstractAction: Use ActionInputFileCache instead of MetadataHandlerGravatar ulfjack2017-09-08
| | | | | | This is a prerequisite for merging the two interfaces. PiperOrigin-RevId: 167843789
* Allow CommandLine expansion to throw an exception.Gravatar tomlu2017-08-24
| | | | | | | | | | | | | | | | | | | This paves the way for Skylark-side compact command lines that can fail during expansion. In general, expansion happens in these scenarios: * Action execution expands the command line to execute it. This is fine since we are well equipped already to handle failing actions. * In the analysis phase we expand command lines to investigate whether we need a params file. This could be moved to the execution phase, which would have the benefit of getting params files out of the action graph and saving memory. * Key computation expands the command line. This could be fixed by allowing command lines to compute their own keys (which wouldn't try to expand the command line). This could have the benefit of being more efficient. * Extra actions expand the command line to construct the extra action proto. This could maybe be deferred to the execution phase (writing the extra action), which would also be more memory efficient. For failed key computations, we return a singleton "error" key. This means multiple actions that will fail will map to the same key. These actions will necessarily fail if executed, so we should not need to worry about these ending up in the action cache. If we do manage to make the command line compute its own keys then this will become moot in the future. RELNOTES: None PiperOrigin-RevId: 166266385
* Move extra action stuff to analysis.extraGravatar ulfjack2017-08-10
| | | | | | | This is part of splitting up the build-base library into separate libraries for analysis, exec, and rules. PiperOrigin-RevId: 164835678
* Remove MetadataHandler.isRegularFileGravatar ulfjack2017-07-28
| | | | | | | Instead use MetadataHandler.getMetadata().isFile(), which is basically what isRegularFile did before. PiperOrigin-RevId: 163351014
* Make SkylarkValue instances mutable by defaultGravatar vladmos2017-07-11
| | | | | | | | | | Simplify the code by providing the default implementation of `SkylarkValue$isImmutable` that always returns false. All objects are considered mutable unless their `isImmutable` method is overridden. This change doesn't affect the current behavior. PiperOrigin-RevId: 161422029
* Update SpawnAction to take an ActionEnvironmentGravatar ulfjack2017-07-05
| | | | | | | | | | Some of the callers are not using the proper one from the configuration, and are thus ignoring --action_env. Some are only using part of the configuration's action environment. I tried to carefully not change the semantics in any case. Semantic-changing changes come later. PiperOrigin-RevId: 160891204
* Implement ctx.actions.expand_template.Gravatar dslomov2017-07-05
| | | | | | | | It also changes the return value of ctx.template_action to None, so a very minor breaking change. There are no internal usages at least. RELNOTES: None. PiperOrigin-RevId: 160825636
* Migrate tests to ctx.actions.run/run_shell.Gravatar dslomov2017-07-05
| | | | | RELNOTES: None. PiperOrigin-RevId: 160817326
* Refactor PrinterGravatar vladmos2017-07-03
| | | | | | | It's now easier to customize Printer if in different situations objects should be printed differently. Also its API is cleaner now. Names of methods of SkylarkValue objects now reflect names of Skylark functions: SkylarkValue#repr and SkylarkPrintableValue#str. PiperOrigin-RevId: 160635154
* Introduce ctx.actions.write in place of ctx.file_action.Gravatar dslomov2017-06-30
| | | | | RELNOTES: None. PiperOrigin-RevId: 160630261
* If --batch, --keep_going, --discard_analysis_cache, and the new ↵Gravatar janakr2017-03-31
| | | | | | | | | | | | | | | --noexperimental_enable_critical_path_profiling flags are all specified, then Bazel will delete Actions from ActionLookupValues as they are executed in order to save memory. Because an already-run action may output an artifact that is only requested later in the build, we need to maintain a way for the artifact to look up the action. But in most cases we don't need to keep the action itself, just its output metadata. Some actions unfortunately are needed post-execution, and so we special-case them. Also includes dependency change with description: Move action out of key. This keeps action references from polluting the graph -- actions are just stored in one SkyValue, instead of being present in SkyKeys. This does mean additional memory used: we have a separate ActionLookupData object per Action executed. That may reach ~24M for million-action builds. PiperOrigin-RevId: 151756383
* A partial, manual rollback of commit 7af14dfdbd6addb779226c0a103b2a8dc72c16b1.Gravatar Lukacs Berki2017-03-14
| | | | | | | | This became necessary because extra actions for C++ compile actions require .h files, but the compiler only returns the .pcm files in the .d file for headers that it reads from the .pcm file. This is not a problem for correctness because the .pcm files depend on the headers, but that doesn't help the extra actions that would then only get the .pcm files. -- PiperOrigin-RevId: 150052839 MOS_MIGRATED_REVID=150052839
* Clean up the semantics of input discovering actions a bit by making ↵Gravatar Lukacs Berki2017-02-28
| | | | | | | | | | | | updateInputs() and inputsKnown() non-overridable and removing setInputs(). This comes at the cost of adding a flag to every action instance that's not used for non-input-discovering actions, but I think that's a deal. Simpler APIs are good, mmmmkay? Also fixed a few pre-existing issues in TestAction and ObjcCompileAction. -- PiperOrigin-RevId: 148749734 MOS_MIGRATED_REVID=148749734
* Remove AbtractAction#getInputsForExtraAction() (the third time).Gravatar Lukacs Berki2017-02-27
| | | | | | | | | | This time, if the action discovers inputs, the extra action is made to depend on the outputs of the action so that by the time the extra action runs, the inputs of the original action are discovered. This avoids us having to think about the state the shadowed action may keep. Yes, actions should not keep state, but they do. Such is life. -- PiperOrigin-RevId: 148627715 MOS_MIGRATED_REVID=148627715
* Rollback of commit e716ae46f359dc1361574f44569811ff80a758ac.Gravatar Ulf Adams2017-02-24
| | | | | | -- PiperOrigin-RevId: 148445872 MOS_MIGRATED_REVID=148445872
* Encore of commit 41c2a26eef89167e807cbc9f33487dc66bb757d3 that removed ↵Gravatar Lukacs Berki2017-02-24
| | | | | | | | | | | | | | | | | | | AbstractAction#getInputFilesForExtraAction(). Turns out, we didn't add *mandatory* inputs of the shadowed action to the extra action, thus, breakage. Original description: Remove AbstractAction#getInputFilesForExtraAction(). This method was used to return the discovered inputs for extra actions, but it turns out that we can use #discoverInputs() just as well. Note that this makes it possible for #discoverInputs() to be called more than once per action instance (once for the action and once for each extra action), but this appears to work. A followup change may be able to dispense with that, but let's take baby steps for now. Also note that this introduces synchronization between an action and its associated extra action. -- PiperOrigin-RevId: 148429641 MOS_MIGRATED_REVID=148429641
* Rollback of commit 41c2a26eef89167e807cbc9f33487dc66bb757d3.Gravatar Carmi Grushko2017-02-20
| | | | | | | | | | This is not a clean rollback: I had to change CppCompileAction on line 1278 and pass cppSemantics.getIncludeProcessing(). Please flag this if it doesn't make sense :) -- PiperOrigin-RevId: 147868235 MOS_MIGRATED_REVID=147868235
* Remove AbstractAction#getInputFilesForExtraAction().Gravatar Lukacs Berki2017-02-03
| | | | | | | | | | | | This method was used to return the discovered inputs for extra actions, but it turns out that we can use #discoverInputs() just as well. Note that this makes it possible for #discoverInputs() to be called more than once per action instance (once for the action and once for each extra action), but this appears to work. A followup change may be able to dispense with that, but let's take baby steps for now. Also note that this introduces synchronization between an action and its associated extra action. -- PiperOrigin-RevId: 146450132 MOS_MIGRATED_REVID=146450132
* Simplify the Action interface by asking it a set of allowed inputs instead ↵Gravatar Lukacs Berki2017-02-02
| | | | | | | | | | of to resolve exec paths found in the action cache. The resolution algorithm was the same in all cases where it was implemented. -- PiperOrigin-RevId: 146344672 MOS_MIGRATED_REVID=146344672
* Simplify action input discovery by removing ↵Gravatar Lukacs Berki2017-01-31
| | | | | | | | | | Action#getInputsWhenSkippingInputDiscovery(). This has the side effect of always allowing new inputs to be discovered when Action#discoversInputs() return true, but since those actions are very few and have mostly to do with C++, I think it's an acceptable tradeoff for th ecode being that much simpler. -- PiperOrigin-RevId: 146098150 MOS_MIGRATED_REVID=146098150
* Names of extra-action protos now take into account all aspect names.Gravatar Dmitry Lomov2016-12-16
| | | | | | | | | | | | | If an Aspect registered an action that an extra-action is shadowing, its name is used when creating the extra-action's ID and name. Since recently, an aspect can see other aspects applied to the same target. This CL record the names of other aspects applied to the target as well, disambiguating the action owners. -- PiperOrigin-RevId: 142264153 MOS_MIGRATED_REVID=142264153
* Prune modules when building modules themselves to reduce build times shortenGravatar Googler2016-12-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | critical paths. When the inputs of a module M are reduced to a set S, then that same set S also needs to be supplied to compile something that uses M. To do this, input discovery is divided into two stages. For each CppCompileAction, the first stage discovers the necessary modules (M above). These are then added as inputs to ensure that they are built. The second stage then finds all the modules (S above) that are required to use those and also adds them as inputs. For now, the new behavior is guarded by a new flag --experimental_prune_more_modules. This is currently implemented by reading the .d files of used modules add adding all their module dependencies. There are two noteworthy alternatives: 1. Hack up input discovery to understand modules, e.g. if a modular header is hit, continue scanning from all it's headers. However, this seems very brittle and a lot of additional information would have to be passed to the input discovery. 2. Directly pass the results from input discovery of one CppCompileAction to another one. However, this seems to tightly couple the execution of different CppCompileActions and might lead to a mess of different states, more memory consumption, etc. With the current implementation, there is a bit of runtime overhead of reading the .d files (many times). This could potentially be improved by caching the results. However, even without this caching, the runtime overhead is limited (<10%) for all builds I have tried (I have tried with builds where all the compile results are already in the executor's cache. -- MOS_MIGRATED_REVID=140793217
* Properly handle bazel's output deletion within a write-protected directory.Gravatar Kush Chakraborty2016-11-23
| | | | | | | | Currently, we fail in deleting outputs from a previous invocation in a write-protected directory. This change retries deleting the outputs, after making the parent write-protected directory writable again. -- MOS_MIGRATED_REVID=140035023
* Fix up documentation for Actions APIGravatar Jon Brandvein2016-11-18
| | | | | -- MOS_MIGRATED_REVID=139569372