-
Notifications
You must be signed in to change notification settings - Fork 59
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
feat: Add code request generator dumper and an ability to run generator from dumped file #765
Conversation
…or from dumped file. For debugging puproses.
No region tags are edited in this PR.This comment is generated by snippet-bot.
|
Codecov Report
@@ Coverage Diff @@
## master #765 +/- ##
=======================================
Coverage 91.71% 91.71%
=======================================
Files 140 140
Lines 14794 14794
Branches 1052 1052
=======================================
Hits 13568 13568
Misses 942 942
Partials 284 284 Continue to review full report at Codecov.
|
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.
I came across #767 first, so I left some comments on these files in there.
@miraleung The plan was to review just this one first, merge it and then I could easily merge that into the #767. |
@@ -45,6 +45,34 @@ java_binary( | |||
], | |||
) | |||
|
|||
java_binary( |
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.
@miraleung (from #767): Nit: Can we add a summary comment above these two rules, which also indicate these are debugging tools?
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.
These are not rules, these are java_binaries used by one of the rules only. I clarified the purpose of the binaries in the comments
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.
Thanks for adding the comments. Could we copy-paste these into the Java src files as well? Up to you whether to replace these comments with a pointer to the Java source, or leave these as they are.
Could we also add a usage example? Up to you whether that goes here or in the Java source comments.
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.
Done
import com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse; | ||
import java.io.IOException; | ||
|
||
public class CodeGeneratorRequestDumper { |
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.
@miraleung (from #767): If we're using Main
in the class names, could we append it here for consistency? Alternatively, remove Main
from the other debugger's main class's name.
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.
Those are different things basically. The MainFromFile is literally another variation of the Main class. This, on the other hand, is a very different class, doing different thing. That is why they are named differently. And strictly speaking, this file is really very-very non-main =)
I.e. this class is not really related to Main, while the other one is.
Either way, if you have preferrence how to name these classes, please let me know and I'll rename them. For now, those were the best names I could come up with.
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.
MainStandalone could be something like CodeGeneratorRequestFileToGapicMain
?
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.
Renamed
src/main/java/com/google/api/generator/debug/CodeGeneratorRequestDumper.java
Show resolved
Hide resolved
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
|
||
public class MainFromFile { |
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.
@miraleung (from #767): Could we give this a more descriptive name, e.g. GapicToFileMain
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.
Ok, I'll rename. WDYT about naming the Main class to GapicMain also?
About the GapicToFileMain
class, I think that would misrepresent what this class does. Its main difference is that it reads/writes from files directly, instead of relying on protoc. I renamed it to MainStandalone
(I can add Gapic
in name, but in that case we would need to have that prefix in Main
class as well, let me know if you want me to do that)
@miraleung I've migrated your comments from the other PR here. Please if anything like this happens, just let me know you prefer a PR to be rebased, so I can rebase it first and then we can continue with the review. Otherwise it generates a lot of unnecessary work for both of us (like migrating these comments). |
@miraleung PTAL |
1 similar comment
@miraleung PTAL |
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.
LGTM with comments addressed.
import com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse; | ||
import java.io.IOException; | ||
|
||
public class CodeGeneratorRequestDumper { |
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.
MainStandalone could be something like CodeGeneratorRequestFileToGapicMain
?
@@ -45,6 +45,34 @@ java_binary( | |||
], | |||
) | |||
|
|||
java_binary( |
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.
Thanks for adding the comments. Could we copy-paste these into the Java src files as well? Up to you whether to replace these comments with a pointer to the Java source, or leave these as they are.
Could we also add a usage example? Up to you whether that goes here or in the Java source comments.
🤖 I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
….6.0 (#765) [](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.auth:google-auth-library-bom](https://togithub.com/googleapis/google-auth-library-java) | `1.5.3` -> `1.6.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-core).
For debugging purposes.
Usage example: