magnopus-opensource / connected-spaces-platform

"An interoperable communication library for the spatial internet."
https://www.magnopus.com/csp
Apache License 2.0
89 stars 12 forks source link

[NT-0] refac: Refactor CSharpWrapperGenerator #491

Closed magnopus-swifty closed 1 month ago

magnopus-swifty commented 1 month ago

A series of refactors that preserve current behaviour but reduces copy-pasted code and hopefully make the logic a little easier to follow.

Confirmed after each change that the wrapper generator produces the same output code.

MAG-SamBirley commented 1 month ago

Hey @magnopus-swifty, some of the PR checks are failing with this change, would you mind taking a look?

There might be others, but one issue appears to be a syntactical error on line 457 of CSharpWrapperGenerator.py:

Traceback (most recent call last):
23:54:00     File "/Users/automaton/TCA/work/d578f8b65d37e27d/Tools/WrapperGenerator/WrapperGenerator.py", line 9, in <module>
23:54:00       from CSharpWrapperGenerator import CSharpWrapperGenerator
23:54:00     File "/Users/automaton/TCA/work/d578f8b65d37e27d/Tools/WrapperGenerator/CSharpWrapperGenerator.py", line 457
23:54:00       full_type_name = f"{
23:54:00                        ^
23:54:00   SyntaxError: unterminated string literal (detected at line 457)
MAG-SamBirley commented 1 month ago

Hey @magnopus-swifty it looks like there is another issue with this change over here, where MacOS builds are attempting to invoke a Windows csharpier executable.

magnopus-swifty commented 1 month ago

Hey @magnopus-swifty it looks like there is another issue with this change over here, where MacOS builds are attempting to invoke a Windows csharpier executable.

That's odd. I didn't change that line, just moved it into a function. How is the main develop branch working and this branch not?

Edit: Ah it looks like I DID change it, to check the return result. Looks like it is failing (see #496) with the same error (dotnet-csharpier.exe: No such file or directory) but the OSX build just continues regardless with un-prettified generated C#. I'll revert that chance in this PR and file a bug for this issue specifically.

magnopus-swifty commented 1 month ago

Addressed the sections of code that were bothering me and took some time to reformat and do some rough documentation on the code while I was about it. I feel like this is good enough to submit and make subsequent improvements in another PR.