-
Notifications
You must be signed in to change notification settings - Fork 5
feat: Add Protobuf log handler, improve CI toolchain, and enhance code generation #155
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
base: master
Are you sure you want to change the base?
Changes from all commits
afbba8f
e2bdc78
56b0c50
60c4dd1
fdb836e
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 |
|---|---|---|
|
|
@@ -49,7 +49,7 @@ bool LoadMessager(google::protobuf::Message& msg, const std::filesystem::path& p | |
| bool LoadMessagerInDir(google::protobuf::Message& msg, const std::filesystem::path& dir, Format fmt, | ||
| std::shared_ptr<const MessagerOptions> options /* = nullptr*/) { | ||
| options = options ? options : std::make_shared<MessagerOptions>(); | ||
| const std::string& name = msg.GetDescriptor()->name(); | ||
| const std::string name(msg.GetDescriptor()->name()); | ||
|
Member
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. Use string_view ? https://en.cppreference.com/w/cpp/string/basic_string_view.html
Member
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. Should add comment: For compatibility, the new protobuf API returned
Collaborator
Author
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. There are too many places where comments need to be added—for instance, the name of every single |
||
| std::filesystem::path path; | ||
| if (!options->path.empty()) { | ||
| // path specified in Paths, then use it instead of dir. | ||
|
|
@@ -79,7 +79,7 @@ bool LoadMessagerWithPatch(google::protobuf::Message& msg, const std::filesystem | |
| // ignore patch files when LoadMode::kModeOnlyMain specified | ||
| return load_func(msg, path, fmt, nullptr); | ||
| } | ||
| const std::string& name = msg.GetDescriptor()->name(); | ||
| const std::string name(msg.GetDescriptor()->name()); | ||
| std::vector<std::filesystem::path> patch_paths; | ||
| if (!options->patch_paths.empty()) { | ||
| // patch path specified in PatchPaths, then use it instead of PatchDirs. | ||
|
|
@@ -155,21 +155,21 @@ bool Unmarshal(const std::string& content, google::protobuf::Message& msg, Forma | |
| parse_options.ignore_unknown_fields = options->GetIgnoreUnknownFields(); | ||
| auto status = google::protobuf::util::JsonStringToMessage(content, &msg, parse_options); | ||
| if (!status.ok()) { | ||
| SetErrMsg("failed to parse " + msg.GetDescriptor()->name() + kJSONExt + ": " + status.ToString()); | ||
| SetErrMsg("failed to parse " + std::string(msg.GetDescriptor()->name()) + kJSONExt + ": " + status.ToString()); | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
| case Format::kText: { | ||
| if (!google::protobuf::TextFormat::ParseFromString(content, &msg)) { | ||
| SetErrMsg("failed to parse " + msg.GetDescriptor()->name() + kTextExt); | ||
| SetErrMsg("failed to parse " + std::string(msg.GetDescriptor()->name()) + kTextExt); | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
| case Format::kBin: { | ||
| if (!msg.ParseFromString(content)) { | ||
| SetErrMsg("failed to parse " + msg.GetDescriptor()->name() + kBinExt); | ||
| SetErrMsg("failed to parse " + std::string(msg.GetDescriptor()->name()) + kBinExt); | ||
| return false; | ||
| } | ||
| return true; | ||
|
|
||
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.
Please use v3 instead (AI is missing this case).
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.
MAJOR.MINOR.PATCHpattern is only supported in v1. See: https://github.com/arduino/setup-protoc?tab=readme-ov-file#upgrade-from-v1-to-v2-or-v3