xref: /aosp_15_r20/build/make/tools/ide_query/cc_analyzer_proto/cc_analyzer.proto (revision 9e94795a3d4ef5c1d47486f9a02bb378756cea8a)
1/*
2 * Copyright (C) 2024 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16syntax = "proto3";
17
18package cc_analyzer;
19
20option go_package = "ide_query/cc_analyzer_proto";
21
22// Indicates the success/failure for analysis.
23message Status {
24  enum Code {
25    OK = 0;
26    FAILURE = 1;
27  }
28  Code code = 1;
29  // Details about the status, might be displayed to user.
30  optional string message = 2;
31}
32
33// Represents an Android checkout on user's workstation.
34message RepoState {
35  // Absolute path for the checkout in the workstation.
36  // e.g. /home/user/work/android/
37  string repo_dir = 1;
38  // Relative to repo_dir.
39  repeated string active_file_path = 2;
40  // Repository relative path to output directory in workstation.
41  string out_dir = 3;
42  // Repository relative path to compile_commands.json in workstation.
43  string comp_db_path = 4;
44}
45
46// Provides all the targets that are pre-requisities for running language
47// services on active_file_paths.
48message DepsResponse {
49  // Build dependencies of a source file for providing language services.
50  message Deps {
51    // Relative to repo_dir.
52    string source_file = 1;
53    // Build target to execute for generating dep.
54    repeated string build_target = 2;
55    optional Status status = 3;
56  }
57  repeated Deps deps = 1;
58  optional Status status = 2;
59}
60
61// Returns all the information necessary for providing language services for the
62// active files.
63message GeneratedFile {
64  // Path to the file relative to repository root.
65  string path = 1;
66
67  // The text of the generated file, if not provided contents will be read
68  // from the path above in user's workstation.
69  optional bytes contents = 2;
70}
71
72message SourceFile {
73  // Path to the source file relative to repository root.
74  string path = 1;
75
76  // Working directory used by the build system. All the relative
77  // paths in compiler_arguments should be relative to this path.
78  // Relative to repository root.
79  string working_dir = 2;
80
81  // Compiler arguments to compile the source file. If multiple variants
82  // of the module being compiled are possible, the query script will choose
83  // one.
84  repeated string compiler_arguments = 3;
85
86  // Any generated files that are used in compiling the file.
87  repeated GeneratedFile generated = 4;
88
89  // Paths to all of the sources, like build files, code generators,
90  // proto files etc. that were used during analysis. Used to figure
91  // out when a set of build artifacts are stale and the query tool
92  // must be re-run.
93  // Relative to repository root.
94  repeated string deps = 5;
95
96  // Represents analysis status for this particular file. e.g. not part
97  // of the build graph.
98  optional Status status = 6;
99}
100
101message IdeAnalysis {
102  repeated SourceFile sources = 2;
103
104  // Status representing overall analysis.
105  // Should fail only when no analysis can be performed.
106  optional Status status = 3;
107
108  reserved 1;
109}
110