-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DPDK Backend: Add support for tdi.json #3440
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -213,7 +213,25 @@ const Util::JsonObject* | |
BFRuntimeSchemaGenerator::genSchema() const { | ||
auto* json = new Util::JsonObject(); | ||
|
||
json->emplace("schema_version", cstring("1.0.0")); | ||
if (isTDI) { | ||
cstring progName = options.file; | ||
auto fileName = progName.findlast('/'); | ||
// Handle the case when input file is in the current working directory. | ||
// fileName would be null in that case, hence progName should remain unchanged. | ||
if (fileName) | ||
progName = fileName; | ||
auto fileext = progName.find("."); | ||
progName = progName.replace(fileext, ""); | ||
progName = progName.trim("/\t\n\r"); | ||
json->emplace("program_name", progName); | ||
json->emplace("build_date", cstring(options.getBuildDate())); | ||
json->emplace("compile_command", cstring(options.getCompileCommand())); | ||
json->emplace("compiler_version", cstring(options.compilerVersion)); | ||
json->emplace("schema_version", cstring("0.1")); | ||
json->emplace("target", cstring("DPDK")); | ||
} else { | ||
json->emplace("schema_version", cstring("1.0.0")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Version strings can have more than one decimal point. So I think a string literal should be ok here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, a const string, in one place. |
||
} | ||
|
||
auto* tablesJson = new Util::JsonArray(); | ||
json->emplace("tables", tablesJson); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be a constant instead of a literal?