Uh oh!
There was an error while loading. Please reload this page.
[mono] new Sdk that selects mono runtime components - #54432
Conversation
ghost
commented
Jun 18, 2021
Tagging subscribers to this area: @dotnet/ncl Issue DetailsRelated to #54417 The contract is:
TODO
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
lambdageek
commented
Jun 23, 2021
Ok, added a workload manifest. One thing that is surprising to me is that we have apparently an iossimulator-x86 runtime pack? Is that right? I didn't add the workload manifest for the Sdk for it. We need one, right? |
lambdageek
commented
Jun 23, 2021
Is this actually going to work? because of the indirection of going through pack IDs, only a build targeting, let's say... android-arm64 will load the |
steveisok
commented
Jun 23, 2021
You need to add the right imports in https://github.com/dotnet/runtime/blob/4615e06d531d10cb0c4347173718ee30620fda9a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.targets |
lambdageek
commented
Jun 23, 2021
@steveisok Can I just do it like this? is TargetArchitecture defined? |
lambdageek
commented
Jun 23, 2021
Ok, so the plan here is twofold:
|
marek-safar
commented
Jun 24, 2021
@steveisok would be better to extract the plan to separate issue for tracking? |
lambdageek
commented
Jun 24, 2021
I updated the related issue #54417 with the notes from here. I also plan to update the design doc as part of this PR. |
I think this could be simplified a lot if we handled it the way the Cross runtimes do? - which sound like roughly the plan from #54432 (comment) |
Yep, the difference is that we also want to include a .targets file. We can only import that once, so it has to be in another pack. |
lewing
commented
Jun 24, 2021
I think we could probably combine at least the runtime config and this into a single pack with targets that we enable appropriately. There isn't much need to have everything in a separate pack is there? |
steveisok
commented
Jun 24, 2021
No, there's not a real need to have them in a separate pack. |
lambdageek
commented
Jun 24, 2021
Yea I think we should have a single Mono Targeting SDK nuget that has all tasks and targets that are portable across all host and target architectures. (At the moment it's the runtime config parser and this component selector) |
fd2c306 to
4492230Compare
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
c09d837 to
756e5a6CompareUh oh!
There was an error while loading. Please reload this page.
lewing
left a comment
There was a problem hiding this comment.
nit: could we s/component-manifest/RuntimeComponentManifest/ or something, adding yet another naming format is painful
Uh oh!
There was an error while loading. Please reload this page.
instead of TargetsMobile. We want the build files (mono-components.json) in every mono runtime pack, not just on mobile targets
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| { | ||
| var dict = JsonSerializer.Deserialize<Dictionary<string, string>>(ref reader, options); | ||
| if (dict == null) | ||
| return null!; |
There was a problem hiding this comment.
Should the uses of JsonSerializer.Deserialize* also catch JsonException?
There was a problem hiding this comment.
I don't think so - we want it to propagate
There was a problem hiding this comment.
Ok, then we should catch this up the chain somewhere, so we can log it as an error with the filename.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
radical
commented
Jul 7, 2021
Don't wanna block you, but would it be possible to add a sample for this? In future we will be able to test this, at least on wasm. But for now, a sample would help validate it. Not sure if that makes sense though! |
from MonoRuntimeComponentsReadManifestTask
Build doesn't like it for some reason (probably net472)
lambdageek
commented
Jul 7, 2021
@radical |
Also improve nullability a bit by making the properties immutable
radical
commented
Jul 7, 2021
Makes sense. I have a PR open that will add some E2E(almost) testing in |
We get nice error messages now like ``` src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets(8,5): error : Failed to deserialize json from file 'artifacts/bin/mono/iOSSimulator.x64.Release/build/RuntimeComponentManifest.json', JSON Path: $.items._MonoRuntimeAvailableComponents[2], Line: 14, Position: 1 [component-manifest.sample.proj] src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets(8,5): error : JsonException: The JSON value could not be converted to System.Collections.Generic.Dictionary`2[System.String,System.String]. Path: $.identity | LineNumber: 0 | BytePositionInLine: 16. Path: $.items._MonoRuntimeAvailableComponents[2] | LineNumber: 14 | BytePositionInLine: 1. [component-manifest.sample.proj] src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets(8,5): error : InvalidOperationException: Cannot get the value of a token type 'Number' as a string. [component-manifest.sample.proj] src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets(8,5): error : [component-manifest.sample.proj] ```
ghost
commented
Jul 7, 2021
Hello @lambdageek! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me ( |
| return new JsonModelItem(identity, metadata: idict); | ||
| default: | ||
| throw new Exception(); | ||
| throw new NotSupportedException(); |
There was a problem hiding this comment.
token type in the message might be useful for debugging
There was a problem hiding this comment.
The JsonSerializer catches and decorates NotSupportedException with location and type info https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-converters-how-to?pivots=dotnet-5-0#notsupportedexception
Related to #54417
The contract is:
_MonoRuntimeAvailableComponentswhich is an item list like"hot_reload;diagnostic_tracing"_MonoComponentwhich is some subset of the items that makes sense in the current configuration of the user app_MonoSelectRuntimeComponentstarget_MonoRuntimeSelectedComponents(and_MonoRuntimeSelectedStubComponentsif static linking) which are the names of the comopnents that will be available (or stubbed out, if static linking)_MonoRuntimeComponentLinkwhich is a list of filenames (relative to the runtime packnative/subdirectory) of the libraries that must be either copied (for dynamic loading) or statically linked (for static linking) with the runtime. The items also have some metadata such asIsStub,ComponentNameandLinking_MonoRuntimeComponentDontLinklist of filenames to exclude from linking for workloads which would rather take everything fromnative/and just exclude what we tell them to exclude.