-
Notifications
You must be signed in to change notification settings - Fork 63
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
Run grpc code generation in a private application context #401
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…sed after each run of the generator. This helps eliminate library/class leaks in tools menu context which would otherwise require restarting LV to get rid of. It also make it easier to test from source since it doesn't modify the source project while generating.
dixonjoel
reviewed
Jan 9, 2025
...ce/Client Server Support New/gRPC Scripting Tools/Class API/Get ControlRef from ClassItem.vi
Show resolved
Hide resolved
dixonjoel
reviewed
Jan 9, 2025
labview source/Client Server Support New/gRPC Scripting Tools/Project API/Close Project.vi
Show resolved
Hide resolved
dixonjoel
reviewed
Jan 9, 2025
...ient Server Support New/gRPC Scripting Tools/Top Level API/Create Data Clusters for Types.vi
Outdated
Show resolved
Hide resolved
dixonjoel
reviewed
Jan 9, 2025
...ent Server Support New/gRPC Scripting Tools/VI API/Front Panel API/Create Type Definition.vi
Show resolved
Hide resolved
dixonjoel
approved these changes
Jan 9, 2025
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.
Approved with a couple suggestions / questions.
…better clarity and consistency.
jasonmreding
added a commit
that referenced
this pull request
Jan 14, 2025
* master: Run grpc code generation in a private application context (#401)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Run grpc code generation in a private application context that is closed after each run of the generator. This helps eliminate library/class leaks in the tools menu context which would otherwise require restarting LV to get rid of. It also makes it easier to test from source since the generator will no longer load template libraries into the source project while generating. Otherwise, LV tends to never unload libraries once loaded which often results in name collisions when running the generator multiple times on the same proto file. By loading everything into a private context, we avoid this since it acts like a project where everything gets unloaded from memory when the context is closed at the end.
Implementation
For the most part this involved:
Main.vi
and closing it before going idleOwning App
property from the property node. I audited all usages ofOpen VI Reference
andNew VI
nodes to ensure they all now use the appropriate app context and not just the "default" context.In addition, I also:
Delete
method on a project item. This primarily happened when we try to cleanup template VIs that are no longer needed at the end of generation. This would typically manifest itself when generating both client and server at the same time or generating code for multiple proto files at the same time. I ultimately fixed this by invokingForceDelete
rather thanDelete
. I didn't fully debug the details of this. However, I believe what was happening is that the delete was removing the item from the library but wasn't actually removing/unloading the VI from memory. This then changed the qualified name of the VI since it is no longer part of the library. When doing the same thing on the second library, this would then create a name collision since both VIs have the same name when no longer qualified by a library. CallingForceDelete
works around this since it ignores the resulting name conflict. I also fixed some of the delete code that was only removing from the library and not deleting from disk.Testing
Manually tested generation of both the client and the server using proto APIs that included nested messages, enums, and oneof fields. Tested both Win32 and Win64 using LV 2019 and LV 2024.