-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Make Workspaces.MSBuild build with a netstandard target #76832
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
Open
JoeRobich
wants to merge
11
commits into
main
Choose a base branch
from
dev/jorobich/netstandard-msbuildworkspace
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
098b075
Unify our fallback logic
jasonmalinowski c75ce18
Unify our solution reading code
jasonmalinowski d139c24
Make Workspaces.MSBuild build with a netstandard target
jasonmalinowski 8da1dd7
Fix indentation
JoeRobich bbf6de4
Fix Roslyn.sln
JoeRobich 68957e0
Fix Workspace test
JoeRobich ed80bdf
Merge remote-tracking branch 'origin/main' into dev/jorobich/netstand…
JoeRobich 2444387
Merge remote-tracking branch 'origin/main' into dev/jorobich/netstand…
JoeRobich 69fece8
Review feedback
JoeRobich a223395
Check ownership of the buildhost pipe client connection
JoeRobich fafecf1
Add client side checking of the buildhost named pipe ownership
JoeRobich 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,64 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|
|
||
| using System; | ||
| using System.Collections.Immutable; | ||
| using System.IO; | ||
| using System.Text.Json; | ||
| using Roslyn.Utilities; | ||
|
|
||
| namespace Microsoft.CodeAnalysis.MSBuild; | ||
|
|
||
| internal static class SolutionFilterReader | ||
| { | ||
| public static bool IsSolutionFilterFilename(string filename) | ||
| { | ||
| return Path.GetExtension(filename).Equals(".slnf", StringComparison.OrdinalIgnoreCase); | ||
| } | ||
|
|
||
| private static string GetAbsolutePath(string path, string baseDirectory) | ||
| => FileUtilities.NormalizeAbsolutePath(FileUtilities.ResolveRelativePath(path, baseDirectory) ?? path); | ||
|
|
||
| public static (string solutionFileName, ImmutableHashSet<string> projects) Read(string filterFilename) | ||
| { | ||
| using var document = JsonDocument.Parse(File.ReadAllText(filterFilename)); | ||
| var solution = document.RootElement.GetProperty("solution"); | ||
| // Convert directory separators to the platform's default, since that is what MSBuild provide us. | ||
| var solutionPath = solution.GetProperty("path").GetString()?.Replace('\\', Path.DirectorySeparatorChar); | ||
| if (solutionPath is null) | ||
| throw new Exception("No solution path found in the solution filter file."); | ||
|
|
||
| if (Path.GetDirectoryName(filterFilename) is not string baseDirectory) | ||
| throw new Exception("No directory could be found containing the solution filter."); | ||
|
|
||
| var solutionFilename = GetAbsolutePath(solutionPath, baseDirectory); | ||
|
|
||
| if (!File.Exists(solutionFilename)) | ||
| throw new Exception($"The solution file '{solutionFilename}' does not exist."); | ||
|
|
||
| // The base directory for projects is the solution folder. | ||
| baseDirectory = Path.GetDirectoryName(solutionFilename)!; | ||
| RoslynDebug.AssertNotNull(baseDirectory); | ||
|
|
||
| var filterProjects = ImmutableHashSet.CreateBuilder<string>(StringComparer.OrdinalIgnoreCase); | ||
| foreach (var project in solution.GetProperty("projects").EnumerateArray()) | ||
| { | ||
| // Convert directory separators to the platform's default, since that is what MSBuild provide us. | ||
| var projectPath = project.GetString()?.Replace('\\', Path.DirectorySeparatorChar); | ||
| if (projectPath is null) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
| // Fill the filter with the absolute project paths. | ||
| var absoluteProjectPath = GetAbsolutePath(projectPath, baseDirectory); | ||
| if (File.Exists(absoluteProjectPath)) | ||
| { | ||
| filterProjects.Add(absoluteProjectPath); | ||
| } | ||
| } | ||
|
|
||
| return (solutionFilename, filterProjects.ToImmutable()); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.