mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-04 04:33:23 +00:00
Add options to print build rule dependencies
Tested: on Linux Bug: 16465909 Change-Id: I2f1a6def13e47716110426b00990c2c625c03251
This commit is contained in:
@@ -696,13 +696,33 @@ std::string GenerateCPP(const Parser &parser,
|
||||
return std::string();
|
||||
}
|
||||
|
||||
static std::string GeneratedFileName(const std::string &path,
|
||||
const std::string &file_name) {
|
||||
return path + file_name + "_generated.h";
|
||||
}
|
||||
|
||||
bool GenerateCPP(const Parser &parser,
|
||||
const std::string &path,
|
||||
const std::string &file_name,
|
||||
const GeneratorOptions &opts) {
|
||||
auto code = GenerateCPP(parser, file_name, opts);
|
||||
return !code.length() ||
|
||||
SaveFile((path + file_name + "_generated.h").c_str(), code, false);
|
||||
SaveFile(GeneratedFileName(path, file_name).c_str(), code, false);
|
||||
}
|
||||
|
||||
std::string CPPMakeRule(const Parser &parser,
|
||||
const std::string &path,
|
||||
const std::string &file_name,
|
||||
const GeneratorOptions & /*opts*/) {
|
||||
std::string filebase = flatbuffers::StripPath(
|
||||
flatbuffers::StripExtension(file_name));
|
||||
std::string make_rule = GeneratedFileName(path, filebase) + ": ";
|
||||
auto included_files = parser.GetIncludedFilesRecursive(file_name);
|
||||
for (auto it = included_files.begin();
|
||||
it != included_files.end(); ++it) {
|
||||
make_rule += " " + *it;
|
||||
}
|
||||
return make_rule;
|
||||
}
|
||||
|
||||
} // namespace flatbuffers
|
||||
|
||||
Reference in New Issue
Block a user