Skip to content

Remove reflection from FrameworkDescription#102164

Merged
jkotas merged 7 commits into
dotnet:mainfrom
am11:feature/versioning/cleanups
May 15, 2024
Merged

Remove reflection from FrameworkDescription#102164
jkotas merged 7 commits into
dotnet:mainfrom
am11:feature/versioning/cleanups

Conversation

@am11

@am11 am11 commented May 13, 2024

Copy link
Copy Markdown
Member

Tiny help for trimming; shaved 2KB off of artifacts/bin/coreclr/osx.arm64.Release/System.Private.CoreLib.dll.

@ghost ghost added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label May 13, 2024
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label May 13, 2024
@am11 am11 added area-System.Runtime community-contribution Indicates that the PR has been added by a community member and removed community-contribution Indicates that the PR has been added by a community member needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels May 13, 2024
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-runtime
See info in area-owners.md if you want to be subscribed.

}
}

internal const string InternalVersion = "9.0.0";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we want to add yet another place to update for version bumps. If you want to do this, it needs to be wired to eng/Versions.props.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version update bump looks like this 96c2e1d once a year. Is it really a big deal to update a string? If you think it is, lets close this PR then. It was a simple improvement with no visible effect on production bits.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version bumps are done every month in servicing, and they look like this: #101779

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the patch version. 🤭

Let me think a bit how to dedup it.


Assert.DoesNotContain("+", version); // no git hash

#if STABILIZE_PACKAGE_VERSION

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should stay as is. It is a regression test for a bug that slipped through the cracks some time ago.

@am11 am11 force-pushed the feature/versioning/cleanups branch from 4c08f94 to db1420d Compare May 14, 2024 01:48
Comment thread src/libraries/System.Private.CoreLib/src/System/Environment.cs Outdated
Comment thread src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems Outdated
@am11 am11 force-pushed the feature/versioning/cleanups branch 2 times, most recently from 80d8f1f to 791a6e7 Compare May 14, 2024 07:03
@am11 am11 force-pushed the feature/versioning/cleanups branch from 791a6e7 to c1ce415 Compare May 14, 2024 07:10
@@ -5,6 +5,7 @@
</PropertyGroup>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note, <TargetFramework>netstandard2.0</TargetFramework> this can probably use $(NetCoreAppCurrent) as it is only used by corelib building for current version.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may be cases where the generator runs on .NET Framework if people open the project in Visual Studio.

@am11

am11 commented May 14, 2024

Copy link
Copy Markdown
Member Author

Tested with ./build.sh (all subsets), ./build.sh libs only, then mono only and clr only. It generates ProductVersionInfo.g.cs under artifacts/obj correctly; but at different locations, which we can consolidate with <CompilerGeneratedFilesOutputPath> prop if needed, e.g. at the root of obj/ next to:

$ ls artifacts/obj/*version*
artifacts/obj/_version.c	artifacts/obj/_version.h	artifacts/obj/runtime_version.h

Comment thread src/libraries/System.Private.CoreLib/gen/ProductVersionInfoGenerator.cs Outdated
…erator.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@jkotas

jkotas commented May 14, 2024

Copy link
Copy Markdown
Member

It generates ProductVersionInfo.g.cs under artifacts/obj correctly; but at different locations

That's expected. Different CoreLib builds should not be sharing files.

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

{
context.RegisterPostInitializationOutput(ctx =>
{
string? informationalVersion = typeof(ProductVersionInfoGenerator).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how our build system handles this. Is this guaranteed to always match what typeof(object).Assembly would in the built corelib?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, the build system stamps the exact same AssemblyInformationalVersionAttribute on all binaries.

Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
* Remove reflection from FrameworkDescription

* Switch to source gen

* Address CR feedback

* Update src/libraries/System.Private.CoreLib/gen/ProductVersionInfoGenerator.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>

---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Runtime community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants