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

Flow NuGetPackageRoot out of Tools.proj restore #14879

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tmat
Copy link
Member

@tmat tmat commented Jun 20, 2024

No description provided.

sharwell
sharwell previously approved these changes Jun 21, 2024
@mmitche
Copy link
Member

mmitche commented Jun 21, 2024

I think this is okay, but I think it would be good to verify source builds. Can you push a branch to the AzDO dotnet-dotnet repo with those changes to arcade (src\arcade) and run https://dev.azure.com/dnceng/internal/_build?definitionId=1219 (internal link).

/cc @ViktorHofer @dotnet/source-build-internal

<ItemGroup Condition="'$(Restore)' == 'true'">
<_RestoreToolsProps Include="@(_CommonProps)"/>
<_RestoreToolsProps Include="BaseIntermediateOutputPath=$(ArtifactsToolsetDir)Common"/>
<_RestoreToolsProps Include="ExcludeRestorePackageImports=true"/>
Copy link
Member

Choose a reason for hiding this comment

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

📝 Setting this property forces Tools.proj.nuget.g.props to not be included. This is fine on the restore path, but we need to avoid it when invoking the ReturnNuGetPackageRoot target.

@@ -1,13 +1,13 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<Project Sdk="Microsoft.Build.Traversal">
Copy link
Member

Choose a reason for hiding this comment

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

📝 This is the easiest way to include Microsoft.Common.targets, which is how Tools.proj.nuget.g.props gets included during evaluation.


<Import Project="BuildStep.props" />

<!-- Properties requires by NuGet.targets to restore PackageReferences -->
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<!-- Workaround changes from newer MSBuild requiring additional properties -->
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">5</TargetFrameworkVersion>
Copy link
Member

Choose a reason for hiding this comment

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

📝 This value was simply wrong, and after updating to use Microsoft.Build.Traversal it was resulting in build errors.

@tmat
Copy link
Member Author

tmat commented Jun 24, 2024

lgtm

@@ -1,13 +1,13 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<Project Sdk="Microsoft.Build.Traversal">
Copy link
Member

Choose a reason for hiding this comment

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

Where is the version for this msbuild sdk stored?

Copy link
Member

Choose a reason for hiding this comment

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

I didn't add it anywhere so far. Do I need to?

Copy link
Member

Choose a reason for hiding this comment

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

NuGet needs a version for any to be imported msbuild sdk. This change will break all consuming repositories that don't define a version in their global.json file.

Copy link
Member

Choose a reason for hiding this comment

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

➡️ Switched to Microsoft.Build.NoTargets, which has a version already defined in global.json

Copy link
Member

Choose a reason for hiding this comment

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

@sharwell I don't think that's the case for all consuming repositories, and there are 150+ branches/repos that consume arcade built from this branch. That will be a big lift to get everyone onboarded.

Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to do this as an opt-in, or provide a smooth transition?

Copy link
Member

Choose a reason for hiding this comment

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

➡️ This no longer references a separate SDK

@@ -1,13 +1,13 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<Project Sdk="Microsoft.Build.Traversal">
Copy link
Member

@ViktorHofer ViktorHofer Jun 25, 2024

Choose a reason for hiding this comment

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

The Traversal msbuild sdk should be used when a project needs to traverse the msbuild project graph. I don't see any ProjectReferences defined in this project so Microsoft.Build.NoTargets would be better.

Copy link
Member

Choose a reason for hiding this comment

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

In testing, Microsoft.Build.NoTargets seemed to work fine.

Copy link
Member

Choose a reason for hiding this comment

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

➡️ Now switched to Microsoft.Build.NoTargets

Copy link
Member

Choose a reason for hiding this comment

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

➡️ Now switched to a local definition

@mmitche
Copy link
Member

mmitche commented Jun 27, 2024

@sharwell @tmat Can you add a description for why this change is necessary? What is the root purpose?

Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment to this and the other two files at the beginning of the file and link to the origin.

Copy link
Member

Choose a reason for hiding this comment

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

➡️ Now updated

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.

One more comment, otherwise LGTM

@sharwell
Copy link
Member

@mmitche This pull request is a prerequisite to using #14883 to fix #14761.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants