-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Double Evaluation Fix #2595
Merged
Merged
Double Evaluation Fix #2595
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ba8fca1
Get properties for ProjectReference in parallel
rainersigwald ff79ea2
Backward compat for GetTargetFrameworkProperties
rainersigwald 8729689
Clarify existing ProjectReference protocol returns
rainersigwald 984f381
Document new GetTargetFrameworkProperties return
rainersigwald c36bfb3
Documentation for protocol change
rainersigwald bb44739
Identify inner-build in consuming project
rainersigwald f066173
Move logic out of NuGet
AndyGerlicher caf92b2
Update comments
AndyGerlicher 62094fd
Fix issue when consuming project TFM is null.
AndyGerlicher 21b9a95
Update NuGet.Build.Tasks
AndyGerlicher 15afc90
Add NuGet ImportAfter targets to bootstrapped build
AndyGerlicher 00e2059
Comment cleanup
AndyGerlicher e3ee36f
Preserve project references that opt-out
AndyGerlicher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1512,7 +1512,18 @@ Copyright (C) Microsoft Corporation. All rights reserved. | |
|
||
</Target> | ||
|
||
<Target Name="_ComputeProjectReferenceTargetFrameworkMatches" BeforeTargets="_GetProjectReferenceTargetFrameworkProperties"> | ||
<Target Name="_GetProjectReferenceTargetFrameworkProperties"> | ||
<!-- | ||
Select the moniker to send to each project reference if not already set. NugetTargetMoniker (NTM) is preferred by default over | ||
TargetFrameworkMoniker (TFM) because it is required to disambiguate the UWP case where TFM is fixed at .NETCore,Version=v5.0 and | ||
has floating NTM=UAP,Version=vX.Y.Z. However, in other cases (classic PCLs), NTM contains multiple values and that will cause the MSBuild | ||
invocation below to fail by passing invalid properties. Therefore we do not use the NTM if it contains a semicolon. | ||
--> | ||
<PropertyGroup Condition="'$(ReferringTargetFrameworkForProjectReferences)' == ''"> | ||
<ReferringTargetFrameworkForProjectReferences Condition="'$(NugetTargetMoniker)' != '' and !$(NuGetTargetMoniker.Contains(';'))">$(NugetTargetMoniker)</ReferringTargetFrameworkForProjectReferences> | ||
<ReferringTargetFrameworkForProjectReferences Condition="'$(NugetTargetMoniker)' == ''">$(TargetFrameworkMoniker)</ReferringTargetFrameworkForProjectReferences> | ||
</PropertyGroup> | ||
|
||
<!-- | ||
Honor SkipGetTargetFrameworkProperties=true metadata on project references | ||
to mean that the project reference is known not to target multiple frameworks | ||
|
@@ -1558,12 +1569,24 @@ Copyright (C) Microsoft Corporation. All rights reserved. | |
</MSBuild> | ||
|
||
<!-- For each reference, get closest match --> | ||
<AssignReferencePropertiesTask AnnotatedProjectReferences="@(_ProjectReferenceTargetFrameworkPossibilities)" | ||
CurrentProjectTargetFramework="$(TargetFrameworkMoniker)" | ||
Condition="'@(_ProjectReferenceTargetFrameworkPossibilities->Count())' != '0'"> | ||
<GetReferenceNearestTargetFrameworkTask AnnotatedProjectReferences="@(_ProjectReferenceTargetFrameworkPossibilities)" | ||
CurrentProjectTargetFramework="$(ReferringTargetFrameworkForProjectReferences)" | ||
CurrentProjectName="MSBuildProjectName" | ||
Condition="'@(_ProjectReferenceTargetFrameworkPossibilities->Count())' != '0'"> | ||
<Output ItemName="AnnotatedProjects" TaskParameter="AssignedProjects" /> | ||
</AssignReferencePropertiesTask> | ||
</GetReferenceNearestTargetFrameworkTask> | ||
|
||
<ItemGroup> | ||
<AnnotatedProjects Condition="'@(AnnotatedProjects)' == '%(Identity)' and '%(AnnotatedProjects.NearestTargetFramework)' != '' and '%(AnnotatedProjects.HasSingleTargetFramework)' != 'true'"> | ||
<SetTargetFramework>TargetFramework=%(AnnotatedProjects.NearestTargetFramework)</SetTargetFramework> | ||
</AnnotatedProjects> | ||
<AnnotatedProjects Condition="'@(AnnotatedProjects)' == '%(Identity)' and '%(AnnotatedProjects.NearestTargetFramework)' == '' or '%(AnnotatedProjects.HasSingleTargetFramework)' == 'true'"> | ||
<UndefineProperties>%(AnnotatedProjects.UndefineProperties);TargetFramework</UndefineProperties> | ||
</AnnotatedProjects> | ||
<AnnotatedProjects Condition="'@(AnnotatedProjects)' == '%(Identity)' and '%(AnnotatedProjects.IsRidAgnostic)' == 'true'"> | ||
<UndefineProperties>%(AnnotatedProjects.UndefineProperties);RuntimeIdentifier</UndefineProperties> | ||
</AnnotatedProjects> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<_MSBuildProjectReferenceExistent Remove="@(_MSBuildProjectReferenceExistent)" /> | ||
<_MSBuildProjectReferenceExistent Include="@(AnnotatedProjects)" /> | ||
|
@@ -1580,7 +1603,9 @@ Copyright (C) Microsoft Corporation. All rights reserved. | |
<TargetFrameworks Condition="'$(TargetFrameworks)' == ''">$(TargetFramework)</TargetFrameworks> | ||
<HasSingleTargetFramework>true</HasSingleTargetFramework> | ||
<HasSingleTargetFramework Condition="'$(IsCrossTargetingBuild)' == 'true'">false</HasSingleTargetFramework> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is always going to be false when we land in the non-cross-targeting version of GetTargetFrameworks. |
||
<IsRidAgnostic>true</IsRidAgnostic> | ||
<!-- indicate to caller that project is RID agnostic so that a global property RuntimeIdentifier value can be removed --> | ||
<IsRidAgnostic>false</IsRidAgnostic> | ||
<IsRidAgnostic Condition=" '$(RuntimeIdentifier)' == '' and '$(RuntimeIdentifiers)' == '' ">true</IsRidAgnostic> | ||
</_ThisProjectBuildMetadata> | ||
</ItemGroup> | ||
</Target> | ||
|
@@ -1598,68 +1623,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. | |
|
||
====================================================================================== | ||
--> | ||
<Target Name="_GetProjectReferenceTargetFrameworkProperties"> | ||
<!-- | ||
Select the moniker to send to each project reference if not already set. NugetTargetMoniker (NTM) is preferred by default over | ||
TargetFrameworkMoniker (TFM) because it is required to disambiguate the UWP case where TFM is fixed at .NETCore,Version=v5.0 and | ||
has floating NTM=UAP,Version=vX.Y.Z. However, in other cases (classic PCLs), NTM contains multiple values and that will cause the MSBuild | ||
invocation below to fail by passing invalid properties. Therefore we do not use the NTM if it contains a semicolon. | ||
--> | ||
<PropertyGroup Condition="'$(ReferringTargetFrameworkForProjectReferences)' == ''"> | ||
<ReferringTargetFrameworkForProjectReferences Condition="'$(NugetTargetMoniker)' != '' and !$(NuGetTargetMoniker.Contains(';'))">$(NugetTargetMoniker)</ReferringTargetFrameworkForProjectReferences> | ||
<ReferringTargetFrameworkForProjectReferences Condition="'$(NugetTargetMoniker)' == ''">$(TargetFrameworkMoniker)</ReferringTargetFrameworkForProjectReferences> | ||
</PropertyGroup> | ||
|
||
<MSBuild | ||
Projects="@(_MSBuildProjectReferenceExistent)" | ||
Targets="GetTargetFrameworkProperties" | ||
BuildInParallel="$(BuildInParallel)" | ||
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration); %(_MSBuildProjectReferenceExistent.SetPlatform); ReferringTargetFramework=$(ReferringTargetFrameworkForProjectReferences)" | ||
ContinueOnError="!$(BuildingProject)" | ||
RemoveProperties="%(_MSBuildProjectReferenceExistent.GlobalPropertiesToRemove);TargetFramework;RuntimeIdentifier" | ||
Condition="'%(_MSBuildProjectReferenceExistent.SkipGetTargetFrameworkProperties)' != 'true'"> | ||
|
||
<Output TaskParameter="TargetOutputs" ItemName="_ProjectReferenceTargetFrameworkProperties" /> | ||
</MSBuild> | ||
|
||
<ItemGroup> | ||
<!-- Backward compat: extract metadata for properties to set from a semicolon-delimited return value --> | ||
<_ProjectReferenceTargetFrameworkProperties | ||
Condition="'@(_ProjectReferenceTargetFrameworkProperties->Count())' > '1' and '%(_ProjectReferenceTargetFrameworkProperties.OriginalItemSpec)' != ''"> | ||
<DelimitedStringReturn>@(_ProjectReferenceTargetFrameworkProperties)</DelimitedStringReturn> | ||
</_ProjectReferenceTargetFrameworkProperties> | ||
<_ProjectReferenceTargetFrameworkProperties | ||
Include="%(_ProjectReferenceTargetFrameworkProperties.OriginalItemSpec)" | ||
Condition="'%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)' != ''"> | ||
<OriginalItemSpec>%(_ProjectReferenceTargetFrameworkProperties.OriginalItemSpec)</OriginalItemSpec> | ||
<DesiredTargetFrameworkProperties>$([System.String]::Copy('%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)').Replace('ProjectHasSingleTargetFramework=true','').Replace('ProjectHasSingleTargetFramework=false','').Replace('ProjectIsRidAgnostic=true','').TrimEnd(';'))</DesiredTargetFrameworkProperties> | ||
<HasSingleTargetFramework>$([System.String]::Copy('%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)').Contains('ProjectHasSingleTargetFramework=true'))</HasSingleTargetFramework> | ||
<IsRidAgnostic>$([System.String]::Copy('%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)').Contains('ProjectIsRidAgnostic=true'))</IsRidAgnostic> | ||
</_ProjectReferenceTargetFrameworkProperties> | ||
<_ProjectReferenceTargetFrameworkProperties | ||
Remove="@(_ProjectReferenceTargetFrameworkProperties)" | ||
Condition="'%(_ProjectReferenceTargetFrameworkProperties.DelimitedStringReturn)' != ''" /> | ||
|
||
<!-- Build an item that has Identity matching _MSBuildProjectReferenceExistent and metadata for properties to set. --> | ||
<_ProjectReferencesWithTargetFrameworkProperties | ||
Include="@(_ProjectReferenceTargetFrameworkProperties->'%(OriginalItemSpec)')" /> | ||
|
||
<!-- Set the project's returned TargetFramework --> | ||
<_MSBuildProjectReferenceExistent Condition="'@(_ProjectReferencesWithTargetFrameworkProperties)' == '%(Identity)' and '@(_ProjectReferencesWithTargetFrameworkProperties->'%(HasSingleTargetFramework)')' != 'true'"> | ||
<SetTargetFramework>@(_ProjectReferencesWithTargetFrameworkProperties->'%(DesiredTargetFrameworkProperties)')</SetTargetFramework> | ||
</_MSBuildProjectReferenceExistent> | ||
|
||
<!-- If the project has only one TF, don't specify it. It will go directly to the inner build anyway and we don't want to redundantly specify a global property, which can cause a race. --> | ||
<_MSBuildProjectReferenceExistent Condition="'@(_ProjectReferencesWithTargetFrameworkProperties)' == '%(Identity)' and '@(_ProjectReferencesWithTargetFrameworkProperties->'%(HasSingleTargetFramework)')' == 'true'"> | ||
<UndefineProperties>@(_MSBuildProjectReferenceExistent->'%(UndefineProperties)');TargetFramework</UndefineProperties> | ||
</_MSBuildProjectReferenceExistent> | ||
|
||
<!-- If the project has only one RID, assume it's compatible with the current project and don't pass this one along. --> | ||
<_MSBuildProjectReferenceExistent Condition="'@(_ProjectReferencesWithTargetFrameworkProperties)' == '%(Identity)' and '@(_ProjectReferencesWithTargetFrameworkProperties->'%(IsRidAgnostic)')' == 'true'"> | ||
<UndefineProperties>@(_MSBuildProjectReferenceExistent->'%(UndefineProperties)');RuntimeIdentifier</UndefineProperties> | ||
</_MSBuildProjectReferenceExistent> | ||
</ItemGroup> | ||
</Target> | ||
|
||
|
||
<!-- | ||
============================================================ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$(MSBuildProjectName) ?