mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-09-19 19:19:05 +01:00
oilgen: accept multiple config files (#379)
Summary: Extend the multiple config files system to OILGen, the piece it was originally designed for. This allows for specifying additional configs which say which keys of maps to capture. Reviewed By: ajor Differential Revision: D50105138
This commit is contained in:
parent
4c6f232766
commit
217f675e30
@ -193,9 +193,8 @@ int OIGenerator::generate(fs::path& primaryObject, SymbolService& symbols) {
|
|||||||
OICompiler::Config compilerConfig{};
|
OICompiler::Config compilerConfig{};
|
||||||
compilerConfig.usePIC = pic;
|
compilerConfig.usePIC = pic;
|
||||||
|
|
||||||
auto features =
|
auto features = config::processConfigFiles(configFilePaths, featuresMap,
|
||||||
config::processConfigFiles(std::vector<fs::path>{configFilePath},
|
compilerConfig, generatorConfig);
|
||||||
featuresMap, compilerConfig, generatorConfig);
|
|
||||||
if (!features) {
|
if (!features) {
|
||||||
LOG(ERROR) << "failed to process config file";
|
LOG(ERROR) << "failed to process config file";
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "oi/DrgnUtils.h"
|
#include "oi/DrgnUtils.h"
|
||||||
#include "oi/OICodeGen.h"
|
#include "oi/OICodeGen.h"
|
||||||
@ -31,8 +32,8 @@ class OIGenerator {
|
|||||||
void setOutputPath(fs::path _outputPath) {
|
void setOutputPath(fs::path _outputPath) {
|
||||||
outputPath = std::move(_outputPath);
|
outputPath = std::move(_outputPath);
|
||||||
}
|
}
|
||||||
void setConfigFilePath(fs::path _configFilePath) {
|
void setConfigFilePaths(std::vector<fs::path> _configFilePaths) {
|
||||||
configFilePath = std::move(_configFilePath);
|
configFilePaths = std::move(_configFilePaths);
|
||||||
}
|
}
|
||||||
void setSourceFileDumpPath(fs::path _sourceFileDumpPath) {
|
void setSourceFileDumpPath(fs::path _sourceFileDumpPath) {
|
||||||
sourceFileDumpPath = std::move(_sourceFileDumpPath);
|
sourceFileDumpPath = std::move(_sourceFileDumpPath);
|
||||||
@ -46,7 +47,7 @@ class OIGenerator {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::filesystem::path outputPath;
|
std::filesystem::path outputPath;
|
||||||
std::filesystem::path configFilePath;
|
std::vector<std::filesystem::path> configFilePaths;
|
||||||
std::filesystem::path sourceFileDumpPath;
|
std::filesystem::path sourceFileDumpPath;
|
||||||
bool failIfNothingGenerated = false;
|
bool failIfNothingGenerated = false;
|
||||||
bool pic = false;
|
bool pic = false;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "oi/OICodeGen.h"
|
#include "oi/OICodeGen.h"
|
||||||
#include "oi/OIGenerator.h"
|
#include "oi/OIGenerator.h"
|
||||||
@ -61,7 +62,7 @@ int main(int argc, char* argv[]) {
|
|||||||
FLAGS_stderrthreshold = 0;
|
FLAGS_stderrthreshold = 0;
|
||||||
|
|
||||||
fs::path outputPath = "a.o";
|
fs::path outputPath = "a.o";
|
||||||
fs::path configFilePath = "/usr/local/share/oi/base.oid.toml";
|
std::vector<fs::path> configFilePaths;
|
||||||
fs::path sourceFileDumpPath = "";
|
fs::path sourceFileDumpPath = "";
|
||||||
bool exitCode = false;
|
bool exitCode = false;
|
||||||
bool pic = false;
|
bool pic = false;
|
||||||
@ -77,7 +78,7 @@ int main(int argc, char* argv[]) {
|
|||||||
outputPath = optarg;
|
outputPath = optarg;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
configFilePath = optarg;
|
configFilePaths.emplace_back(optarg);
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
google::LogToStderr();
|
google::LogToStderr();
|
||||||
@ -114,7 +115,7 @@ int main(int argc, char* argv[]) {
|
|||||||
OIGenerator oigen;
|
OIGenerator oigen;
|
||||||
|
|
||||||
oigen.setOutputPath(std::move(outputPath));
|
oigen.setOutputPath(std::move(outputPath));
|
||||||
oigen.setConfigFilePath(std::move(configFilePath));
|
oigen.setConfigFilePaths(std::move(configFilePaths));
|
||||||
oigen.setSourceFileDumpPath(sourceFileDumpPath);
|
oigen.setSourceFileDumpPath(sourceFileDumpPath);
|
||||||
oigen.setFailIfNothingGenerated(exitCode);
|
oigen.setFailIfNothingGenerated(exitCode);
|
||||||
oigen.setUsePIC(pic);
|
oigen.setUsePIC(pic);
|
||||||
|
Loading…
Reference in New Issue
Block a user