Add CC analysis support to ide_query
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
This commit is contained in:
parent
81f8ba86f3
commit
0769200450
13 changed files with 1262 additions and 149 deletions
80
tools/ide_query/cc_analyzer/Android.bp
Normal file
80
tools/ide_query/cc_analyzer/Android.bp
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package {
|
||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||
}
|
||||
|
||||
cc_defaults {
|
||||
name: "ide_query_cc_analyzer_defaults",
|
||||
compile_multilib: "64",
|
||||
defaults: [
|
||||
"llvm-build-host-tools-defaults",
|
||||
],
|
||||
cflags: [
|
||||
// LLVM Sources do have unused parameters :(
|
||||
"-Wno-unused-parameter",
|
||||
],
|
||||
target: {
|
||||
host: {
|
||||
cppflags: [
|
||||
"-fno-rtti",
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cc_library_host_static {
|
||||
name: "builtin_headers",
|
||||
srcs: ["builtin_headers.cc"],
|
||||
generated_headers: ["clang_builtin_headers_resources"],
|
||||
defaults: ["ide_query_cc_analyzer_defaults"],
|
||||
}
|
||||
|
||||
cc_library_host_static {
|
||||
name: "include_scanner",
|
||||
srcs: ["include_scanner.cc"],
|
||||
shared_libs: ["libclang-cpp_host"],
|
||||
static_libs: ["builtin_headers"],
|
||||
defaults: ["ide_query_cc_analyzer_defaults"],
|
||||
}
|
||||
|
||||
cc_library_host_static {
|
||||
name: "analyzer",
|
||||
srcs: ["analyzer.cc"],
|
||||
shared_libs: ["libclang-cpp_host"],
|
||||
static_libs: [
|
||||
"include_scanner",
|
||||
"ide_query_proto",
|
||||
],
|
||||
defaults: ["ide_query_cc_analyzer_defaults"],
|
||||
}
|
||||
|
||||
cc_binary_host {
|
||||
name: "ide_query_cc_analyzer",
|
||||
defaults: ["ide_query_cc_analyzer_defaults"],
|
||||
srcs: ["main.cc"],
|
||||
shared_libs: [
|
||||
"libclang-cpp_host",
|
||||
"libprotobuf-cpp-full",
|
||||
],
|
||||
static_libs: [
|
||||
"ide_query_proto",
|
||||
"builtin_headers",
|
||||
"include_scanner",
|
||||
"analyzer",
|
||||
],
|
||||
}
|
147
tools/ide_query/cc_analyzer/analyzer.cc
Normal file
147
tools/ide_query/cc_analyzer/analyzer.cc
Normal file
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "analyzer.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "clang/Tooling/CompilationDatabase.h"
|
||||
#include "clang/Tooling/JSONCompilationDatabase.h"
|
||||
#include "ide_query.pb.h"
|
||||
#include "include_scanner.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include "llvm/Support/VirtualFileSystem.h"
|
||||
|
||||
namespace tools::ide_query::cc_analyzer {
|
||||
namespace {
|
||||
llvm::Expected<std::unique_ptr<clang::tooling::CompilationDatabase>> LoadCompDB(
|
||||
llvm::StringRef comp_db_path) {
|
||||
std::string err;
|
||||
std::unique_ptr<clang::tooling::CompilationDatabase> db =
|
||||
clang::tooling::JSONCompilationDatabase::loadFromFile(
|
||||
comp_db_path, err, clang::tooling::JSONCommandLineSyntax::AutoDetect);
|
||||
if (!db) {
|
||||
return llvm::createStringError(llvm::inconvertibleErrorCode(),
|
||||
"Failed to load CDB: " + err);
|
||||
}
|
||||
// Provide some heuristic support for missing files.
|
||||
return inferMissingCompileCommands(std::move(db));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
::ide_query::DepsResponse GetDeps(::ide_query::RepoState state) {
|
||||
::ide_query::DepsResponse results;
|
||||
auto db = LoadCompDB(state.comp_db_path());
|
||||
if (!db) {
|
||||
results.mutable_status()->set_code(::ide_query::Status::FAILURE);
|
||||
results.mutable_status()->set_message(llvm::toString(db.takeError()));
|
||||
return results;
|
||||
}
|
||||
for (llvm::StringRef active_file : state.active_file_path()) {
|
||||
auto& result = *results.add_deps();
|
||||
|
||||
llvm::SmallString<256> abs_file(state.repo_dir());
|
||||
llvm::sys::path::append(abs_file, active_file);
|
||||
auto cmds = db->get()->getCompileCommands(active_file);
|
||||
if (cmds.empty()) {
|
||||
result.mutable_status()->set_code(::ide_query::Status::FAILURE);
|
||||
result.mutable_status()->set_message(
|
||||
llvm::Twine("Can't find compile flags for file: ", abs_file).str());
|
||||
continue;
|
||||
}
|
||||
result.set_source_file(active_file.str());
|
||||
llvm::StringRef file = cmds[0].Filename;
|
||||
if (llvm::StringRef actual_file(cmds[0].Heuristic);
|
||||
actual_file.consume_front("inferred from ")) {
|
||||
file = actual_file;
|
||||
}
|
||||
// TODO: Query ninja graph to figure out a minimal set of targets to build.
|
||||
result.add_build_target(file.str() + "^");
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
::ide_query::IdeAnalysis GetBuildInputs(::ide_query::RepoState state) {
|
||||
auto db = LoadCompDB(state.comp_db_path());
|
||||
::ide_query::IdeAnalysis results;
|
||||
if (!db) {
|
||||
results.mutable_status()->set_code(::ide_query::Status::FAILURE);
|
||||
results.mutable_status()->set_message(llvm::toString(db.takeError()));
|
||||
return results;
|
||||
}
|
||||
std::string repo_dir = state.repo_dir();
|
||||
if (!repo_dir.empty() && repo_dir.back() == '/') repo_dir.pop_back();
|
||||
|
||||
llvm::SmallString<256> genfile_root_abs(repo_dir);
|
||||
llvm::sys::path::append(genfile_root_abs, state.out_dir());
|
||||
if (genfile_root_abs.empty() || genfile_root_abs.back() != '/') {
|
||||
genfile_root_abs.push_back('/');
|
||||
}
|
||||
|
||||
results.set_build_artifact_root(state.out_dir());
|
||||
for (llvm::StringRef active_file : state.active_file_path()) {
|
||||
auto& result = *results.add_sources();
|
||||
result.set_path(active_file.str());
|
||||
|
||||
llvm::SmallString<256> abs_file(repo_dir);
|
||||
llvm::sys::path::append(abs_file, active_file);
|
||||
auto cmds = db->get()->getCompileCommands(abs_file);
|
||||
if (cmds.empty()) {
|
||||
result.mutable_status()->set_code(::ide_query::Status::FAILURE);
|
||||
result.mutable_status()->set_message(
|
||||
llvm::Twine("Can't find compile flags for file: ", abs_file).str());
|
||||
continue;
|
||||
}
|
||||
const auto& cmd = cmds.front();
|
||||
llvm::StringRef working_dir = cmd.Directory;
|
||||
if (!working_dir.consume_front(repo_dir)) {
|
||||
result.mutable_status()->set_code(::ide_query::Status::FAILURE);
|
||||
result.mutable_status()->set_message("Command working dir " +
|
||||
working_dir.str() +
|
||||
"outside repository " + repo_dir);
|
||||
continue;
|
||||
}
|
||||
working_dir = working_dir.ltrim('/');
|
||||
result.set_working_dir(working_dir.str());
|
||||
for (auto& arg : cmd.CommandLine) result.add_compiler_arguments(arg);
|
||||
|
||||
auto includes =
|
||||
ScanIncludes(cmds.front(), llvm::vfs::createPhysicalFileSystem());
|
||||
if (!includes) {
|
||||
result.mutable_status()->set_code(::ide_query::Status::FAILURE);
|
||||
result.mutable_status()->set_message(
|
||||
llvm::toString(includes.takeError()));
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto& [req_input, contents] : *includes) {
|
||||
llvm::StringRef req_input_ref(req_input);
|
||||
// We're only interested in generated files.
|
||||
if (!req_input_ref.consume_front(genfile_root_abs)) continue;
|
||||
auto& genfile = *result.add_generated();
|
||||
genfile.set_path(req_input_ref.str());
|
||||
genfile.set_contents(std::move(contents));
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
} // namespace tools::ide_query::cc_analyzer
|
34
tools/ide_query/cc_analyzer/analyzer.h
Normal file
34
tools/ide_query/cc_analyzer/analyzer.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _TOOLS_IDE_QUERY_CC_ANALYZER_ANALYZER_H_
|
||||
#define _TOOLS_IDE_QUERY_CC_ANALYZER_ANALYZER_H_
|
||||
|
||||
#include "ide_query.pb.h"
|
||||
|
||||
namespace tools::ide_query::cc_analyzer {
|
||||
|
||||
// Scans the build graph and returns target names from the build graph to
|
||||
// generate all the dependencies for the active files.
|
||||
::ide_query::DepsResponse GetDeps(::ide_query::RepoState state);
|
||||
|
||||
// Scans the sources and returns all the source files required for analyzing the
|
||||
// active files.
|
||||
::ide_query::IdeAnalysis GetBuildInputs(::ide_query::RepoState state);
|
||||
|
||||
} // namespace tools::ide_query::cc_analyzer
|
||||
|
||||
#endif
|
25
tools/ide_query/cc_analyzer/builtin_headers.cc
Normal file
25
tools/ide_query/cc_analyzer/builtin_headers.cc
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "builtin_headers.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "clang_builtin_headers_resources.inc"
|
||||
|
||||
const struct FileToc *builtin_headers_create() { return kPackedFiles; }
|
||||
size_t builtin_headers_size() {
|
||||
return sizeof(kPackedFiles) / sizeof(FileToc) - 1;
|
||||
}
|
29
tools/ide_query/cc_analyzer/builtin_headers.h
Normal file
29
tools/ide_query/cc_analyzer/builtin_headers.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _TOOLS_IDE_QUERY_CC_ANALYZER_BUILTIN_HEADERS_H_
|
||||
#define _TOOLS_IDE_QUERY_CC_ANALYZER_BUILTIN_HEADERS_H_
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
struct FileToc {
|
||||
const char *name;
|
||||
const char *data;
|
||||
};
|
||||
|
||||
const struct FileToc *builtin_headers_create();
|
||||
size_t builtin_headers_size();
|
||||
|
||||
#endif
|
176
tools/ide_query/cc_analyzer/include_scanner.cc
Normal file
176
tools/ide_query/cc_analyzer/include_scanner.cc
Normal file
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "include_scanner.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "builtin_headers.h"
|
||||
#include "clang/Basic/FileEntry.h"
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "clang/Basic/Module.h"
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Frontend/ASTUnit.h"
|
||||
#include "clang/Frontend/CompilerInstance.h"
|
||||
#include "clang/Frontend/FrontendActions.h"
|
||||
#include "clang/Lex/PPCallbacks.h"
|
||||
#include "clang/Tooling/ArgumentsAdjusters.h"
|
||||
#include "clang/Tooling/CompilationDatabase.h"
|
||||
#include "clang/Tooling/Tooling.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include "llvm/Support/VirtualFileSystem.h"
|
||||
|
||||
namespace tools::ide_query::cc_analyzer {
|
||||
namespace {
|
||||
std::string CleanPath(llvm::StringRef path) {
|
||||
// both ./ and ../ has `./` in them.
|
||||
if (!path.contains("./")) return path.str();
|
||||
llvm::SmallString<256> clean_path(path);
|
||||
llvm::sys::path::remove_dots(clean_path, /*remove_dot_dot=*/true);
|
||||
return clean_path.str().str();
|
||||
}
|
||||
|
||||
// Returns the absolute path to file_name, treating it as relative to cwd if it
|
||||
// isn't already absolute.
|
||||
std::string GetAbsolutePath(llvm::StringRef cwd, llvm::StringRef file_name) {
|
||||
if (llvm::sys::path::is_absolute(file_name)) return CleanPath(file_name);
|
||||
llvm::SmallString<256> abs_path(cwd);
|
||||
llvm::sys::path::append(abs_path, file_name);
|
||||
llvm::sys::path::remove_dots(abs_path, /*remove_dot_dot=*/true);
|
||||
return abs_path.str().str();
|
||||
}
|
||||
|
||||
class IncludeRecordingPP : public clang::PPCallbacks {
|
||||
public:
|
||||
explicit IncludeRecordingPP(
|
||||
std::unordered_map<std::string, std::string> &abs_paths, std::string cwd,
|
||||
const clang::SourceManager &sm)
|
||||
: abs_paths_(abs_paths), cwd_(std::move(cwd)), sm_(sm) {}
|
||||
|
||||
void LexedFileChanged(clang::FileID FID, LexedFileChangeReason Reason,
|
||||
clang::SrcMgr::CharacteristicKind FileType,
|
||||
clang::FileID PrevFID,
|
||||
clang::SourceLocation Loc) override {
|
||||
auto file_entry = sm_.getFileEntryRefForID(FID);
|
||||
if (!file_entry) return;
|
||||
auto abs_path = GetAbsolutePath(cwd_, file_entry->getName());
|
||||
auto [it, inserted] = abs_paths_.try_emplace(abs_path);
|
||||
if (inserted) it->second = sm_.getBufferData(FID);
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, std::string> &abs_paths_;
|
||||
const std::string cwd_;
|
||||
const clang::SourceManager &sm_;
|
||||
};
|
||||
|
||||
class IncludeScanningAction final : public clang::PreprocessOnlyAction {
|
||||
public:
|
||||
explicit IncludeScanningAction(
|
||||
std::unordered_map<std::string, std::string> &abs_paths)
|
||||
: abs_paths_(abs_paths) {}
|
||||
bool BeginSourceFileAction(clang::CompilerInstance &ci) override {
|
||||
std::string cwd;
|
||||
auto cwd_or_err = ci.getVirtualFileSystem().getCurrentWorkingDirectory();
|
||||
if (!cwd_or_err || cwd_or_err.get().empty()) return false;
|
||||
cwd = cwd_or_err.get();
|
||||
ci.getPreprocessor().addPPCallbacks(std::make_unique<IncludeRecordingPP>(
|
||||
abs_paths_, std::move(cwd), ci.getSourceManager()));
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, std::string> &abs_paths_;
|
||||
};
|
||||
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> OverlayBuiltinHeaders(
|
||||
std::vector<std::string> &argv,
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> base) {
|
||||
static constexpr llvm::StringLiteral kResourceDir = "/resources";
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> overlay(
|
||||
new llvm::vfs::OverlayFileSystem(std::move(base)));
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> builtin_headers(
|
||||
new llvm::vfs::InMemoryFileSystem);
|
||||
|
||||
llvm::SmallString<256> file_path;
|
||||
for (const auto &builtin_header :
|
||||
llvm::ArrayRef(builtin_headers_create(), builtin_headers_size())) {
|
||||
file_path.clear();
|
||||
llvm::sys::path::append(file_path, kResourceDir, "include",
|
||||
builtin_header.name);
|
||||
builtin_headers->addFile(
|
||||
file_path,
|
||||
/*ModificationTime=*/0,
|
||||
llvm::MemoryBuffer::getMemBuffer(builtin_header.data));
|
||||
}
|
||||
overlay->pushOverlay(std::move(builtin_headers));
|
||||
argv.insert(llvm::find(argv, "--"),
|
||||
llvm::Twine("-resource-dir=", kResourceDir).str());
|
||||
return overlay;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
llvm::Expected<std::vector<std::pair<std::string, std::string>>> ScanIncludes(
|
||||
const clang::tooling::CompileCommand &cmd,
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs) {
|
||||
if (fs->setCurrentWorkingDirectory(cmd.Directory)) {
|
||||
return llvm::createStringError(
|
||||
llvm::inconvertibleErrorCode(),
|
||||
"Failed to set working directory to: " + cmd.Directory);
|
||||
}
|
||||
|
||||
auto main_file = fs->getBufferForFile(cmd.Filename);
|
||||
if (!main_file) {
|
||||
return llvm::createStringError(llvm::inconvertibleErrorCode(),
|
||||
"Main file doesn't exist: " + cmd.Filename);
|
||||
}
|
||||
std::unordered_map<std::string, std::string> abs_paths;
|
||||
abs_paths.try_emplace(GetAbsolutePath(cmd.Directory, cmd.Filename),
|
||||
main_file.get()->getBuffer().str());
|
||||
|
||||
std::vector<std::string> argv = cmd.CommandLine;
|
||||
fs = OverlayBuiltinHeaders(argv, std::move(fs));
|
||||
|
||||
llvm::IntrusiveRefCntPtr<clang::FileManager> files(
|
||||
new clang::FileManager(/*FileSystemOpts=*/{}, std::move(fs)));
|
||||
clang::tooling::ToolInvocation tool(
|
||||
argv, std::make_unique<IncludeScanningAction>(abs_paths), files.get());
|
||||
if (!tool.run()) {
|
||||
return llvm::createStringError(
|
||||
llvm::inconvertibleErrorCode(),
|
||||
"Failed to scan includes for: " + cmd.Filename);
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> result;
|
||||
result.reserve(abs_paths.size());
|
||||
for (auto &entry : abs_paths) {
|
||||
result.emplace_back(entry.first, std::move(entry.second));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
} // namespace tools::ide_query::cc_analyzer
|
38
tools/ide_query/cc_analyzer/include_scanner.h
Normal file
38
tools/ide_query/cc_analyzer/include_scanner.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef _TOOLS_IDE_QUERY_CC_ANALYZER_INCLUDE_SCANNER_H_
|
||||
#define _TOOLS_IDE_QUERY_CC_ANALYZER_INCLUDE_SCANNER_H_
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "clang/Tooling/CompilationDatabase.h"
|
||||
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/VirtualFileSystem.h"
|
||||
|
||||
namespace tools::ide_query::cc_analyzer {
|
||||
|
||||
// Returns absolute paths and contents for all the includes necessary for
|
||||
// compiling source file in command.
|
||||
llvm::Expected<std::vector<std::pair<std::string, std::string>>> ScanIncludes(
|
||||
const clang::tooling::CompileCommand &cmd,
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs);
|
||||
|
||||
} // namespace tools::ide_query::cc_analyzer
|
||||
|
||||
#endif
|
92
tools/ide_query/cc_analyzer/main.cc
Normal file
92
tools/ide_query/cc_analyzer/main.cc
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// Driver for c++ extractor. Operates in two modes:
|
||||
// - DEPS, scans build graph for active files and reports targets that need to
|
||||
// be build for analyzing that file.
|
||||
// - INPUTS, scans the source code for active files and returns all the sources
|
||||
// required for analyzing that file.
|
||||
//
|
||||
// Uses stdin/stdout to take in requests and provide responses.
|
||||
#include <unistd.h>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "analyzer.h"
|
||||
#include "google/protobuf/message.h"
|
||||
#include "ide_query.pb.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
namespace {
|
||||
enum class OpMode {
|
||||
DEPS = 0,
|
||||
INPUTS = 1,
|
||||
};
|
||||
llvm::cl::opt<OpMode> mode{
|
||||
"mode",
|
||||
llvm::cl::values(clEnumValN(OpMode::DEPS, "deps",
|
||||
"Figure out targets that need to be build"),
|
||||
clEnumValN(OpMode::INPUTS, "inputs",
|
||||
"Figure out generated files used")),
|
||||
llvm::cl::desc("Print the list of headers to insert and remove"),
|
||||
};
|
||||
|
||||
ide_query::IdeAnalysis ReturnError(llvm::StringRef message) {
|
||||
ide_query::IdeAnalysis result;
|
||||
result.mutable_status()->set_code(ide_query::Status::FAILURE);
|
||||
result.mutable_status()->set_message(message.str());
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
llvm::InitializeAllTargetInfos();
|
||||
llvm::cl::ParseCommandLineOptions(argc, argv);
|
||||
|
||||
ide_query::RepoState state;
|
||||
if (!state.ParseFromFileDescriptor(STDIN_FILENO)) {
|
||||
llvm::errs() << "Failed to parse input!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::unique_ptr<google::protobuf::Message> result;
|
||||
switch (mode) {
|
||||
case OpMode::DEPS: {
|
||||
result = std::make_unique<ide_query::DepsResponse>(
|
||||
tools::ide_query::cc_analyzer::GetDeps(std::move(state)));
|
||||
break;
|
||||
}
|
||||
case OpMode::INPUTS: {
|
||||
result = std::make_unique<ide_query::IdeAnalysis>(
|
||||
tools::ide_query::cc_analyzer::GetBuildInputs(std::move(state)));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
llvm::errs() << "Unknown operation mode!\n";
|
||||
return 1;
|
||||
}
|
||||
if (!result->SerializeToFileDescriptor(STDOUT_FILENO)) {
|
||||
llvm::errs() << "Failed to serialize result!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,8 +1,25 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// Binary ide_query generates and analyzes build artifacts.
|
||||
// The produced result can be consumed by IDEs to provide language features.
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"container/list"
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
@ -21,9 +38,13 @@ import (
|
|||
|
||||
// Env contains information about the current environment.
|
||||
type Env struct {
|
||||
LunchTarget LunchTarget
|
||||
RepoDir string
|
||||
OutDir string
|
||||
LunchTarget LunchTarget
|
||||
RepoDir string
|
||||
OutDir string
|
||||
ClangToolsRoot string
|
||||
|
||||
CcFiles []string
|
||||
JavaFiles []string
|
||||
}
|
||||
|
||||
// LunchTarget is a parsed Android lunch target.
|
||||
|
@ -64,6 +85,7 @@ func main() {
|
|||
var env Env
|
||||
env.OutDir = os.Getenv("OUT_DIR")
|
||||
env.RepoDir = os.Getenv("ANDROID_BUILD_TOP")
|
||||
env.ClangToolsRoot = os.Getenv("PREBUILTS_CLANG_TOOLS_ROOT")
|
||||
flag.Var(&env.LunchTarget, "lunch_target", "The lunch target to query")
|
||||
flag.Parse()
|
||||
files := flag.Args()
|
||||
|
@ -73,64 +95,169 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
var javaFiles []string
|
||||
for _, f := range files {
|
||||
switch {
|
||||
case strings.HasSuffix(f, ".java") || strings.HasSuffix(f, ".kt"):
|
||||
javaFiles = append(javaFiles, f)
|
||||
env.JavaFiles = append(env.JavaFiles, f)
|
||||
case strings.HasSuffix(f, ".cc") || strings.HasSuffix(f, ".cpp") || strings.HasSuffix(f, ".h"):
|
||||
env.CcFiles = append(env.CcFiles, f)
|
||||
default:
|
||||
log.Printf("File %q is supported - will be skipped.", f)
|
||||
}
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
javaDepsPath := path.Join(env.RepoDir, env.OutDir, "soong/module_bp_java_deps.json")
|
||||
// TODO(michaelmerg): Figure out if module_bp_java_deps.json is outdated.
|
||||
// TODO(michaelmerg): Figure out if module_bp_java_deps.json and compile_commands.json is outdated.
|
||||
runMake(ctx, env, "nothing")
|
||||
|
||||
javaModules, err := loadJavaModules(javaDepsPath)
|
||||
javaModules, javaFileToModuleMap, err := loadJavaModules(&env)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to load java modules: %v", err)
|
||||
log.Printf("Failed to load java modules: %v", err)
|
||||
}
|
||||
toMake := getJavaTargets(javaFileToModuleMap)
|
||||
|
||||
ccTargets, status := getCCTargets(ctx, &env)
|
||||
if status != nil && status.Code != pb.Status_OK {
|
||||
log.Fatalf("Failed to query cc targets: %v", *status.Message)
|
||||
}
|
||||
toMake = append(toMake, ccTargets...)
|
||||
fmt.Printf("Running make for modules: %v\n", strings.Join(toMake, ", "))
|
||||
if err := runMake(ctx, env, toMake...); err != nil {
|
||||
log.Printf("Building deps failed: %v", err)
|
||||
}
|
||||
|
||||
fileToModule := make(map[string]*javaModule) // file path -> module
|
||||
for _, f := range javaFiles {
|
||||
for _, m := range javaModules {
|
||||
if !slices.Contains(m.Srcs, f) {
|
||||
continue
|
||||
}
|
||||
if fileToModule[f] != nil {
|
||||
// TODO(michaelmerg): Handle the case where a file is covered by multiple modules.
|
||||
log.Printf("File %q found in module %q but is already covered by module %q", f, m.Name, fileToModule[f].Name)
|
||||
continue
|
||||
}
|
||||
fileToModule[f] = m
|
||||
res := getJavaInputs(&env, javaModules, javaFileToModuleMap)
|
||||
ccAnalysis := getCCInputs(ctx, &env)
|
||||
proto.Merge(res, ccAnalysis)
|
||||
|
||||
res.BuildArtifactRoot = env.OutDir
|
||||
data, err := proto.Marshal(res)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to marshal result proto: %v", err)
|
||||
}
|
||||
|
||||
err = os.WriteFile(path.Join(env.RepoDir, env.OutDir, "ide_query.pb"), data, 0644)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to write result proto: %v", err)
|
||||
}
|
||||
|
||||
for _, s := range res.Sources {
|
||||
fmt.Printf("%s: %v (Deps: %d, Generated: %d)\n", s.GetPath(), s.GetStatus(), len(s.GetDeps()), len(s.GetGenerated()))
|
||||
}
|
||||
}
|
||||
|
||||
func repoState(env *Env) *pb.RepoState {
|
||||
const compDbPath = "soong/development/ide/compdb/compile_commands.json"
|
||||
return &pb.RepoState{
|
||||
RepoDir: env.RepoDir,
|
||||
ActiveFilePath: env.CcFiles,
|
||||
OutDir: env.OutDir,
|
||||
CompDbPath: path.Join(env.OutDir, compDbPath),
|
||||
}
|
||||
}
|
||||
|
||||
func runCCanalyzer(ctx context.Context, env *Env, mode string, in []byte) ([]byte, error) {
|
||||
ccAnalyzerPath := path.Join(env.ClangToolsRoot, "bin/ide_query_cc_analyzer")
|
||||
outBuffer := new(bytes.Buffer)
|
||||
|
||||
inBuffer := new(bytes.Buffer)
|
||||
inBuffer.Write(in)
|
||||
|
||||
cmd := exec.CommandContext(ctx, ccAnalyzerPath, "--mode="+mode)
|
||||
cmd.Dir = env.RepoDir
|
||||
|
||||
cmd.Stdin = inBuffer
|
||||
cmd.Stdout = outBuffer
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
err := cmd.Run()
|
||||
|
||||
return outBuffer.Bytes(), err
|
||||
}
|
||||
|
||||
// Execute cc_analyzer and get all the targets that needs to be build for analyzing files.
|
||||
func getCCTargets(ctx context.Context, env *Env) ([]string, *pb.Status) {
|
||||
state := repoState(env)
|
||||
bytes, err := proto.Marshal(state)
|
||||
if err != nil {
|
||||
log.Fatalln("Failed to serialize state:", err)
|
||||
}
|
||||
|
||||
resp := new(pb.DepsResponse)
|
||||
result, err := runCCanalyzer(ctx, env, "deps", bytes)
|
||||
if marshal_err := proto.Unmarshal(result, resp); marshal_err != nil {
|
||||
return nil, &pb.Status{
|
||||
Code: pb.Status_FAILURE,
|
||||
Message: proto.String("Malformed response from cc_analyzer: " + marshal_err.Error()),
|
||||
}
|
||||
}
|
||||
|
||||
var toMake []string
|
||||
for _, m := range fileToModule {
|
||||
toMake = append(toMake, m.Name)
|
||||
var targets []string
|
||||
if resp.Status != nil && resp.Status.Code != pb.Status_OK {
|
||||
return targets, resp.Status
|
||||
}
|
||||
fmt.Printf("Running make for modules: %v\n", strings.Join(toMake, ", "))
|
||||
if err := runMake(ctx, env, toMake...); err != nil {
|
||||
log.Fatalf("Failed to run make: %v", err)
|
||||
for _, deps := range resp.Deps {
|
||||
targets = append(targets, deps.BuildTarget...)
|
||||
}
|
||||
|
||||
status := &pb.Status{Code: pb.Status_OK}
|
||||
if err != nil {
|
||||
status = &pb.Status{
|
||||
Code: pb.Status_FAILURE,
|
||||
Message: proto.String(err.Error()),
|
||||
}
|
||||
}
|
||||
return targets, status
|
||||
}
|
||||
|
||||
func getCCInputs(ctx context.Context, env *Env) *pb.IdeAnalysis {
|
||||
state := repoState(env)
|
||||
bytes, err := proto.Marshal(state)
|
||||
if err != nil {
|
||||
log.Fatalln("Failed to serialize state:", err)
|
||||
}
|
||||
|
||||
resp := new(pb.IdeAnalysis)
|
||||
result, err := runCCanalyzer(ctx, env, "inputs", bytes)
|
||||
if marshal_err := proto.Unmarshal(result, resp); marshal_err != nil {
|
||||
resp.Status = &pb.Status{
|
||||
Code: pb.Status_FAILURE,
|
||||
Message: proto.String("Malformed response from cc_analyzer: " + marshal_err.Error()),
|
||||
}
|
||||
return resp
|
||||
}
|
||||
|
||||
if err != nil && (resp.Status == nil || resp.Status.Code == pb.Status_OK) {
|
||||
resp.Status = &pb.Status{
|
||||
Code: pb.Status_FAILURE,
|
||||
Message: proto.String(err.Error()),
|
||||
}
|
||||
}
|
||||
return resp
|
||||
}
|
||||
|
||||
func getJavaTargets(javaFileToModuleMap map[string]*javaModule) []string {
|
||||
var targets []string
|
||||
for _, m := range javaFileToModuleMap {
|
||||
targets = append(targets, m.Name)
|
||||
}
|
||||
return targets
|
||||
}
|
||||
|
||||
func getJavaInputs(env *Env, javaModules map[string]*javaModule, javaFileToModuleMap map[string]*javaModule) *pb.IdeAnalysis {
|
||||
var sources []*pb.SourceFile
|
||||
type depsAndGenerated struct {
|
||||
Deps []string
|
||||
Generated []*pb.GeneratedFile
|
||||
}
|
||||
moduleToDeps := make(map[string]*depsAndGenerated)
|
||||
for _, f := range files {
|
||||
for _, f := range env.JavaFiles {
|
||||
file := &pb.SourceFile{
|
||||
Path: f,
|
||||
WorkingDir: env.RepoDir,
|
||||
Path: f,
|
||||
}
|
||||
sources = append(sources, file)
|
||||
|
||||
m := fileToModule[f]
|
||||
m := javaFileToModuleMap[f]
|
||||
if m == nil {
|
||||
file.Status = &pb.Status{
|
||||
Code: pb.Status_FAILURE,
|
||||
|
@ -167,24 +294,8 @@ func main() {
|
|||
file.Generated = generated
|
||||
file.Deps = deps
|
||||
}
|
||||
|
||||
res := &pb.IdeAnalysis{
|
||||
BuildArtifactRoot: env.OutDir,
|
||||
Sources: sources,
|
||||
Status: &pb.Status{Code: pb.Status_OK},
|
||||
}
|
||||
data, err := proto.Marshal(res)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to marshal result proto: %v", err)
|
||||
}
|
||||
|
||||
err = os.WriteFile(path.Join(env.OutDir, "ide_query.pb"), data, 0644)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to write result proto: %v", err)
|
||||
}
|
||||
|
||||
for _, s := range sources {
|
||||
fmt.Printf("%s: %v (Deps: %d, Generated: %d)\n", s.GetPath(), s.GetStatus(), len(s.GetDeps()), len(s.GetGenerated()))
|
||||
return &pb.IdeAnalysis{
|
||||
Sources: sources,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,26 +325,40 @@ type javaModule struct {
|
|||
SrcJars []string `json:"srcjars,omitempty"`
|
||||
}
|
||||
|
||||
func loadJavaModules(path string) (map[string]*javaModule, error) {
|
||||
data, err := os.ReadFile(path)
|
||||
func loadJavaModules(env *Env) (map[string]*javaModule, map[string]*javaModule, error) {
|
||||
javaDepsPath := path.Join(env.RepoDir, env.OutDir, "soong/module_bp_java_deps.json")
|
||||
data, err := os.ReadFile(javaDepsPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
var ret map[string]*javaModule // module name -> module
|
||||
if err = json.Unmarshal(data, &ret); err != nil {
|
||||
return nil, err
|
||||
var moduleMapping map[string]*javaModule // module name -> module
|
||||
if err = json.Unmarshal(data, &moduleMapping); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
for name, module := range ret {
|
||||
javaModules := make(map[string]*javaModule)
|
||||
javaFileToModuleMap := make(map[string]*javaModule)
|
||||
for name, module := range moduleMapping {
|
||||
if strings.HasSuffix(name, "-jarjar") || strings.HasSuffix(name, ".impl") {
|
||||
delete(ret, name)
|
||||
continue
|
||||
}
|
||||
|
||||
module.Name = name
|
||||
javaModules[name] = module
|
||||
for _, src := range module.Srcs {
|
||||
if !slices.Contains(env.JavaFiles, src) {
|
||||
// We are only interested in active files.
|
||||
continue
|
||||
}
|
||||
if javaFileToModuleMap[src] != nil {
|
||||
// TODO(michaelmerg): Handle the case where a file is covered by multiple modules.
|
||||
log.Printf("File %q found in module %q but is already covered by module %q", src, module.Name, javaFileToModuleMap[src].Name)
|
||||
continue
|
||||
}
|
||||
javaFileToModuleMap[src] = module
|
||||
}
|
||||
}
|
||||
return ret, nil
|
||||
return javaModules, javaFileToModuleMap, nil
|
||||
}
|
||||
|
||||
func transitiveDeps(m *javaModule, modules map[string]*javaModule) []string {
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# 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.
|
||||
|
||||
cd $(dirname $BASH_SOURCE)
|
||||
source $(pwd)/../../shell_utils.sh
|
||||
require_top
|
||||
|
@ -7,6 +21,17 @@ require_top
|
|||
# Ensure cogsetup (out/ will be symlink outside the repo)
|
||||
. ${TOP}/build/make/cogsetup.sh
|
||||
|
||||
case $(uname -s) in
|
||||
Linux)
|
||||
export PREBUILTS_CLANG_TOOLS_ROOT="${TOP}/prebuilts/clang-tools/linux-x86/"
|
||||
PREBUILTS_GO_ROOT="${TOP}/prebuilts/go/linux-x86/"
|
||||
;;
|
||||
*)
|
||||
echo "Only supported for linux hosts" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
export ANDROID_BUILD_TOP=$TOP
|
||||
export OUT_DIR=${OUT_DIR}
|
||||
exec "${TOP}/prebuilts/go/linux-x86/bin/go" "run" "ide_query" "$@"
|
||||
exec "${PREBUILTS_GO_ROOT}/bin/go" "run" "ide_query" "$@"
|
||||
|
|
33
tools/ide_query/ide_query_proto/Android.bp
Normal file
33
tools/ide_query/ide_query_proto/Android.bp
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package {
|
||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||
}
|
||||
|
||||
cc_library_host_static {
|
||||
name: "ide_query_proto",
|
||||
srcs: [
|
||||
"ide_query.proto",
|
||||
],
|
||||
proto: {
|
||||
export_proto_headers: true,
|
||||
type: "full",
|
||||
canonical_path_from_root: false,
|
||||
},
|
||||
compile_multilib: "64",
|
||||
shared_libs: ["libprotobuf-cpp-full"],
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.30.0
|
||||
// protoc-gen-go v1.25.0-devel
|
||||
// protoc v3.21.12
|
||||
// source: ide_query.proto
|
||||
|
||||
|
@ -72,7 +72,7 @@ type Status struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Code Status_Code `protobuf:"varint,1,opt,name=code,proto3,enum=cider.build.companion.Status_Code" json:"code,omitempty"`
|
||||
Code Status_Code `protobuf:"varint,1,opt,name=code,proto3,enum=ide_query.Status_Code" json:"code,omitempty"`
|
||||
// Details about the status, might be displayed to user.
|
||||
Message *string `protobuf:"bytes,2,opt,name=message,proto3,oneof" json:"message,omitempty"`
|
||||
}
|
||||
|
@ -123,6 +123,142 @@ func (x *Status) GetMessage() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// Represents an Android checkout on user's workstation.
|
||||
type RepoState struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Absolute path for the checkout in the workstation.
|
||||
// e.g. /home/user/work/android/
|
||||
RepoDir string `protobuf:"bytes,1,opt,name=repo_dir,json=repoDir,proto3" json:"repo_dir,omitempty"`
|
||||
// Relative to repo_dir.
|
||||
ActiveFilePath []string `protobuf:"bytes,2,rep,name=active_file_path,json=activeFilePath,proto3" json:"active_file_path,omitempty"`
|
||||
// Repository relative path to output directory in workstation.
|
||||
OutDir string `protobuf:"bytes,3,opt,name=out_dir,json=outDir,proto3" json:"out_dir,omitempty"`
|
||||
// Repository relative path to compile_commands.json in workstation.
|
||||
CompDbPath string `protobuf:"bytes,4,opt,name=comp_db_path,json=compDbPath,proto3" json:"comp_db_path,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RepoState) Reset() {
|
||||
*x = RepoState{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ide_query_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RepoState) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RepoState) ProtoMessage() {}
|
||||
|
||||
func (x *RepoState) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ide_query_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RepoState.ProtoReflect.Descriptor instead.
|
||||
func (*RepoState) Descriptor() ([]byte, []int) {
|
||||
return file_ide_query_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *RepoState) GetRepoDir() string {
|
||||
if x != nil {
|
||||
return x.RepoDir
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RepoState) GetActiveFilePath() []string {
|
||||
if x != nil {
|
||||
return x.ActiveFilePath
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RepoState) GetOutDir() string {
|
||||
if x != nil {
|
||||
return x.OutDir
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RepoState) GetCompDbPath() string {
|
||||
if x != nil {
|
||||
return x.CompDbPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Provides all the targets that are pre-requisities for running language
|
||||
// services on active_file_paths.
|
||||
type DepsResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Deps []*DepsResponse_Deps `protobuf:"bytes,1,rep,name=deps,proto3" json:"deps,omitempty"`
|
||||
Status *Status `protobuf:"bytes,2,opt,name=status,proto3,oneof" json:"status,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DepsResponse) Reset() {
|
||||
*x = DepsResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ide_query_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DepsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DepsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DepsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ide_query_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DepsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DepsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_ide_query_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *DepsResponse) GetDeps() []*DepsResponse_Deps {
|
||||
if x != nil {
|
||||
return x.Deps
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DepsResponse) GetStatus() *Status {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Returns all the information necessary for providing language services for the
|
||||
// active files.
|
||||
type GeneratedFile struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -130,8 +266,7 @@ type GeneratedFile struct {
|
|||
|
||||
// Path to the file relative to IdeAnalysis.build_artifact_root.
|
||||
Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
|
||||
// The text of the generated file, if not provided contents will be read
|
||||
//
|
||||
// The text of the generated file, if not provided contents will be read
|
||||
// from the path above in user's workstation.
|
||||
Contents []byte `protobuf:"bytes,2,opt,name=contents,proto3,oneof" json:"contents,omitempty"`
|
||||
}
|
||||
|
@ -139,7 +274,7 @@ type GeneratedFile struct {
|
|||
func (x *GeneratedFile) Reset() {
|
||||
*x = GeneratedFile{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ide_query_proto_msgTypes[1]
|
||||
mi := &file_ide_query_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -152,7 +287,7 @@ func (x *GeneratedFile) String() string {
|
|||
func (*GeneratedFile) ProtoMessage() {}
|
||||
|
||||
func (x *GeneratedFile) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ide_query_proto_msgTypes[1]
|
||||
mi := &file_ide_query_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -165,7 +300,7 @@ func (x *GeneratedFile) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use GeneratedFile.ProtoReflect.Descriptor instead.
|
||||
func (*GeneratedFile) Descriptor() ([]byte, []int) {
|
||||
return file_ide_query_proto_rawDescGZIP(), []int{1}
|
||||
return file_ide_query_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *GeneratedFile) GetPath() string {
|
||||
|
@ -187,11 +322,11 @@ type SourceFile struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Repo root relative path to the source file in the tree.
|
||||
// Path to the source file relative to repository root.
|
||||
Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
|
||||
// Working directory used by the build system. All the relative
|
||||
// paths in compiler_arguments should be relative to this path.
|
||||
// Relative to workspace root.
|
||||
// Relative to repository root.
|
||||
WorkingDir string `protobuf:"bytes,2,opt,name=working_dir,json=workingDir,proto3" json:"working_dir,omitempty"`
|
||||
// Compiler arguments to compile the source file. If multiple variants
|
||||
// of the module being compiled are possible, the query script will choose
|
||||
|
@ -200,12 +335,12 @@ type SourceFile struct {
|
|||
// Any generated files that are used in compiling the file.
|
||||
Generated []*GeneratedFile `protobuf:"bytes,4,rep,name=generated,proto3" json:"generated,omitempty"`
|
||||
// Paths to all of the sources, like build files, code generators,
|
||||
// proto files etc. that were used during analysis. Used to figure
|
||||
// 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 workspace root.
|
||||
// Relative to repository root.
|
||||
Deps []string `protobuf:"bytes,5,rep,name=deps,proto3" json:"deps,omitempty"`
|
||||
// Represensts analysis status for this particular file. e.g. not part
|
||||
// Represents analysis status for this particular file. e.g. not part
|
||||
// of the build graph.
|
||||
Status *Status `protobuf:"bytes,6,opt,name=status,proto3,oneof" json:"status,omitempty"`
|
||||
}
|
||||
|
@ -213,7 +348,7 @@ type SourceFile struct {
|
|||
func (x *SourceFile) Reset() {
|
||||
*x = SourceFile{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ide_query_proto_msgTypes[2]
|
||||
mi := &file_ide_query_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -226,7 +361,7 @@ func (x *SourceFile) String() string {
|
|||
func (*SourceFile) ProtoMessage() {}
|
||||
|
||||
func (x *SourceFile) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ide_query_proto_msgTypes[2]
|
||||
mi := &file_ide_query_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -239,7 +374,7 @@ func (x *SourceFile) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use SourceFile.ProtoReflect.Descriptor instead.
|
||||
func (*SourceFile) Descriptor() ([]byte, []int) {
|
||||
return file_ide_query_proto_rawDescGZIP(), []int{2}
|
||||
return file_ide_query_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *SourceFile) GetPath() string {
|
||||
|
@ -289,21 +424,20 @@ type IdeAnalysis struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Path relative to workspace root, containing all the artifacts
|
||||
// Path relative to repository root, containing all the artifacts
|
||||
// generated by the build system. GeneratedFile.path are always
|
||||
// relative to this directory.
|
||||
BuildArtifactRoot string `protobuf:"bytes,1,opt,name=build_artifact_root,json=buildArtifactRoot,proto3" json:"build_artifact_root,omitempty"`
|
||||
Sources []*SourceFile `protobuf:"bytes,2,rep,name=sources,proto3" json:"sources,omitempty"`
|
||||
// Status representing overall analysis.
|
||||
// Should fail only when no analysis can be performed, e.g. workspace
|
||||
// isn't setup.
|
||||
// Should fail only when no analysis can be performed.
|
||||
Status *Status `protobuf:"bytes,3,opt,name=status,proto3,oneof" json:"status,omitempty"`
|
||||
}
|
||||
|
||||
func (x *IdeAnalysis) Reset() {
|
||||
*x = IdeAnalysis{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ide_query_proto_msgTypes[3]
|
||||
mi := &file_ide_query_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
@ -316,7 +450,7 @@ func (x *IdeAnalysis) String() string {
|
|||
func (*IdeAnalysis) ProtoMessage() {}
|
||||
|
||||
func (x *IdeAnalysis) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ide_query_proto_msgTypes[3]
|
||||
mi := &file_ide_query_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
@ -329,7 +463,7 @@ func (x *IdeAnalysis) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use IdeAnalysis.ProtoReflect.Descriptor instead.
|
||||
func (*IdeAnalysis) Descriptor() ([]byte, []int) {
|
||||
return file_ide_query_proto_rawDescGZIP(), []int{3}
|
||||
return file_ide_query_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *IdeAnalysis) GetBuildArtifactRoot() string {
|
||||
|
@ -353,58 +487,144 @@ func (x *IdeAnalysis) GetStatus() *Status {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Build dependencies of a source file for providing language services.
|
||||
type DepsResponse_Deps struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Relative to repo_dir.
|
||||
SourceFile string `protobuf:"bytes,1,opt,name=source_file,json=sourceFile,proto3" json:"source_file,omitempty"`
|
||||
// Build target to execute for generating dep.
|
||||
BuildTarget []string `protobuf:"bytes,2,rep,name=build_target,json=buildTarget,proto3" json:"build_target,omitempty"`
|
||||
Status *Status `protobuf:"bytes,3,opt,name=status,proto3,oneof" json:"status,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DepsResponse_Deps) Reset() {
|
||||
*x = DepsResponse_Deps{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ide_query_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DepsResponse_Deps) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DepsResponse_Deps) ProtoMessage() {}
|
||||
|
||||
func (x *DepsResponse_Deps) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ide_query_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DepsResponse_Deps.ProtoReflect.Descriptor instead.
|
||||
func (*DepsResponse_Deps) Descriptor() ([]byte, []int) {
|
||||
return file_ide_query_proto_rawDescGZIP(), []int{2, 0}
|
||||
}
|
||||
|
||||
func (x *DepsResponse_Deps) GetSourceFile() string {
|
||||
if x != nil {
|
||||
return x.SourceFile
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DepsResponse_Deps) GetBuildTarget() []string {
|
||||
if x != nil {
|
||||
return x.BuildTarget
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DepsResponse_Deps) GetStatus() *Status {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_ide_query_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_ide_query_proto_rawDesc = []byte{
|
||||
0x0a, 0x0f, 0x69, 0x64, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x12, 0x15, 0x63, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x69, 0x6f, 0x6e, 0x22, 0x88, 0x01, 0x0a, 0x06, 0x53, 0x74, 0x61,
|
||||
0x74, 0x75, 0x73, 0x12, 0x36, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0e, 0x32, 0x22, 0x2e, 0x63, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1d, 0x0a, 0x07, 0x6d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07,
|
||||
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x22, 0x1b, 0x0a, 0x04, 0x43, 0x6f,
|
||||
0x64, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x41,
|
||||
0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73,
|
||||
0x61, 0x67, 0x65, 0x22, 0x51, 0x0a, 0x0d, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64,
|
||||
0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74,
|
||||
0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f,
|
||||
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x63, 0x6f,
|
||||
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x8f, 0x02, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63,
|
||||
0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x6f, 0x72,
|
||||
0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
|
||||
0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x72, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x6f,
|
||||
0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x5f, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73,
|
||||
0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72,
|
||||
0x41, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x67, 0x65, 0x6e,
|
||||
0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63,
|
||||
0x69, 0x64, 0x65, 0x72, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x61,
|
||||
0x6e, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69,
|
||||
0x6c, 0x65, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x64, 0x65, 0x70, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x64, 0x65, 0x70,
|
||||
0x73, 0x12, 0x3a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a,
|
||||
0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xc1, 0x01, 0x0a, 0x0b, 0x49, 0x64, 0x65,
|
||||
0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x62, 0x75, 0x69, 0x6c,
|
||||
0x64, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x41, 0x72, 0x74, 0x69,
|
||||
0x66, 0x61, 0x63, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x3b, 0x0a, 0x07, 0x73, 0x6f, 0x75, 0x72,
|
||||
0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x69, 0x64, 0x65,
|
||||
0x72, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x69, 0x6f,
|
||||
0x6e, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x07, 0x73, 0x6f,
|
||||
0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x62, 0x75,
|
||||
0x69, 0x6c, 0x64, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x74,
|
||||
0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01,
|
||||
0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x1b, 0x5a, 0x19,
|
||||
0x69, 0x64, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x69, 0x64, 0x65, 0x5f, 0x71, 0x75,
|
||||
0x65, 0x72, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
0x6f, 0x12, 0x09, 0x69, 0x64, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x22, 0x7c, 0x0a, 0x06,
|
||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2a, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x69, 0x64, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79,
|
||||
0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f,
|
||||
0x64, 0x65, 0x12, 0x1d, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x88, 0x01,
|
||||
0x01, 0x22, 0x1b, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10,
|
||||
0x00, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x01, 0x42, 0x0a,
|
||||
0x0a, 0x08, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x09, 0x52,
|
||||
0x65, 0x70, 0x6f, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f,
|
||||
0x5f, 0x64, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x70, 0x6f,
|
||||
0x44, 0x69, 0x72, 0x12, 0x28, 0x0a, 0x10, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61,
|
||||
0x63, 0x74, 0x69, 0x76, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x17, 0x0a,
|
||||
0x07, 0x6f, 0x75, 0x74, 0x5f, 0x64, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
|
||||
0x6f, 0x75, 0x74, 0x44, 0x69, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x5f, 0x64,
|
||||
0x62, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f,
|
||||
0x6d, 0x70, 0x44, 0x62, 0x50, 0x61, 0x74, 0x68, 0x22, 0x83, 0x02, 0x0a, 0x0c, 0x44, 0x65, 0x70,
|
||||
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x04, 0x64, 0x65, 0x70,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x69, 0x64, 0x65, 0x5f, 0x71, 0x75,
|
||||
0x65, 0x72, 0x79, 0x2e, 0x44, 0x65, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x2e, 0x44, 0x65, 0x70, 0x73, 0x52, 0x04, 0x64, 0x65, 0x70, 0x73, 0x12, 0x2e, 0x0a, 0x06, 0x73,
|
||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x69, 0x64,
|
||||
0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00,
|
||||
0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x1a, 0x85, 0x01, 0x0a, 0x04,
|
||||
0x44, 0x65, 0x70, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66,
|
||||
0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63,
|
||||
0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74,
|
||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x75, 0x69,
|
||||
0x6c, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74,
|
||||
0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x69, 0x64, 0x65, 0x5f, 0x71,
|
||||
0x75, 0x65, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73,
|
||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61,
|
||||
0x74, 0x75, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x51,
|
||||
0x0a, 0x0d, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70,
|
||||
0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
|
||||
0x73, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
|
||||
0x73, 0x22, 0xf7, 0x01, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x5f,
|
||||
0x64, 0x69, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x6f, 0x72, 0x6b, 0x69,
|
||||
0x6e, 0x67, 0x44, 0x69, 0x72, 0x12, 0x2d, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65,
|
||||
0x72, 0x5f, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
|
||||
0x09, 0x52, 0x11, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x41, 0x72, 0x67, 0x75, 0x6d,
|
||||
0x65, 0x6e, 0x74, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,
|
||||
0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x69, 0x64, 0x65, 0x5f, 0x71, 0x75,
|
||||
0x65, 0x72, 0x79, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x6c,
|
||||
0x65, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x64, 0x65, 0x70, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x64, 0x65, 0x70, 0x73,
|
||||
0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x11, 0x2e, 0x69, 0x64, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x61,
|
||||
0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01,
|
||||
0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xa9, 0x01, 0x0a, 0x0b,
|
||||
0x49, 0x64, 0x65, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x12, 0x2e, 0x0a, 0x13, 0x62,
|
||||
0x75, 0x69, 0x6c, 0x64, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x5f, 0x72, 0x6f,
|
||||
0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x41,
|
||||
0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x2f, 0x0a, 0x07, 0x73,
|
||||
0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x69,
|
||||
0x64, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46,
|
||||
0x69, 0x6c, 0x65, 0x52, 0x07, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x2e, 0x0a, 0x06,
|
||||
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x69,
|
||||
0x64, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48,
|
||||
0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07,
|
||||
0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x1b, 0x5a, 0x19, 0x69, 0x64, 0x65, 0x5f, 0x71,
|
||||
0x75, 0x65, 0x72, 0x79, 0x2f, 0x69, 0x64, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -420,25 +640,31 @@ func file_ide_query_proto_rawDescGZIP() []byte {
|
|||
}
|
||||
|
||||
var file_ide_query_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_ide_query_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_ide_query_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||
var file_ide_query_proto_goTypes = []interface{}{
|
||||
(Status_Code)(0), // 0: cider.build.companion.Status.Code
|
||||
(*Status)(nil), // 1: cider.build.companion.Status
|
||||
(*GeneratedFile)(nil), // 2: cider.build.companion.GeneratedFile
|
||||
(*SourceFile)(nil), // 3: cider.build.companion.SourceFile
|
||||
(*IdeAnalysis)(nil), // 4: cider.build.companion.IdeAnalysis
|
||||
(Status_Code)(0), // 0: ide_query.Status.Code
|
||||
(*Status)(nil), // 1: ide_query.Status
|
||||
(*RepoState)(nil), // 2: ide_query.RepoState
|
||||
(*DepsResponse)(nil), // 3: ide_query.DepsResponse
|
||||
(*GeneratedFile)(nil), // 4: ide_query.GeneratedFile
|
||||
(*SourceFile)(nil), // 5: ide_query.SourceFile
|
||||
(*IdeAnalysis)(nil), // 6: ide_query.IdeAnalysis
|
||||
(*DepsResponse_Deps)(nil), // 7: ide_query.DepsResponse.Deps
|
||||
}
|
||||
var file_ide_query_proto_depIdxs = []int32{
|
||||
0, // 0: cider.build.companion.Status.code:type_name -> cider.build.companion.Status.Code
|
||||
2, // 1: cider.build.companion.SourceFile.generated:type_name -> cider.build.companion.GeneratedFile
|
||||
1, // 2: cider.build.companion.SourceFile.status:type_name -> cider.build.companion.Status
|
||||
3, // 3: cider.build.companion.IdeAnalysis.sources:type_name -> cider.build.companion.SourceFile
|
||||
1, // 4: cider.build.companion.IdeAnalysis.status:type_name -> cider.build.companion.Status
|
||||
5, // [5:5] is the sub-list for method output_type
|
||||
5, // [5:5] is the sub-list for method input_type
|
||||
5, // [5:5] is the sub-list for extension type_name
|
||||
5, // [5:5] is the sub-list for extension extendee
|
||||
0, // [0:5] is the sub-list for field type_name
|
||||
0, // 0: ide_query.Status.code:type_name -> ide_query.Status.Code
|
||||
7, // 1: ide_query.DepsResponse.deps:type_name -> ide_query.DepsResponse.Deps
|
||||
1, // 2: ide_query.DepsResponse.status:type_name -> ide_query.Status
|
||||
4, // 3: ide_query.SourceFile.generated:type_name -> ide_query.GeneratedFile
|
||||
1, // 4: ide_query.SourceFile.status:type_name -> ide_query.Status
|
||||
5, // 5: ide_query.IdeAnalysis.sources:type_name -> ide_query.SourceFile
|
||||
1, // 6: ide_query.IdeAnalysis.status:type_name -> ide_query.Status
|
||||
1, // 7: ide_query.DepsResponse.Deps.status:type_name -> ide_query.Status
|
||||
8, // [8:8] is the sub-list for method output_type
|
||||
8, // [8:8] is the sub-list for method input_type
|
||||
8, // [8:8] is the sub-list for extension type_name
|
||||
8, // [8:8] is the sub-list for extension extendee
|
||||
0, // [0:8] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_ide_query_proto_init() }
|
||||
|
@ -460,7 +686,7 @@ func file_ide_query_proto_init() {
|
|||
}
|
||||
}
|
||||
file_ide_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GeneratedFile); i {
|
||||
switch v := v.(*RepoState); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -472,7 +698,7 @@ func file_ide_query_proto_init() {
|
|||
}
|
||||
}
|
||||
file_ide_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SourceFile); i {
|
||||
switch v := v.(*DepsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -484,6 +710,30 @@ func file_ide_query_proto_init() {
|
|||
}
|
||||
}
|
||||
file_ide_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GeneratedFile); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ide_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SourceFile); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ide_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*IdeAnalysis); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
|
@ -495,18 +745,32 @@ func file_ide_query_proto_init() {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
file_ide_query_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DepsResponse_Deps); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
file_ide_query_proto_msgTypes[0].OneofWrappers = []interface{}{}
|
||||
file_ide_query_proto_msgTypes[1].OneofWrappers = []interface{}{}
|
||||
file_ide_query_proto_msgTypes[2].OneofWrappers = []interface{}{}
|
||||
file_ide_query_proto_msgTypes[3].OneofWrappers = []interface{}{}
|
||||
file_ide_query_proto_msgTypes[4].OneofWrappers = []interface{}{}
|
||||
file_ide_query_proto_msgTypes[5].OneofWrappers = []interface{}{}
|
||||
file_ide_query_proto_msgTypes[6].OneofWrappers = []interface{}{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_ide_query_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 4,
|
||||
NumMessages: 7,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/*
|
||||
* 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;
|
||||
|
@ -14,6 +29,36 @@ message Status {
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue