-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[mono] new Sdk that selects mono runtime components #54432
Conversation
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.
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? |
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 |
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 |
@steveisok Can I just do it like this? is TargetArchitecture defined?
|
Ok, so the plan here is twofold:
|
@steveisok would be better to extract the plan to separate issue for tracking? |
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. |
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? |
No, there's not a real need to have them in a separate pack. |
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
4492230
Compare
This comment has been minimized.
This comment has been minimized.
src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in
Outdated
Show resolved
Hide resolved
c09d837
to
756e5a6
Compare
src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props
Outdated
Show resolved
Hide resolved
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.
LGTM - nice work!
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.
nit: could we s/component-manifest/RuntimeComponentManifest/ or something, adding yet another naming format is painful
src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in
Outdated
Show resolved
Hide resolved
instead of TargetsMobile. We want the build files (mono-components.json) in every mono runtime pack, not just on mobile targets
src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/component-manifest.props
Outdated
Show resolved
Hide resolved
src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/component-manifest.targets
Outdated
Show resolved
Hide resolved
src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in
Outdated
Show resolved
Hide resolved
{ | ||
var dict = JsonSerializer.Deserialize<Dictionary<string, string>>(ref reader, options); | ||
if (dict == null) | ||
return null!; |
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.
Should the uses of JsonSerializer.Deserialize* also catch JsonException
?
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 don't think so - we want it to propagate
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.
Ok, then we should catch this up the chain somewhere, so we can log it as an error with the filename.
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)
@radical |
Also improve nullability a bit by making the properties immutable
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] ```
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 (
|
else | ||
idict.Remove("Identity"); | ||
return new JsonModelItem(identity, metadata: idict); | ||
default: | ||
throw new Exception(); | ||
throw new NotSupportedException(); |
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.
token type in the message might be useful for debugging
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.
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:
_MonoRuntimeAvailableComponents
which is an item list like"hot_reload;diagnostic_tracing"
_MonoComponent
which is some subset of the items that makes sense in the current configuration of the user app_MonoSelectRuntimeComponents
target_MonoRuntimeSelectedComponents
(and_MonoRuntimeSelectedStubComponents
if static linking) which are the names of the comopnents that will be available (or stubbed out, if static linking)_MonoRuntimeComponentLink
which 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
,ComponentName
andLinking
_MonoRuntimeComponentDontLink
list of filenames to exclude from linking for workloads which would rather take everything fromnative/
and just exclude what we tell them to exclude.