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

Apply source-build patches #4404

Merged
merged 14 commits into from
Mar 15, 2022
Merged

Apply source-build patches #4404

merged 14 commits into from
Mar 15, 2022

Conversation

crummel
Copy link
Contributor

@crummel crummel commented Jan 13, 2022

Bug

Fixes: dotnet/source-build#2708

Regression? No

Description

This PR moves the source-build patches from 6.0 back to NuGet. The patches are:

  • Re-enabling full-framework builds in source-built NuGet. Source-build now has better support for full-fx and this allows other repos to depend on NuGet's full-fx build.
  • Upgrade CommandLineUtils to CommandLineUtils.Sources. This aligns with getting all repos off the ancient CommandLineUtils version and should not be a functional change.
  • Update #ifdefs to include .NET 6 as well as .NET 5 since source-build 6.0 must build with the 6.0 SDK.

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
    • OR
      There should be no changed behavior in these patches in the NuGet repo. I will test this in the source-build build specifically.
    • Test exception
    • OR
    • N/A
  • Documentation

    • Documentation PR or issue filled
    • OR
    • N/A

@ghost ghost added the Community PRs created by someone not in the NuGet team label Jan 13, 2022
@crummel crummel marked this pull request as ready for review January 24, 2022 19:47
@crummel crummel requested a review from a team as a code owner January 24, 2022 19:47
Copy link
Member

@nkolev92 nkolev92 left a comment

Choose a reason for hiding this comment

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

Is the SDK going to run under net6.0?

I thought the plan was net5.0, then net7.0 and skipping net6.0.

build/packages.targets Outdated Show resolved Hide resolved
@crummel
Copy link
Contributor Author

crummel commented Feb 1, 2022

Unfortunately we won't be able to skip net6 because Microsoft.Build 17.0.0 only supports net472 and net6. I logged dotnet/source-build#2745 to track these TFM changes and back them out once we can move to net7.

Comment on lines 24 to 26
<ItemGroup Condition=" '$(TargetFramework)' == '$(NETFXTargetFramework)' or '$(TargetFramework)' == 'net45' or '$(TargetFramework)' == 'netstandard2.0' ">
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="mscorlib" />
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't the .NET SDK automatically add these BCL assembly references for .NET Standard projects? My gut feeling is that adding the netstandard2.0 condition to the item group should be unnecessary.

build/common.project.props Show resolved Hide resolved
Comment on lines +27 to 29
<ItemGroup Condition=" '$(TargetFramework)' == '$(NETFXTargetFramework)' or '$(TargetFramework)' == 'net45' or '$(TargetFramework)' == 'netstandard2.0' ">
<Reference Include="System.Security" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
Copy link
Member

Choose a reason for hiding this comment

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

Same as previous comment, doesn't the .NET SDK add these BCL references automatically for .NET Standard?

Copy link
Member

Choose a reason for hiding this comment

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

The netstandard condition was removed from NuGet.Common.csproj, but not here.

Comment on lines 8 to 10
<TargetFrameworks>$(TargetFrameworksLibrary)</TargetFrameworks>
<TargetFrameworks Condition="'$(IsBuildOnlyXPLATProjects)' != 'true'">$(TargetFrameworks);net45</TargetFrameworks>
<TargetFrameworks Condition="'$(IsBuildOnlyXPLATProjects)' == 'true'">$(TargetFrameworks);netstandard2.0</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

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

if my suggestion in common.project.props can't be taken, given that the last two of these are opposites of each other, can we get rid of the first, non-conditioned, declaration, so MSBuild doesn't have to overwrite or re-evaulate the same property multiple times in all scenarios? I'm not enough of an MSBuild expert to know whether or not it has an actual performance benefit, but maybe it's clearer to readers to me because I will need to do less mental arithmetic to figure out which set declarations contribute to the final value.

@@ -6,6 +6,7 @@
<Description>Common utilities and interfaces for all NuGet libraries.</Description>
<TargetFrameworks>$(TargetFrameworksLibrary)</TargetFrameworks>
<TargetFrameworks Condition="'$(IsBuildOnlyXPLATProjects)' != 'true'">$(TargetFrameworks);net45</TargetFrameworks>
<TargetFrameworks Condition="'$(IsBuildOnlyXPLATProjects)' == 'true'">$(TargetFrameworks);netstandard2.0</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

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

off topic for this PR, but given that common.project.props defines <IsBuildOnlyXPLATProjects>$(DotNetBuildFromSource)</IsBuildOnlyXPLATProjects>, should we use DotNetBuildFromSource instead?

I'm the team's CI "expert", but it's not clear to me what is source-build specific, and what we do in our own CI differently on Windows vs Mac/Linux. I think if we removed IsBuildOnlyXPLATProjects and used DotNetBuildFromSource instead throughout our build scripts, it would be much easier to understand what is what.

@dominoFire
Copy link
Contributor

@crummel You might need to rebase your branch. CI build 6.1.0.757 has an outdated build number. Current build numbers starts with 6.2.

@crummel crummel force-pushed the sourceBuildPatches branch from 3edc826 to d8e5521 Compare February 2, 2022 20:08
zivkan
zivkan previously approved these changes Feb 2, 2022
@zivkan
Copy link
Member

zivkan commented Feb 2, 2022

The CI build is failing because Microsoft.Extensions.CommandLineUtis.Source can't be found.

We recently opt our repo into package source mapping do we need to add a new mapping? Where is this package supposed to come from?

Copy link
Member

@nkolev92 nkolev92 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

The 1 or 2 changes that need addressed @zivkan can help with.

Don't block on me for merging.

@dominoFire
Copy link
Contributor

@crummel 🔔

Do you need help?

@crummel
Copy link
Contributor Author

crummel commented Feb 15, 2022

That would be great. Sorry, I've been working on this on and off but having some problems. Currently what I'm looking at is the
/home/chris/nuget-tarball-2/.dotnet/sdk/6.0.101/NuGet.targets(130,5): error : Invalid framework identifier ''. [/home/chris/nuget-tarball-2/src/nuget-client.d8e55212488236cb12610e6557f523d92cfa5d15/build/restorehelper.targets] error. This seems like the TargetFrameworks property is not being set correctly somewhere but it's hard to debug in the binlog because the restorehelper doesn't say which project specifically it's failing on. Any ideas?

@nkolev92
Copy link
Member

@crummel

It's hard to debug, but basically it's NuGet.Frameworks

image

There's probably something empty in there.

@crummel crummel force-pushed the sourceBuildPatches branch from 09639d8 to e45613c Compare March 12, 2022 20:56
@crummel
Copy link
Contributor Author

crummel commented Mar 14, 2022

@nkolev92 @zivkan @dominoFire This passed an internal build (https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=5876410&view=results) as well as a local build in the source-build overall. Let me know if there's any more changes to make. Thanks for your help and sorry I kept getting interrupted and dragged this out so long!

@crummel
Copy link
Contributor Author

crummel commented Mar 15, 2022

I don't have merge permissions so whenever you are happy with this it's good to go. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PRs created by someone not in the NuGet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[main] Backport source-build patches to repos.
4 participants