blob: 3d7a8e760a1f143b90eda8403ba868bdf446c011 [file] [log] [blame]
/*
* 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;
}