Introduces ide_query_cc_analyzer, which figures out relevant build targets that needs to be built for a given C++ source or header file. Once these targets are built, it analyzes the sources in question and reports any generated files that are used back. Full ide_query integration relies on this binary also being available in prebuilts clang-tools, it'll be done in a future patch. Change-Id: Ib0ef6da7a2bc8ecf66940b326e037fb1ee230bf9
112 lines
3.5 KiB
Protocol Buffer
112 lines
3.5 KiB
Protocol Buffer
/*
|
|
* Copyright (C) 2024 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
syntax = "proto3";
|
|
|
|
package ide_query;
|
|
option go_package = "ide_query/ide_query_proto";
|
|
|
|
// Indicates the success/failure for analysis.
|
|
message Status {
|
|
enum Code {
|
|
OK = 0;
|
|
FAILURE = 1;
|
|
}
|
|
Code code = 1;
|
|
// Details about the status, might be displayed to user.
|
|
optional string message = 2;
|
|
}
|
|
|
|
// Represents an Android checkout on user's workstation.
|
|
message RepoState {
|
|
// Absolute path for the checkout in the workstation.
|
|
// e.g. /home/user/work/android/
|
|
string repo_dir = 1;
|
|
// Relative to repo_dir.
|
|
repeated string active_file_path = 2;
|
|
// Repository relative path to output directory in workstation.
|
|
string out_dir = 3;
|
|
// Repository relative path to compile_commands.json in workstation.
|
|
string comp_db_path = 4;
|
|
}
|
|
|
|
// Provides all the targets that are pre-requisities for running language
|
|
// services on active_file_paths.
|
|
message DepsResponse {
|
|
// Build dependencies of a source file for providing language services.
|
|
message Deps {
|
|
// Relative to repo_dir.
|
|
string source_file = 1;
|
|
// Build target to execute for generating dep.
|
|
repeated string build_target = 2;
|
|
optional Status status = 3;
|
|
}
|
|
repeated Deps deps = 1;
|
|
optional Status status = 2;
|
|
}
|
|
|
|
// Returns all the information necessary for providing language services for the
|
|
// active files.
|
|
message GeneratedFile {
|
|
// Path to the file relative to IdeAnalysis.build_artifact_root.
|
|
string path = 1;
|
|
|
|
// The text of the generated file, if not provided contents will be read
|
|
// from the path above in user's workstation.
|
|
optional bytes contents = 2;
|
|
}
|
|
|
|
message SourceFile {
|
|
// Path to the source file relative to repository root.
|
|
string path = 1;
|
|
|
|
// Working directory used by the build system. All the relative
|
|
// paths in compiler_arguments should be relative to this path.
|
|
// Relative to repository root.
|
|
string working_dir = 2;
|
|
|
|
// Compiler arguments to compile the source file. If multiple variants
|
|
// of the module being compiled are possible, the query script will choose
|
|
// one.
|
|
repeated string compiler_arguments = 3;
|
|
|
|
// Any generated files that are used in compiling the file.
|
|
repeated GeneratedFile generated = 4;
|
|
|
|
// Paths to all of the sources, like build files, code generators,
|
|
// proto files etc. that were used during analysis. Used to figure
|
|
// out when a set of build artifacts are stale and the query tool
|
|
// must be re-run.
|
|
// Relative to repository root.
|
|
repeated string deps = 5;
|
|
|
|
// Represents analysis status for this particular file. e.g. not part
|
|
// of the build graph.
|
|
optional Status status = 6;
|
|
}
|
|
|
|
message IdeAnalysis {
|
|
// Path relative to repository root, containing all the artifacts
|
|
// generated by the build system. GeneratedFile.path are always
|
|
// relative to this directory.
|
|
string build_artifact_root = 1;
|
|
|
|
repeated SourceFile sources = 2;
|
|
|
|
// Status representing overall analysis.
|
|
// Should fail only when no analysis can be performed.
|
|
optional Status status = 3;
|
|
}
|