-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Use Roslyn to create ref/ assemblies #23403
Use Roslyn to create ref/ assemblies #23403
Conversation
@dougbu you are my new favorite person 😁. Can /docs/ReferenceAssemblies.md be removed? Fixes https://github.com/dotnet/aspnetcore-internal/issues/2693 |
Yes 😺 |
src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj
Outdated
Show resolved
Hide resolved
I must have missed it - where/how do we actually hook in to the roslyn |
It's a single property setting here. |
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.
Everything looks good except for the question about building against old refs & running against new impl's - will approve once that's resolved
0c97680
to
ecf8a2b
Compare
ecf8a2b
to
59a80f6
Compare
e991ff1
to
de37e9c
Compare
One idea we had in dotnet/runtime was to use the ILLinker to trim the resulting reference assemblies that are shipped in the ref pack. We already do this for our runtime assemblies, doing so for ref might be a good use of linker. The settings we use with it to root public API and trim unreachable code are here: https://github.com/dotnet/runtime/blob/69b0d160953f5c920e52f021366743623693c158/eng/illink.targets#L192 |
That sounds like fun 😺 but I'm not that sure the small size bump merits the extra work. My latest build produced a 2.02 MB Microsoft.AspNetCore.App.Ref.5.0.0-ci.nupkg while the one from the most recent rolling build of master was 1.74 MB. Thoughts @Pilchie❔ |
I suspect it might be a fair bit of work, given that our reference assemblies need to have some internals so that test assemblies can be built that have |
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 declare this PR working.
The https://dev.azure.com/dnceng/public/_build/results?buildId=731663 build might still time out (unrelated to my changes) but otherwise did all the Right Thing:tm:s Have confirmed the downlevel assemblies landed in Microsoft.AspNetCore.App.Ref.5.0.0-ci.nupkg and shipped assemblies all built against what they should have e.g. Microsoft.AspNetCore.Http.Features.dll references the expected (older) ref/ assembly for System.IO.Pipelines.
System.Collections, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.ComponentModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.IO.Pipelines, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.Linq, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Net.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
I'll clean up the commits and remove the "test only" parts in preparation for a final review. In the meantime, I would appreciate comments on below !!!
bit since I'd rather not check that question in 😈
Maybe not quite as much as you suspect. My objection was based on the size of the target @ericstj pointed us to and the potential build perf degradation due to a lot of |
Fair enough. FWIW we saw a lot larger size differences when we were looking at roslyn's references. For example, I spot checked System.Text.Json right now and our ref is 25KB vs Roslyn's which is 75KB. The nice thing about the linker is that it can solve the internals problem for you. IIRC we were trying idefs and this was hard because the compiler needs legit syntax, whereas with the linker you can root just the internals you need and it will walk the type graph. |
This is to some degree expected. The reference assemblies generated by the runtime team are omitting members. This can be done in runtime because they have a good grasp of their specific domain and can safely omit some types / members. Though this has bit them before and ended up causing real world customer issues (the stripping of The general compiler feature though must produce reference assemblies that are correct in any customer domain. That means we'll generally include more data because it's a superset of what runtime would produce. |
- remove `$(IsReferenceAssemblyProject)`, `$(ReferenceReferenceAssemblies)` and `$(ReferenceImplementationAssemblies)` - remove unnecessary `$(NoWarn)` settings nits: - remove a few misleading comments - wrap some long lines
- touch up SharedFramework.External.props
- automate use of properties in the `@(LatestPackageReference)` item group to make this maintainable - add a couple of special cases at the bottom of eng/Dependencies.props - add one more `$(...PackageVersion)` property to avoid yet-another special case
- exclude ref/ assembly from packages other than targeting pack - update Microsoft.AspNetCore.App.Ref.csproj - `%(IsReferenceAssembly)` and `%(ReferenceGrouping)` metadata no longer relevant - only ref/ assemblies are in `@(ReferencePathWithRefAssemblies)` item group nits: - remove now-unnecessary workaround - issues with TFM transition are behind us - clean up Microsoft.AspNetCore.App.Runtime.csproj slightly - use `GeneratePathProperty="true"` - reorder item / property settings for meta-expansion - correct spelling errors and phrasing in comments
- remove CrossRepoBreakingChanges.md; was tied to old TeamCity infrastructure - also much less relevant given repo merges - adjust details and examples in ReferenceResolution.md - reflect repo merges, Dependencies.props changes, and current Maestro++ channels - add a few more details e.g. specific files where Version.Details.xml versions are used
- convert a couple of warnings to errors - use consistent casing for Microsoft.NETCore.App.Runtime.* packages - reduce `%(LatestPackageReference.Version)` metadata special cases - add and improve comments e.g. - improve comments about `$(*V0PackageVersion)` properties - improve placement of comments about item removal in ResolveReferences.targets - confirmed `$(*V0PackageVersion)` property list is complete nits: - fix solution example in ReferenceResolution.md - remove item group definition for `@(LatestPackageReference)` - remove `%(LatestPackageReference.VersionName)` metadata after use; large item group - similarly, remove `%(LatestPackageReference.RTMVersion)` when not needed; just complicates `Condition`s When I squash, I must remember this fixes - #14801 - dotnet/aspnetcore-internal#2693
- gather RTM package references in a new project - a (very) separate project to work around package conflict resolution - empty `Test` target works around Arcade's testing approach - new target in ResolveReferences.targets updates relevant assembly paths to use the RTM packages - done as soon as possible after `ResolvePackageAssets` determines the paths - done for all compilation inputs, not just ref/ assemblies
d3c005a
to
7ebf486
Compare
🆙📅 to consolidate changes since @wtgodbe and @JunTaoLuo reviewed (equivalent of c65704f) into two commits, remove the test-only bits, and rebase on preview8 branch. Please review or re-review in case there's anything I missed. @Pilchie we didn't chat about this but I chose to label this a tell-mode change. LMK if that's not right. |
The shift-click menu doesn't always work. The URI for the last 9 commits (all but removing the ref/ projects) is https://github.com/dotnet/aspnetcore/pull/23403/files/32dd707601f5b832060e8bbe49be5197c844545f..7ebf486c9a29c462ad8956d117b224c231111d53 at the moment. |
in all servicing builds. Cannot reference two versions of a package, mandating this separate package. | ||
--> | ||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> |
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.
Can't be parameterized?
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.
Not unless I remove the Directory.Build.*
files. I'll test out whether that causes any problems after getting this in and doing the merge to 'master'. It's no worse at the moment than the hard-coded TFMs in (say) our project templates. But, I'll clean it up next if possible.
I think tell mode is fine - I'll explicitly mention it in tactics, since it is a pretty significant change. |
Yipee!! |
Suggest reviewing the commits individually and mostly ignoring the first ("Remove all ref/ projects").
This set of changes
Microsoft.AspNetCore.App.Ref.*.nupkg
was about 1.5 MB before this change and 2 MB afterinternal
symbols when IVT is used