-
Notifications
You must be signed in to change notification settings - Fork 393
Support nanoFramework #837
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #837 +/- ##
=========================================
+ Coverage 0 82.8% +82.8%
=========================================
Files 0 291 +291
Lines 0 44158 +44158
=========================================
+ Hits 0 36538 +36538
- Misses 0 7620 +7620
Continue to review full report at Codecov.
|
So easiest way is just to remove the 4 units that are decimal based. They won't be anyway used by any sensor. |
I would propose changing from decimal to double for these quantities and
maybe somehow skip the largest/smallest units that caused problems with
round-trip calculation tests, while still reusing the same Json quantity
specifications.
Optionally keep them but fix the tests that break on these and accept the
precision loss for these units.
|
I was thinking of that but then all the formulas will have to be adjusted. like " * 8m" should be transformed, and all the others as well. Removing large units. |
Fair enough, can always attack those quantities later. |
CodeGen/README.md
Outdated
|
||
By default, the code generator will as well generate automatically 1 project per Quantity. | ||
|
||
You can load all the projects at once using the automatically generated solution ```nanoFramework.UnitsNet.sln``` |
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.
UnitsNet.nanoFramework.sln
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.
We could also add a bit more information about what nanoframework is and what it is used for (just a few sentences) and link to the official nanoframework site from here.
CodeGen/Program.cs
Outdated
@@ -43,7 +43,8 @@ internal class Program | |||
/// <param name="verbose">Verbose output? Defaults to false.</param> | |||
/// <param name="repositoryRoot">The repository root directory, defaults to searching parent directories for UnitsNet.sln.</param> | |||
/// <param name="skipWrc">Skip generate UnitsNet.WindowsRuntimeComponent? Defaults to false.</param> | |||
private static int Main(bool verbose = false, DirectoryInfo repositoryRoot = null, bool skipWrc = false) | |||
/// <param name="skipNanoFramework">Skip generate nanoFrmaework Units</param> |
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.
Typo.
Maybe: Skip generate UnitsNet.nanoFramework quantities? Defaults to false.
CodeGen/README.md
Outdated
@@ -31,3 +31,9 @@ CodeGen.exe --ver | |||
|
|||
Hit TAB and it should now suggest `--version` and `--verbose` parameters. | |||
This should work with any .exe that is compiled with Dragonfruit's app model. | |||
|
|||
## nanoFramework project generation |
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.
Maybe just call this ## nanoFramework
.
We should also mention this supported framework in the Build Targets
section at the top of the readme, with a link to this section with more information.
/// <param name="quantities">The quantities to create</param> | ||
public static void Generate(string rootDir, Quantity[] quantities) | ||
{ | ||
var outputDir = Path.Combine(rootDir, "NanoFramework", "GeneratedCode"); |
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 would change the directory name to UnitsNet.NanoFramework
to be consistent with WRC and other projects.
Log.Information(sb.ToString()); | ||
} | ||
|
||
GenerateSolution(quantities, Path.Combine(outputDir, "nanoFrmawork.UnitsNet.sln")); |
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.
Change to UnitsNet.nanoFramework.sln
private static void GenerateProject(StringBuilder sb, Quantity quantity, string filePath) | ||
{ | ||
// This will have to be adjusted | ||
// $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ |
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.
Is this comment still relevant? Seems already adjusted.
@Ellerbach I updated the build scripts, but msbuild fails with Probably need some dependencies to build this from AppVeyor and commandline, but I couldn't immediately see from the nanoframework docs what dependencies are needed? https://docs.nanoframework.net/content/building/build-in-visual-studio.html |
Any of the nanoFramework nuget uses an automated chain: https://github.com/nanoframework @josesimoes can for sure help here to find the right things to do. |
Hi @angularsen! In order to build a nanoFramework project the VS extension has to be installed, otherwise you'll see that error above. As we are using Azure Pipelines, we have an Azure Pipeline task that does exactly that. You are using AppVeyor which, unfortunately, doesn't allow you to use it directly. This is basically a PowerShell so you shouldn't have much problem adding it to your build. Please check the code here Also know that before Azure Pipelines we were using AppVeyor too. Check the yaml that was used back then: Hope this can be helpful. If you get stuck on anything just ping me and I'll be glad to help you. |
Thanks for the pointers. I'm afraid my work is taking up all my time these days. I won't be able to push this forward anytime soon. If you are interested in trying to set up a working appveyor pipeline and do a pull request, I can assist on that. |
I have the same issue regarding time. So let's see when we'll both have a bit more time. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@angularsen I can look into the required changes in your pipeline to add a .NET nanoFramework build. |
I'm positive to supporting that build target, it seems fairly widely used.
Please go ahead with the pull request, I'll be happy to assist.
…On Fri, Apr 9, 2021, 15:31 José Simões ***@***.***> wrote:
@angularsen <https://github.com/angularsen> I can look into the required
changes in your pipeline to add a .NET nanoFramework build.
Should I go ahead? Or you prefer that we just fork the repo and handle
that at our end with a pipeline of our own?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#837 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGAK2EDIZAHSHJ754ZERX3TH36SRANCNFSM4RQWFFEQ>
.
|
@angularsen this turned out to be even easier than what I tough initially. All because the init and build are using Power Shell. I was under the impression that this had to be deal with Appveyor yaml... 😉 The PS1 have been updated along with the Solution to build the nanoFramework projects. |
5645bbd
to
7608a53
Compare
@angularsen build 🟢 ! Everything working except the NuGet packages generation. 👏🏻 |
Holy cow, what an effort @josesimoes ! I don't currently have Visual Studio installed so I can't test locally right now.
Do you need my help on anything on the NuGet end of things, or will you work on that next? Great job! |
Awesome! If something is not clear, just ping me or @Ellerbach .
Just waiting on a decision about the nuget strategy. Please refer to the latest comments on #836.
Thanks! 😊 |
Does nanoframework support trimming of self-contained applications like netcore by any chance? |
It has a similar feature, yes. It's a post-build processing that removes the code that's not called in an app. |
@angularsen any decisions on the nuget strategy ? Are we good with adding nuspecs for each unit? |
I was thinking more for the final application. Even if the nuget package is large, are the final targets automatically trimmed? |
error MSB4057: The target "Build" does not exist in the project. Need some dependencies to build this.
- Move nfproj files. - Fix files path in all projects. - Fix references in all projects. - Fix project path in solution file. - Fix typo in solution name.
- Fix nfproj content to new location. - Project GUID is now generated on project. - Solution builder now places nfprojs in their own directory and grabs project GUID from project file.
- Now projects requiring Math NuGet packages are properly processed. - Remove PackageGenerator as it's not required anymore.
- Should be along with the other sln files of the project,
@angularsen just added nuspecs for the other Units identified by @Ellerbach as the ones used in .NET IoT. Because this has been branched in a while, I've rebased it so it's now synced with the master branch. Considering that in 2 weeks time there will be a hackathon where these are required as part of the work happening to have .NET IoT bindings in sync with .NET nanoFramework, it would be great if these could be published in the coming days. |
✅ Build and tests on AppVeyor is green GitHub can't even load the list of changed files 😆 I spotted a few minor things, but nothing blocking a merge. Looks good to me, let's give it a try! Temperature nuget should be published by AppVeyor within 20 minutes or so. |
Nuget queued |
A couple of observations so far: Nuspec version is not increased with UnitsNet
The latest build 4.90.0 still built 4.89.0 of nanoframework nuget, so I guess we need to increase all the .nuspec files similar to how we do for WindowsRuntimeComponent in AppVeyor warningConsider renaming to
Inline console output when running build scriptWhen running Instead of:
Maybe something like this.
Or we can just omit the entire OK-thing, I don't consider it very useful anymore. It was mostly helpful in the early days while debugging and developing the code generator. Minor whitespace issues in nuspecDouble whitespace in Authors: Remove whitespace/newline in Description:
Artifacts\UnitsNet.zip has all nano projects in rootExpected to find these under https://ci.appveyor.com/project/angularsen/unitsnet/builds/39061929/artifacts |
A lot of stuff to improve there... I'll get into it ASAP. Most of that are "just" copy/paste from what was there... On the nuget version, for example, that could (should?) be passed in the command line instead of being fixed in the nuspec file. Also, on versioning, we have it automated by using the nice nbgv. |
Actually I haven't done anything to bump the nuspec version, so no surprise that the version doesn't get updated 😅 . Fix is on the way.
Well... that's not a very fair warning... according to that documentation
🔍 can't see any double whitespace there...
|
Fixes #836
Adding single unit creation to support usage in nanoFramework.
This is an advance draft, things to discuss, see below on what needs to be done. Good news if that it works quite smoothly all up :-)
What is done:
What needs to be done:
<!-- <OutputPath>$(MSBuildThisFileDirectory)Artifacts/$(MSBuildProjectName)</OutputPath> -->
This will allow all projects except 4 to compile (see the issue with Decimal operations)