1// Copyright 2018 The Bazel Authors. All rights reserved.
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.
14syntax = "proto3";
15package analysis;
16import "build/build.proto";
17option java_package = "com.google.devtools.build.lib.analysis";
18option java_outer_classname = "AnalysisProtosV2";
19option go_package = "prebuilts/bazel/common/proto/analysis_v2";
20// Container for the action graph properties.
21message ActionGraphContainer {
22  repeated Artifact artifacts = 1;
23  repeated Action actions = 2;
24  repeated Target targets = 3;
25  repeated DepSetOfFiles dep_set_of_files = 4;
26  repeated Configuration configuration = 5;
27  repeated AspectDescriptor aspect_descriptors = 6;
28  repeated RuleClass rule_classes = 7;
29  repeated PathFragment path_fragments = 8;
30}
31// Represents a single artifact, whether it's a source file or a derived output
32// file.
33message Artifact {
34  // Identifier for this artifact; this is a uint32, only valid for this
35  // particular dump of the analysis.
36  uint32 id = 1;
37  // The id of the PathFragment that represents the relative path of the file
38  // within the execution root.
39  uint32 path_fragment_id = 2;
40  // True iff the artifact is a tree artifact, i.e. the above exec_path refers
41  // a directory.
42  bool is_tree_artifact = 3;
43}
44// Represents a single action, which is a function from Artifact(s) to
45// Artifact(s).
46message Action {
47  // The target that was responsible for the creation of the action.
48  uint32 target_id = 1;
49  // The aspects that were responsible for the creation of the action (if any).
50  // In the case of aspect-on-aspect, AspectDescriptors are listed in
51  // topological order of the dependency graph.
52  // e.g. [A, B] would imply that aspect A is applied on top of aspect B.
53  repeated uint32 aspect_descriptor_ids = 2;
54  // Encodes all significant behavior that might affect the output. The key
55  // must change if the work performed by the execution of this action changes.
56  // Note that the key doesn't include checksums of the input files.
57  string action_key = 3;
58  // The mnemonic for this kind of action.
59  string mnemonic = 4;
60  // The configuration under which this action is executed.
61  uint32 configuration_id = 5;
62  // The command line arguments of the action. This will be only set if
63  // explicitly requested.
64  repeated string arguments = 6;
65  // The list of environment variables to be set before executing the command.
66  repeated KeyValuePair environment_variables = 7;
67  // The set of input dep sets that the action depends upon. If the action does
68  // input discovery, the contents of this set might change during execution.
69  repeated uint32 input_dep_set_ids = 8;
70  // The list of Artifact IDs that represent the output files that this action
71  // will generate.
72  repeated uint32 output_ids = 9;
73  // True iff the action does input discovery during execution.
74  bool discovers_inputs = 10;
75  // Execution info for the action.  Remote execution services may use this
76  // information to modify the execution environment, but actions will
77  // generally not be aware of it.
78  repeated KeyValuePair execution_info = 11;
79  // The list of param files. This will be only set if explicitly requested.
80  repeated ParamFile param_files = 12;
81  // The id to an Artifact that is the primary output of this action.
82  uint32 primary_output_id = 13;
83  // The execution platform for this action. Empty if the action has no
84  // execution platform.
85  string execution_platform = 14;
86  // The template content of the action, if it is TemplateExpand action.
87  string template_content = 15;
88  // The list of substitution should be performed on the template. The key is
89  // the string to be substituted and the value is the string to be substituted
90  // to.
91  repeated KeyValuePair substitutions = 16;
92  // The contents of the file for the actions.write() action
93  // (guarded by the --include_file_write_contents flag).
94  string file_contents = 17;
95  // The target of the symlink created by UnresolvedSymlink actions.
96  // For regular Symlink actions, the target is represented as an input.
97  string unresolved_symlink_target = 18;
98  // If FileWrite actions should make their output executable.
99  // (ctx.actions.write(is_executable=True))
100  bool is_executable = 19;
101}
102// Represents a single target (without configuration information) that is
103// associated with an action.
104message Target {
105  // Identifier for this target; this is a uint32, only valid for this
106  // particular dump of the analysis.
107  uint32 id = 1;
108  // Label of the target, e.g. //foo:bar.
109  string label = 2;
110  // Class of the rule.
111  uint32 rule_class_id = 3;
112}
113message RuleClass {
114  // Identifier for this rule class; this is a uint32, only valid for
115  // this particular dump of the analysis.
116  uint32 id = 1;
117  // Name of the rule class, e.g. cc_library.
118  string name = 2;
119}
120// Represents an invocation specific descriptor of an aspect.
121message AspectDescriptor {
122  // Identifier for this aspect descriptor; this is a uint32, only valid
123  // for the particular dump of the analysis.
124  uint32 id = 1;
125  // The name of the corresponding aspect. For native aspects, it's the Java
126  // class name, for Starlark aspects it's the bzl file followed by a % sign
127  // followed by the name of the aspect.
128  string name = 2;
129  // The list of parameters bound to a particular invocation of that aspect on
130  // a target. Note that aspects can be executed multiple times on the same
131  // target in different order.
132  repeated KeyValuePair parameters = 3;
133}
134message DepSetOfFiles {
135  // Identifier for this named set of files; this is a uint32, only
136  // valid for the particular dump of the analysis.
137  uint32 id = 1;
138  // Other transitively included named set of files.
139  repeated uint32 transitive_dep_set_ids = 2;
140  // The list of input artifact IDs that are immediately contained in this set.
141  repeated uint32 direct_artifact_ids = 3;
142}
143message Configuration {
144  // Identifier for this configuration; this is a uint32, only valid for
145  // the particular dump of the analysis.
146  uint32 id = 1;
147  // The mnemonic representing the build configuration.
148  string mnemonic = 2;
149  // The platform string.
150  string platform_name = 3;
151  // The checksum representation of the configuration options;
152  string checksum = 4;
153  // Whether this configuration is used for building tools.
154  bool is_tool = 5;
155}
156message KeyValuePair {
157  // The variable name.
158  string key = 1;
159  // The variable value.
160  string value = 2;
161}
162message ConfiguredTarget {
163  // The target. We use blaze_query.Target defined in build.proto instead of
164  // the Target defined in this file because blaze_query.Target is much heavier
165  // and will output proto results similar to what users are familiar with from
166  // regular blaze query.
167  blaze_query.Target target = 1;
168  // DEPRECATED. Use configuration_id instead.
169  Configuration configuration = 2 [deprecated = true];
170  // The id of the configuration this target is configured for. The actual
171  // Configuration message can be found in CqueryResults. If the target doesn't
172  // have a configuration, the value will be 0.
173  uint32 configuration_id = 3;
174}
175// Container for cquery results
176message CqueryResult {
177  // All the configuredtargets returns by cquery
178  repeated ConfiguredTarget results = 1;
179  // All the Configurations referenced by results.
180  repeated Configuration configurations = 2;
181}
182// Content of a param file.
183message ParamFile {
184  // The exec path of the param file artifact.
185  string exec_path = 1;
186  // The arguments in the param file.
187  // Each argument corresponds to a line in the param file.
188  repeated string arguments = 2;
189}
190// The path fragment that makes up a full path.
191message PathFragment {
192  // Identifier for this path fragment.
193  uint32 id = 1;
194  // The label of the section in the path.
195  string label = 2;
196  // The id of the parent path fragment.
197  uint32 parent_id = 3;
198}
199
200