Skip to content
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

Make Microsoft.NETCore.Platforms pack from CSProj #50468

Merged
merged 9 commits into from
Apr 2, 2021

Conversation

ericstj
Copy link
Member

@ericstj ericstj commented Mar 31, 2021

Best reviewed commit-by-commit.

First commit just makes the package build from CSProj without having the CSProj build anything.
Then I brought over the task from arcade and made the CSProj responsible for building that task (but not including it in the package). This is mostly just a direct port, fixing analyzer issues.
The remaining two commits are just some refactoring and a test.

More tests will come in later PRs which make changes to the task.

Related: #48507

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@ghost
Copy link

ghost commented Mar 31, 2021

Tagging subscribers to this area: @Anipik, @safern, @ViktorHofer
See info in area-owners.md if you want to be subscribed.

Issue Details

Best reviewed commit-by-commit.

First commit just makes the package build from CSProj without having the CSProj build anything.
Then I brought over the task from arcade and made the CSProj responsible for building that task (but not including it in the package). This is mostly just a direct port, fixing analyzer issues.
The remaining two commits are just some refactoring and a test.

More tests will come in later PRs which make changes to the task.

Related: #48507

Author: ericstj
Assignees: -
Labels:

area-Infrastructure-libraries

Milestone: -


<ItemGroup>
<Content Include="runtime.json" PackagePath="/" />
<Content Include="_._" PackagePath="lib/netstandard1.0" />
Copy link
Contributor

Choose a reason for hiding this comment

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

curious on why we have this placeholder

Copy link
Member Author

Choose a reason for hiding this comment

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

It ensures this package is installable in projects using packages.config.

<TargetFrameworks>$(NetCoreAppToolCurrent);net472</TargetFrameworks>
<PackageId>$(MSBuildProjectName)</PackageId>
<AvoidRestoreCycleOnSelfReference>true</AvoidRestoreCycleOnSelfReference>
<AssemblyName>Microsoft.NETCore.Platforms.BuildTasks</AssemblyName>
Copy link
Contributor

Choose a reason for hiding this comment

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

whats the reason behind bringing this infra to runtime ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It’s only used by this single project in runtime. Splitting it into arcade is unnecessary and complicated changes. We should delete it from arcade after this. (Note that this helps with our pkgproj removal)

@safern
Copy link
Member

safern commented Mar 31, 2021

Then I brought over the task from arcade and made the CSProj responsible for building that task (but not including it in the package).

Can we instead put that task under the local repo tasks?

https://github.com/dotnet/runtime/tree/main/src/tasks

@ericstj
Copy link
Member Author

ericstj commented Mar 31, 2021

Can we instead put that task under the local repo tasks?

We could, but then we'd also need to come up with a way to test it.

What do you imagine is the benefit of putting this in tasks? @ViktorHofer actually suggested otherwise in chat about this last week:

the task doesn't need to live there though. If it's just used by the Platforms package, then it could also live in that folder

I'm not seeing a major issue with building this as part of libs. It's similar in a way to the source-generators will work.

@safern
Copy link
Member

safern commented Mar 31, 2021

What do you imagine is the benefit of putting this in tasks?

I was suggesting that cause that is where all the tasks we use as part of the build (that are not in arcade) live. So maybe we already have some code for the base task class, logger, etc that we could reuse.

But you raise a good point, which is that we don't have tests for those tasks.

@ericstj
Copy link
Member Author

ericstj commented Mar 31, 2021

In addition to tests I think the way the tasks build is somewhat undesirable. The build sequentially up front before anything else. The way this project is set up will make it build in parallel with all other libs. I'll see what I can do about sharing any common source by establishing a convention for it.

@safern
Copy link
Member

safern commented Mar 31, 2021

Yeah makes sense. I think the purpose of this task with what you've explained makes more sense to put it under this package subtree.

@ericstj
Copy link
Member Author

ericstj commented Apr 2, 2021

Looks like I didn't quite get the test condition right. I'll try another go at excluding browser. The CoreCLR failures are #50520.

@ericstj ericstj merged commit 75206ed into dotnet:main Apr 2, 2021

<ItemGroup>
<Content Include="runtime.json" PackagePath="/" />
<Content Include="_._" PackagePath="lib/netstandard1.0" />
Copy link
Member

Choose a reason for hiding this comment

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

Why not move that "." file into a common location to be used by multiple packages?

Copy link
Member Author

Choose a reason for hiding this comment

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

I considered that, but it is a zero byte file so net impact to the repo of sharing is zero (or might even be more depending on the length of the property name). If we find a lot of these floating around we could de-dup them to remove clutter, but I felt this was better.

<ItemGroup>
<ProjectReference Include="..\src\Microsoft.NETCore.Platforms.csproj" />
<!-- Workaround NuGet promoting this to a ProjectReference -->
<PackageReference Include="System.Memory" Condition="'$(TargetFramework)' == 'net472'" Version="$(SystemMemoryVersion)" />
Copy link
Member

Choose a reason for hiding this comment

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

Can you please elaborate? Why does NuGet add a P2P for System.Memory?

Copy link
Member Author

Choose a reason for hiding this comment

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

NuGet tried to restore System.Memory.csproj for net472 without this and restore failed. I believe it's because it's in the closure for the project added by the test targets. I think it's the same issue as NuGet/Home#9354.

<TargetFrameworks>$(NetCoreAppToolCurrent);net472</TargetFrameworks>
<PackageId>$(MSBuildProjectName)</PackageId>
<AvoidRestoreCycleOnSelfReference>true</AvoidRestoreCycleOnSelfReference>
<AssemblyName>Microsoft.NETCore.Platforms.BuildTasks</AssemblyName>
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need a different AssemblyName?

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't need a different name, I wanted one. I didn't want an assembly floating around with the name Microsoft.NETCore.Platforms.

Copy link
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.

Great work, thanks Eric.

@ghost ghost locked as resolved and limited conversation to collaborators May 6, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants