Merge "versioner: ignore non-header files."
This commit is contained in:
commit
348eaa6480
|
@ -25,6 +25,8 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <android-base/strings.h>
|
||||
|
||||
#include "DeclarationDatabase.h"
|
||||
|
||||
std::string getWorkingDir() {
|
||||
|
@ -35,8 +37,8 @@ std::string getWorkingDir() {
|
|||
return buf;
|
||||
}
|
||||
|
||||
std::vector<std::string> collectFiles(const std::string& directory) {
|
||||
std::vector<std::string> files;
|
||||
std::vector<std::string> collectHeaders(const std::string& directory) {
|
||||
std::vector<std::string> headers;
|
||||
|
||||
char* dir_argv[2] = { const_cast<char*>(directory.c_str()), nullptr };
|
||||
FTS* fts = fts_open(dir_argv, FTS_LOGICAL | FTS_NOCHDIR, nullptr);
|
||||
|
@ -51,11 +53,15 @@ std::vector<std::string> collectFiles(const std::string& directory) {
|
|||
continue;
|
||||
}
|
||||
|
||||
files.push_back(ent->fts_path);
|
||||
if (!android::base::EndsWith(ent->fts_path, ".h")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
headers.push_back(ent->fts_path);
|
||||
}
|
||||
|
||||
fts_close(fts);
|
||||
return files;
|
||||
return headers;
|
||||
}
|
||||
|
||||
llvm::StringRef StripPrefix(llvm::StringRef string, llvm::StringRef prefix) {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <llvm/ADT/StringRef.h>
|
||||
|
||||
std::string getWorkingDir();
|
||||
std::vector<std::string> collectFiles(const std::string& directory);
|
||||
std::vector<std::string> collectHeaders(const std::string& directory);
|
||||
|
||||
static inline std::string dirname(const std::string& path) {
|
||||
std::unique_ptr<char, decltype(&free)> path_copy(strdup(path.c_str()), free);
|
||||
|
|
|
@ -56,7 +56,7 @@ static int max_thread_count = 48;
|
|||
|
||||
static CompilationRequirements collectRequirements(const Arch& arch, const std::string& header_dir,
|
||||
const std::string& dependency_dir) {
|
||||
std::vector<std::string> headers = collectFiles(header_dir);
|
||||
std::vector<std::string> headers = collectHeaders(header_dir);
|
||||
std::vector<std::string> dependencies = { header_dir };
|
||||
if (!dependency_dir.empty()) {
|
||||
auto collect_children = [&dependencies, &dependency_dir](const std::string& dir_path) {
|
||||
|
|
Loading…
Reference in New Issue