Skip to content
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

Generate UnitsNet.WindowsRuntimeComponent as its own source code #409

Closed
angularsen opened this issue Feb 13, 2018 · 1 comment
Closed

Comments

@angularsen
Copy link
Owner

The current UnitsNet source code is a bit of a mess due to supporting Windows Runtime Component (WinRTC) and adapting to all the constraints WinRTC imposes on the public API types and method signatures. This results in MANY #if WINDOWS_UWP directives that clutters the code.

Short story; WinRTC allows .NET code and nugets to be consumed by JavaScript and C++ Windows UWP apps, by sticking to some strict constraints on the public API. Read more on Windows Runtime Component and its constraints.

I propose:

  • Move WinRTC project to /UnitsNet.WindowsRuntimeComponent folder
  • Generate WinRTC source code separately in new folder
  • Remove #if directives from generated code of each set so it only has the code it needs
  • Add linked files (not copies) of /UnitsNet source code that is fully compatible with both, with same folder structure
  • Update build scripts with new paths
  • Bonus: Copy/add some test cases specific to WinRTC, we currently have zero test coverage on it

I would rank this as medium difficulty, it definitely involves some mucking around with the source code, the code generator scripts and the build scripts. I'm happy to assist if anyone wants to take this on though!

@angularsen
Copy link
Owner Author

In #520 we made an effort to simplify the generated code for WRC and NetFramework. It's still the same scripts, which makes sense since the output is so similar and it would require more effort to keep two sets of scripts in sync, but at least now there is generated separate sets of source code for WRC and NetFramework so we don't have all the #if WINDOWS_UWP sections in the code. That complexity is now contained in the generator scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant