• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 ide_query;
19option go_package = "ide_query/ide_query_proto";
20
21// Indicates the success/failure for analysis.
22message Status {
23  enum Code {
24    OK = 0;
25    FAILURE = 1;
26  }
27  Code code = 1;
28  // Details about the status, might be displayed to user.
29  optional string message = 2;
30}
31
32// Represents an Android checkout on user's workstation.
33message RepoState {
34  // Absolute path for the checkout in the workstation.
35  // e.g. /home/user/work/android/
36  string repo_dir = 1;
37  // Relative to repo_dir.
38  repeated string active_file_path = 2;
39  // Repository relative path to output directory in workstation.
40  string out_dir = 3;
41  // Repository relative path to compile_commands.json in workstation.
42  string comp_db_path = 4;
43}
44
45// Provides all the targets that are pre-requisities for running language
46// services on active_file_paths.
47message DepsResponse {
48  // Build dependencies of a source file for providing language services.
49  message Deps {
50    // Relative to repo_dir.
51    string source_file = 1;
52    // Build target to execute for generating dep.
53    repeated string build_target = 2;
54    optional Status status = 3;
55  }
56  repeated Deps deps = 1;
57  optional Status status = 2;
58}
59
60// Returns all the information necessary for providing language services for the
61// active files.
62message GeneratedFile {
63  // Path to the file relative to IdeAnalysis.build_artifact_root.
64  string path = 1;
65
66  // The text of the generated file, if not provided contents will be read
67  // from the path above in user's workstation.
68  optional bytes contents = 2;
69}
70
71message SourceFile {
72  // Path to the source file relative to repository root.
73  string path = 1;
74
75  // Working directory used by the build system. All the relative
76  // paths in compiler_arguments should be relative to this path.
77  // Relative to repository root.
78  string working_dir = 2;
79
80  // Compiler arguments to compile the source file. If multiple variants
81  // of the module being compiled are possible, the query script will choose
82  // one.
83  repeated string compiler_arguments = 3;
84
85  // Any generated files that are used in compiling the file.
86  repeated GeneratedFile generated = 4;
87
88  // Paths to all of the sources, like build files, code generators,
89  // proto files etc. that were used during analysis. Used to figure
90  // out when a set of build artifacts are stale and the query tool
91  // must be re-run.
92  // Relative to repository root.
93  repeated string deps = 5;
94
95  // Represents analysis status for this particular file. e.g. not part
96  // of the build graph.
97  optional Status status = 6;
98}
99
100message IdeAnalysis {
101  // Path relative to repository root, containing all the artifacts
102  // generated by the build system. GeneratedFile.path are always
103  // relative to this directory.
104  string build_artifact_root = 1;
105
106  repeated SourceFile sources = 2;
107
108  // Status representing overall analysis.
109  // Should fail only when no analysis can be performed.
110  optional Status status = 3;
111}
112