-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6924 from dsplaisted/stop-selfcontained-flow
Don't flow self contained command-line option to referenced projects
- Loading branch information
Showing
8 changed files
with
122 additions
and
20 deletions.
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
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
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 |
---|---|---|
@@ -1,2 +1,9 @@ | ||
Microsoft.Build.Tasks.SetRidAgnosticValueForProjects | ||
Microsoft.Build.Tasks.SetRidAgnosticValueForProjects.Projects.get -> Microsoft.Build.Framework.ITaskItem[] | ||
Microsoft.Build.Tasks.SetRidAgnosticValueForProjects.Projects.set -> void | ||
Microsoft.Build.Tasks.SetRidAgnosticValueForProjects.SetRidAgnosticValueForProjects() -> void | ||
Microsoft.Build.Tasks.SetRidAgnosticValueForProjects.UpdatedProjects.get -> Microsoft.Build.Framework.ITaskItem[] | ||
Microsoft.Build.Tasks.SetRidAgnosticValueForProjects.UpdatedProjects.set -> void | ||
override Microsoft.Build.Tasks.SetRidAgnosticValueForProjects.Execute() -> bool | ||
Microsoft.Build.Tasks.XslTransformation.PreserveWhitespace.get -> bool | ||
Microsoft.Build.Tasks.XslTransformation.PreserveWhitespace.set -> void | ||
Microsoft.Build.Tasks.XslTransformation.PreserveWhitespace.set -> void |
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 |
---|---|---|
@@ -1,2 +1,9 @@ | ||
Microsoft.Build.Tasks.SetRidAgnosticValueForProjects | ||
Microsoft.Build.Tasks.SetRidAgnosticValueForProjects.Projects.get -> Microsoft.Build.Framework.ITaskItem[] | ||
Microsoft.Build.Tasks.SetRidAgnosticValueForProjects.Projects.set -> void | ||
Microsoft.Build.Tasks.SetRidAgnosticValueForProjects.SetRidAgnosticValueForProjects() -> void | ||
Microsoft.Build.Tasks.SetRidAgnosticValueForProjects.UpdatedProjects.get -> Microsoft.Build.Framework.ITaskItem[] | ||
Microsoft.Build.Tasks.SetRidAgnosticValueForProjects.UpdatedProjects.set -> void | ||
Microsoft.Build.Tasks.XslTransformation.PreserveWhitespace.get -> bool | ||
Microsoft.Build.Tasks.XslTransformation.PreserveWhitespace.set -> void | ||
Microsoft.Build.Tasks.XslTransformation.PreserveWhitespace.set -> void | ||
override Microsoft.Build.Tasks.SetRidAgnosticValueForProjects.Execute() -> bool |
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Shared; | ||
using Microsoft.Build.Utilities; | ||
|
||
namespace Microsoft.Build.Tasks | ||
{ | ||
public sealed class SetRidAgnosticValueForProjects : TaskExtension | ||
{ | ||
public ITaskItem[] Projects { get; set; } = Array.Empty<ITaskItem>(); | ||
|
||
[Output] | ||
public ITaskItem[] UpdatedProjects { get; set; } = Array.Empty<ITaskItem>(); | ||
|
||
public override bool Execute() | ||
{ | ||
UpdatedProjects = Projects | ||
.Select(p => | ||
{ | ||
var hasSingleTargetFrameworkString = p.GetMetadata("HasSingleTargetFramework"); | ||
if (!ConversionUtilities.ValidBooleanFalse(hasSingleTargetFrameworkString)) | ||
{ | ||
// No change to item, it should already have a single-valued IsRidAgnostic value | ||
return p; | ||
} | ||
var updatedItem = new TaskItem(p); | ||
var nearestTargetFramework = p.GetMetadata("NearestTargetFramework"); | ||
if (string.IsNullOrEmpty(nearestTargetFramework)) | ||
{ | ||
return p; | ||
} | ||
var targetFrameworksArray = p.GetMetadata("TargetFrameworks").Split(';'); | ||
int targetFrameworkIndex = Array.IndexOf(targetFrameworksArray, nearestTargetFramework); | ||
if (targetFrameworkIndex < 0) | ||
{ | ||
return p; | ||
} | ||
var isRidAgnosticArray = p.GetMetadata("IsRidAgnostic").Split(';'); | ||
if (isRidAgnosticArray.Length != targetFrameworksArray.Length) | ||
{ | ||
return p; | ||
} | ||
updatedItem.SetMetadata("IsRidAgnostic", isRidAgnosticArray[targetFrameworkIndex]); | ||
return updatedItem; | ||
}) | ||
.ToArray(); | ||
|
||
return true; | ||
} | ||
} | ||
} |