-
Notifications
You must be signed in to change notification settings - Fork 39
Spectre.Console repo fixes #248
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b750fa8
Infra to rewrite global.json
mthalman 31e1528
Rewrite global.json for spectre.console
mthalman 462ecd6
Remove TargetFrameworks property as it doesn't impact anything
mthalman b466996
Patch to remove Mandelbrot example
mthalman f303912
Revert "Remove TargetFrameworks property as it doesn't impact anything"
mthalman e22d3d8
Revert "Patch to remove Mandelbrot example"
mthalman 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props, $(MSBuildThisFileDirectory)..))" /> | ||
|
||
<PropertyGroup> | ||
<!-- Build all tasks as AnyCPU to match NuGet DLLs in the SDK: avoid warnings. --> | ||
<Platform>AnyCPU</Platform> | ||
<!-- | ||
Do not import the Arcade SDK for the local tooling projects. This lets us | ||
build them with just the .NET SDK, simplifying the build. | ||
--> | ||
<SkipArcadeSdkImport>true</SkipArcadeSdkImport> | ||
</PropertyGroup> | ||
|
||
<!-- | ||
Use some assemblies from the SDK, instead of package references. This ensures they match what's | ||
found when the task is loaded by the SDK's MSBuild. | ||
--> | ||
<ItemGroup> | ||
<SdkAssembly Include="$(SdkReferenceDir)Newtonsoft.Json.dll" /> | ||
|
||
<SdkAssemblyReference | ||
Include="@(SdkAssembly -> '%(FileName)')" | ||
HintPath="$(SdkReferenceDir)%(Identity).dll" /> | ||
</ItemGroup> | ||
|
||
</Project> |
27 changes: 27 additions & 0 deletions
27
.../Microsoft.DotNet.SourceBuild.Tasks.XPlat/Microsoft.DotNet.SourceBuild.Tasks.XPlat.csproj
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,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<OutputPath>$(XPlatTasksBinDir)</OutputPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Build"> | ||
<Version>15.7.179</Version> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.Build.Framework"> | ||
<Version>15.7.179</Version> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.Build.Tasks.Core"> | ||
<Version>15.7.179</Version> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.Build.Utilities.Core"> | ||
<Version>15.7.179</Version> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="@(SdkAssemblyReference)" /> | ||
</ItemGroup> | ||
|
||
</Project> |
69 changes: 69 additions & 0 deletions
69
eng/tasks/Microsoft.DotNet.SourceBuild.Tasks.XPlat/UpdateJson.cs
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,69 @@ | ||
// 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.IO; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
|
||
namespace Microsoft.DotNet.Build.Tasks | ||
{ | ||
// Takes a path to a path to a json file and a | ||
// string that represents a dotted path to an attribute | ||
// and updates that attribute with the new value provided. | ||
public class UpdateJson : Task | ||
{ | ||
[Required] | ||
public string JsonFilePath { get; set; } | ||
|
||
[Required] | ||
public string PathToAttribute { get; set; } | ||
|
||
[Required] | ||
public string NewAttributeValue { get; set; } | ||
|
||
public bool SkipUpdateIfMissingKey { get; set; } | ||
|
||
public override bool Execute() | ||
{ | ||
JObject jsonObj = JObject.Parse(File.ReadAllText(JsonFilePath)); | ||
|
||
string[] escapedPathToAttributeParts = PathToAttribute.Replace("\\.", "\x1F").Split('.'); | ||
for (int i = 0; i < escapedPathToAttributeParts.Length; ++i) | ||
{ | ||
escapedPathToAttributeParts[i] = escapedPathToAttributeParts[i].Replace("\x1F", "."); | ||
} | ||
UpdateAttribute(jsonObj, escapedPathToAttributeParts, NewAttributeValue); | ||
|
||
File.WriteAllText(JsonFilePath, jsonObj.ToString()); | ||
return true; | ||
} | ||
|
||
private void UpdateAttribute(JToken jsonObj, string[] path, string newValue) | ||
{ | ||
string pathItem = path[0]; | ||
if (jsonObj[pathItem] == null) | ||
{ | ||
string message = $"Path item [{nameof(PathToAttribute)}] not found in json file."; | ||
if (SkipUpdateIfMissingKey) | ||
{ | ||
Log.LogMessage(MessageImportance.Low, $"Skipping update: {message} {pathItem}"); | ||
return; | ||
} | ||
throw new ArgumentException(message, pathItem); | ||
} | ||
|
||
if (path.Length == 1) | ||
{ | ||
jsonObj[pathItem] = newValue; | ||
return; | ||
} | ||
|
||
UpdateAttribute(jsonObj[pathItem], path.Skip(1).ToArray(), newValue); | ||
} | ||
} | ||
} |
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
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.
Would it make sense to encapsulate this version in versions.props? It would make updating easier and follow the arcade patterns.
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.
I'll log a separate issue for that since it should be done for all the other relevant external repos as well.
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.
dotnet/source-build#3897