Skip to content

Add Netcoreapp ridless config to System.Private.Uri And System.Private.Xml#38142

Merged
Anipik merged 6 commits intodotnet:masterfrom
Anipik:privateUri
Jun 23, 2020
Merged

Add Netcoreapp ridless config to System.Private.Uri And System.Private.Xml#38142
Anipik merged 6 commits intodotnet:masterfrom
Anipik:privateUri

Conversation

@Anipik
Copy link
Copy Markdown
Contributor

@Anipik Anipik commented Jun 19, 2020

This is related to effort on removing the cross compilation. A lot of projects are being cross compiled because of having a project dependency on these 2 projects.
We are adding a ridless tfm so that other projects can use this tfm for compiling. This would never be shipped.
I am currently using the windows implementation for the ridless one.

@Anipik Anipik requested review from ViktorHofer, ericstj and safern June 19, 2020 01:59
@Dotnet-GitSync-Bot
Copy link
Copy Markdown
Collaborator

I couldn't figure out the best area label to add to this PR. Please help me learn by adding exactly one area label.

Copy link
Copy Markdown
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

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

Your PR title is slightly misleading. The configurations were already (hard-coded) version less before.

@Anipik Anipik changed the title Add Netcoreapp versionless config to System.Private.Uri And System.Private.Xml Add Netcoreapp ridless config to System.Private.Uri And System.Private.Xml Jun 19, 2020
@Anipik Anipik requested a review from marek-safar as a code owner June 19, 2020 17:16
<WasmPInvokeModules Include="libSystem.Native"/>
<WasmPInvokeAssemblies Include="$(MonoArtifactsPath)\System.Private.CoreLib.dll"/>
<WasmPInvokeAssemblies Include="$(ArtifactsBinDir)\System.Runtime\$(NetCoreAppCurrent)-Unix-$(Configuration)\System.Runtime.dll"/>
<WasmPInvokeAssemblies Include="$(ArtifactsBinDir)\System.Runtime\$(NetCoreAppCurrent)-$(Configuration)\System.Runtime.dll"/>
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.

This list seems very error-prone. Maybe we can add P2Ps and get the output assemblies?

cc: @ViktorHofer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can create an issue to track this.

@Anipik
Copy link
Copy Markdown
Contributor Author

Anipik commented Jun 22, 2020

@ericstj @ViktorHofer @safern can you review this one ?

@ViktorHofer
Copy link
Copy Markdown
Member

We are adding a ridless tfm so that other projects can use this tfm for compiling. This would never be shipped.

Instead we could annotate the P2Ps that target System.Private.Uri and System.Private.Xml and specify a non TargetOS agnostic TargetFramework. That sounds like a cleaner approach to me and we would avoid building a configuration for the sake of easier multi-targeting.

cc @ericstj

@dotnet dotnet deleted a comment Jun 22, 2020
@ericstj
Copy link
Copy Markdown
Member

ericstj commented Jun 22, 2020

Instead we could annotate the P2Ps that target System.Private.Uri and System.Private.Xml and specify a non TargetOS agnostic TargetFramework

What do you propose the pattern is?

<ProjectReference Include="...\System.Private.Uri.csproj" TargetFramework="$(NetCoreAppCurrent)-$(TargetOS)" />
<ProjectReference Include="...\System.Private.Uri.csproj" UseTargetOS="true" />

Whatever we do we'd need to be careful to implement at the caller and not through global properties. Here: https://github.com/dotnet/arcade/blob/4e0dc26a70f3f9bb9bc7ae65937f85c88332abdd/src/Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk/src/build/Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk.targets#L74-L78

@ViktorHofer
Copy link
Copy Markdown
Member

be careful to implement at the caller and not through global properties

Isn't the TargetFramework already a global property? Wouldn't something like: `<ProjectReference Include="x.csproj" AdditionalProperties="TargetFramework=$(NetCoreAppCurrent)-$(TargetOS)" just work and not need any TargetFramework.Sdk changes?

@ericstj
Copy link
Copy Markdown
Member

ericstj commented Jun 22, 2020

We don't want projects setting TargetFramework of another project. That results in targeting information from one project being leaked into the referencing project. It can then get out of sync and cause major issues.

Playing around with global properties in authoring is a recipe for disaster (race conditions, invalid build configurations, etc). We need a well defined behavior here that is controlled by the config system.

TargetFramework metadata would specify to the configuration system: resolve this Project Reference as if the calling project targeted a different TargetFramework than actual. In this case, net5.0-Windows_NT instead of net5.0. The config system would still be responsible for selecting the TF from the set of supported ones in the referenced project and it would be the only one setting the global property.

The second suggestion just further constrains this. Rather than letting a project use any TargetFramework you could only allow a project that doesn't include a -$(TargetOS) suffix to resolve a project reference as if it did.

Copy link
Copy Markdown
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

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

I like it! Thanks for coming up with this solution!

<Compile Include="System\Uri.Windows.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsUnix)' == 'true'">
<ItemGroup Condition="'$(TargetsAnyOS)' == 'true'">
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.

Nit: I’m not a huge fan of this property name, but the behavior is correct.

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.

Yeah that property name is definitely misleading...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It has been present since the old config system, So we need to be careful if we decide to change this one name.

@Anipik Anipik merged commit 9907151 into dotnet:master Jun 23, 2020
@ViktorHofer
Copy link
Copy Markdown
Member

@Anipik can you please add a comment to the projects where you are treating the non RID target framework as Unix and WASM? #38142 (comment)

@Anipik
Copy link
Copy Markdown
Contributor Author

Anipik commented Jun 25, 2020

@Anipik can you please add a comment to the projects where you are treating the non RID target framework as Unix and WASM?

I missed it, i will add it

@Anipik Anipik deleted the privateUri branch August 25, 2020 21:52
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants