Skip to content

Use correct CoreLib configuration for shared framework linker trimming #45821

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

Merged
merged 5 commits into from
Jan 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/libraries/illink-sharedframework.targets
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,20 @@
<ILLinkArgs>$(ILLinkArgs) --nowarn $(LinkerNoWarn)</ILLinkArgs>
</PropertyGroup>

<!-- Retrieve CoreLib's targetpath via GetTargetPath as it isn't binplaced yet. -->
<MSBuild Projects="$(CoreLibProject)"
<!-- Retrieve CoreLib's path as it isn't binplaced alongside the libraries - https://github.com/dotnet/runtime/issues/43095. -->
<ItemGroup>
<CoreLibProjectWithRuntimeConfig Include="$(CoreLibProject)">
<!-- Don't flow TargetFramework and Platform to use same inputs and outputs as the CoreLib's build as part of the runtime. -->
<UndefineProperties>$(UndefineProperties);TargetFramework;Platform</UndefineProperties>
<!-- If conflicting, manually set the Configuration property of the CoreLib project so that it aligns with the specified runtime configuration in the libraries' build. -->
<Properties Condition="'$(RuntimeFlavor)' == 'CoreCLR' and
'$(Configuration)' != '$(CoreCLRConfiguration)'">Configuration=$(CoreCLRConfiguration)</Properties>
Copy link
Member

Choose a reason for hiding this comment

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

Just a question, mostly for @ViktorHofer. Why do we have both $(CoreCLRConfiguration) and $(MonoConfiguration)? Why not just have $(RuntimeConfiguration)? Do we expect to be able to build the repo using different configurations for coreclr and mono?

Copy link
Member

Choose a reason for hiding this comment

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

There is a RuntimeConfiguration property but in this case we can't use that as we need to respect the inferred CoreCLRConfiguration and MonoConfiguration properties.

Do we expect to be able to build the repo using different configurations for coreclr and mono?

Yes

<Properties Condition="'$(RuntimeFlavor)' == 'Mono' and
'$(Configuration)' != '$(MonoConfiguration)'">Configuration=$(MonoConfiguration)</Properties>
</CoreLibProjectWithRuntimeConfig>
</ItemGroup>

<MSBuild Projects="@(CoreLibProjectWithRuntimeConfig)"
Targets="GetTargetPath">
<Output TaskParameter="TargetOutputs" PropertyName="SystemPrivateCoreLibPath" />
</MSBuild>
Expand Down