From 6375faba9185f3c7a2d01eb07ba2b7082721db53 Mon Sep 17 00:00:00 2001 From: Bela VanderVoort Date: Sun, 17 Nov 2024 19:46:12 -0600 Subject: [PATCH 1/5] revert tool command, this was supposed to be in 1.0.0 only (#1383) closes #1382 --- Src/CSharpier.Cli/CSharpier.Cli.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/Src/CSharpier.Cli/CSharpier.Cli.csproj b/Src/CSharpier.Cli/CSharpier.Cli.csproj index 7ea0b76be..8fffade6d 100644 --- a/Src/CSharpier.Cli/CSharpier.Cli.csproj +++ b/Src/CSharpier.Cli/CSharpier.Cli.csproj @@ -6,7 +6,6 @@ dotnet-csharpier net8.0;net9.0 true - csharpier ../../Nuget/csharpier.snk Major True From fedc791cc22961a913669283ccd6518640499a64 Mon Sep 17 00:00:00 2001 From: Bela VanderVoort Date: Sun, 17 Nov 2024 19:49:47 -0600 Subject: [PATCH 2/5] Releasing 0.30.1 (#1384) --- CHANGELOG.md | 6 +++++- Nuget/Build.props | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 444f66829..7ef0f0c66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -# 0.30.0 +# 0.30.1 +## What's Changed +Revert tool command back to `dotnet-csharpier`, it was supposed to be changed to `csharpier` for 1.0.0 + +# 0.30.0 ## Breaking Changes The CSharpier dotnet tool no longer supports net6 & net7. ## What's Changed diff --git a/Nuget/Build.props b/Nuget/Build.props index 44e1798fb..c75d7165f 100644 --- a/Nuget/Build.props +++ b/Nuget/Build.props @@ -1,6 +1,6 @@ - 0.30.0 + 0.30.1 MIT https://github.com/belav/csharpier git From 4dd71fab419b24144ad2db85addc1156ea47c481 Mon Sep 17 00:00:00 2001 From: Bela VanderVoort Date: Mon, 18 Nov 2024 09:09:25 -0600 Subject: [PATCH 3/5] formatting with 0.30.1 (#1386) --- .config/dotnet-tools.json | 2 +- .../EditorConfig/ConfigFileParser.cs | 19 ++-- Src/CSharpier.Cli/EditorConfig/Globber.cs | 15 ++-- Src/CSharpier.FakeGenerators/Ignored.cs | 36 ++++---- Src/CSharpier.Tests/MissingTypeChecker.cs | 89 +++++++++---------- .../CSharpierOptions.cs | 6 +- Src/CSharpier/DocTypes/Doc.cs | 6 +- .../Formatters/CSharp/PreprocessorSymbols.cs | 6 +- 8 files changed, 90 insertions(+), 89 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index b439c8ade..a0f59deb2 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "csharpier": { - "version": "0.29.2", + "version": "0.30.1", "commands": [ "dotnet-csharpier" ] diff --git a/Src/CSharpier.Cli/EditorConfig/ConfigFileParser.cs b/Src/CSharpier.Cli/EditorConfig/ConfigFileParser.cs index 8f1a0cd4b..65066c9c4 100644 --- a/Src/CSharpier.Cli/EditorConfig/ConfigFileParser.cs +++ b/Src/CSharpier.Cli/EditorConfig/ConfigFileParser.cs @@ -12,16 +12,15 @@ internal static class ConfigFileParser // "Comment: starts with a ; or a #." private static readonly Regex CommentRegex = new("^[;#].*$"); - private static readonly IniParserConfiguration Configuration = - new() - { - CommentRegex = CommentRegex, - AllowDuplicateKeys = true, - AllowDuplicateSections = true, - OverrideDuplicateKeys = true, - SkipInvalidLines = true, - ThrowExceptionsOnError = false, - }; + private static readonly IniParserConfiguration Configuration = new() + { + CommentRegex = CommentRegex, + AllowDuplicateKeys = true, + AllowDuplicateSections = true, + OverrideDuplicateKeys = true, + SkipInvalidLines = true, + ThrowExceptionsOnError = false, + }; public static ConfigFile Parse(string filePath, IFileSystem fileSystem) { diff --git a/Src/CSharpier.Cli/EditorConfig/Globber.cs b/Src/CSharpier.Cli/EditorConfig/Globber.cs index 9d9a46a59..d8fe6709b 100644 --- a/Src/CSharpier.Cli/EditorConfig/Globber.cs +++ b/Src/CSharpier.Cli/EditorConfig/Globber.cs @@ -2,14 +2,13 @@ namespace CSharpier.Cli.EditorConfig; internal static class Globber { - private static readonly GlobMatcherOptions globOptions = - new() - { - MatchBase = true, - Dot = true, - AllowWindowsPaths = true, - AllowSingleBraceSets = true, - }; + private static readonly GlobMatcherOptions globOptions = new() + { + MatchBase = true, + Dot = true, + AllowWindowsPaths = true, + AllowSingleBraceSets = true, + }; public static GlobMatcher Create(string files, string directory) { diff --git a/Src/CSharpier.FakeGenerators/Ignored.cs b/Src/CSharpier.FakeGenerators/Ignored.cs index 64749e215..05b0c4051 100644 --- a/Src/CSharpier.FakeGenerators/Ignored.cs +++ b/Src/CSharpier.FakeGenerators/Ignored.cs @@ -23,24 +23,22 @@ public static class Ignored public static readonly Type[] Types = { typeof(TextSpan), typeof(SyntaxTree) }; - public static readonly Dictionary PropertiesByType = - new() - { - { typeof(PropertyDeclarationSyntax), new[] { "semicolon" } }, - { typeof(IndexerDeclarationSyntax), new[] { "semicolon" } }, - { typeof(SyntaxTrivia), new[] { "token" } }, - { typeof(SyntaxToken), new[] { "value", "valueText" } }, - { typeof(ParameterSyntax), new[] { "exclamationExclamationToken" } }, - }; + public static readonly Dictionary PropertiesByType = new() + { + { typeof(PropertyDeclarationSyntax), new[] { "semicolon" } }, + { typeof(IndexerDeclarationSyntax), new[] { "semicolon" } }, + { typeof(SyntaxTrivia), new[] { "token" } }, + { typeof(SyntaxToken), new[] { "value", "valueText" } }, + { typeof(ParameterSyntax), new[] { "exclamationExclamationToken" } }, + }; - public static readonly HashSet UnsupportedNodes = - new() - { - // if new versions of c# add node types, we need to ignore them in the generators - // until codeAnalysis + sdks are updated - // global.json doesn't seem to always be respected for builds (namely VS but rider started having the same problem) - // which causes the generators to generate code for the new node types - // but then the build fails because those types don't exist in the packages the actual project references - // "ListPatternSyntax", "SlicePatternSyntax" - }; + public static readonly HashSet UnsupportedNodes = new() + { + // if new versions of c# add node types, we need to ignore them in the generators + // until codeAnalysis + sdks are updated + // global.json doesn't seem to always be respected for builds (namely VS but rider started having the same problem) + // which causes the generators to generate code for the new node types + // but then the build fails because those types don't exist in the packages the actual project references + // "ListPatternSyntax", "SlicePatternSyntax" + }; } diff --git a/Src/CSharpier.Tests/MissingTypeChecker.cs b/Src/CSharpier.Tests/MissingTypeChecker.cs index 6f1f78495..77c211b30 100644 --- a/Src/CSharpier.Tests/MissingTypeChecker.cs +++ b/Src/CSharpier.Tests/MissingTypeChecker.cs @@ -70,49 +70,48 @@ public void Ensure_There_Are_No_Missing_Types() missingTypes.Should().BeEmpty(); } - private readonly HashSet ignored = - new() - { - "AccessorDeclarationSyntax", - "AccessorListSyntax", - "AttributeArgumentListSyntax", - "AttributeArgumentSyntax", - "AttributeSyntax", - "AttributeTargetSpecifierSyntax", - "BaseListSyntax", - "CatchDeclarationSyntax", - "CatchFilterClauseSyntax", - "ConstructorInitializerSyntax", - "ConversionOperatorMemberCrefSyntax", - "CrefBracketedParameterListSyntax", - "CrefParameterListSyntax", - "CrefParameterSyntax", - "ExplicitInterfaceSpecifierSyntax", - "FunctionPointerCallingConventionSyntax", - "FunctionPointerParameterListSyntax", - "FunctionPointerParameterSyntax", - "FunctionPointerUnmanagedCallingConventionListSyntax", - "FunctionPointerUnmanagedCallingConventionSyntax", - "IndexerMemberCrefSyntax", - "InterpolationAlignmentClauseSyntax", - "InterpolationFormatClauseSyntax", - "JoinIntoClauseSyntax", - "LineDirectivePositionSyntax", - "NameMemberCrefSyntax", - "OperatorMemberCrefSyntax", - "OrderingSyntax", - "PositionalPatternClauseSyntax", - "PropertyPatternClauseSyntax", - "QualifiedCrefSyntax", - "SubpatternSyntax", - "SwitchExpressionArmSyntax", - "TypeCrefSyntax", - "XmlCrefAttributeSyntax", - "XmlElementEndTagSyntax", - "XmlElementStartTagSyntax", - "XmlNameAttributeSyntax", - "XmlNameSyntax", - "XmlPrefixSyntax", - "XmlTextAttributeSyntax", - }; + private readonly HashSet ignored = new() + { + "AccessorDeclarationSyntax", + "AccessorListSyntax", + "AttributeArgumentListSyntax", + "AttributeArgumentSyntax", + "AttributeSyntax", + "AttributeTargetSpecifierSyntax", + "BaseListSyntax", + "CatchDeclarationSyntax", + "CatchFilterClauseSyntax", + "ConstructorInitializerSyntax", + "ConversionOperatorMemberCrefSyntax", + "CrefBracketedParameterListSyntax", + "CrefParameterListSyntax", + "CrefParameterSyntax", + "ExplicitInterfaceSpecifierSyntax", + "FunctionPointerCallingConventionSyntax", + "FunctionPointerParameterListSyntax", + "FunctionPointerParameterSyntax", + "FunctionPointerUnmanagedCallingConventionListSyntax", + "FunctionPointerUnmanagedCallingConventionSyntax", + "IndexerMemberCrefSyntax", + "InterpolationAlignmentClauseSyntax", + "InterpolationFormatClauseSyntax", + "JoinIntoClauseSyntax", + "LineDirectivePositionSyntax", + "NameMemberCrefSyntax", + "OperatorMemberCrefSyntax", + "OrderingSyntax", + "PositionalPatternClauseSyntax", + "PropertyPatternClauseSyntax", + "QualifiedCrefSyntax", + "SubpatternSyntax", + "SwitchExpressionArmSyntax", + "TypeCrefSyntax", + "XmlCrefAttributeSyntax", + "XmlElementEndTagSyntax", + "XmlElementStartTagSyntax", + "XmlNameAttributeSyntax", + "XmlNameSyntax", + "XmlPrefixSyntax", + "XmlTextAttributeSyntax", + }; } diff --git a/Src/CSharpier.VisualStudio/CSharpier.VisualStudioShared/CSharpierOptions.cs b/Src/CSharpier.VisualStudio/CSharpier.VisualStudioShared/CSharpierOptions.cs index 8e7e65d36..8cf32ea58 100644 --- a/Src/CSharpier.VisualStudio/CSharpier.VisualStudioShared/CSharpierOptions.cs +++ b/Src/CSharpier.VisualStudio/CSharpier.VisualStudioShared/CSharpierOptions.cs @@ -55,8 +55,10 @@ protected void LoadFrom(CSharpierOptions newInstance) this.DisableCSharpierServer = newInstance.DisableCSharpierServer; } - private static readonly AsyncLazy liveModel = - new(CreateAsync, ThreadHelper.JoinableTaskFactory); + private static readonly AsyncLazy liveModel = new( + CreateAsync, + ThreadHelper.JoinableTaskFactory + ); private static FileSystemWatcher _hotReloadWatcher; diff --git a/Src/CSharpier/DocTypes/Doc.cs b/Src/CSharpier/DocTypes/Doc.cs index 10edb115b..22f58a7e4 100644 --- a/Src/CSharpier/DocTypes/Doc.cs +++ b/Src/CSharpier/DocTypes/Doc.cs @@ -29,8 +29,10 @@ public static implicit operator Doc(string value) public static readonly HardLine HardLineIfNoPreviousLine = new(true); - public static readonly HardLine HardLineIfNoPreviousLineSkipBreakIfFirstInGroup = - new(true, true); + public static readonly HardLine HardLineIfNoPreviousLineSkipBreakIfFirstInGroup = new( + true, + true + ); public static readonly LiteralLine LiteralLine = new(); diff --git a/Src/CSharpier/Formatters/CSharp/PreprocessorSymbols.cs b/Src/CSharpier/Formatters/CSharp/PreprocessorSymbols.cs index 3b2ed0ff4..834b4f498 100644 --- a/Src/CSharpier/Formatters/CSharp/PreprocessorSymbols.cs +++ b/Src/CSharpier/Formatters/CSharp/PreprocessorSymbols.cs @@ -4,8 +4,10 @@ internal class PreprocessorSymbols : CSharpSyntaxWalker { private readonly List symbolSets = new(); private readonly HashSet squashedSymbolSets = new(); - private SymbolContext CurrentContext = - new() { ParentContext = new SymbolContext { ParentContext = null! } }; + private SymbolContext CurrentContext = new() + { + ParentContext = new SymbolContext { ParentContext = null! }, + }; private PreprocessorSymbols() : base(SyntaxWalkerDepth.Trivia) { } From b204505abd56de77a2ffa52965dee55fde265800 Mon Sep 17 00:00:00 2001 From: Bela VanderVoort Date: Mon, 18 Nov 2024 18:23:30 -0600 Subject: [PATCH 4/5] fixing playground --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 57dcd3ed1..142514c8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/aspnet:8.0.0-bookworm-slim-amd64 AS base +FROM mcr.microsoft.com/dotnet/aspnet:9.0.0-bookworm-slim-amd64 AS base WORKDIR /app ENV ASPNETCORE_URLS=http://+:80 EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:8.0.100-bookworm-slim-amd64 AS build +FROM mcr.microsoft.com/dotnet/sdk:9.0.100-bookworm-slim-amd64 AS build RUN set -uex \ && apt-get update \ From 88e3d9b6dc1818485ac721d9b8d375d4de7c70e0 Mon Sep 17 00:00:00 2001 From: PetSerAl Date: Wed, 20 Nov 2024 08:11:15 +0300 Subject: [PATCH 5/5] Use current `dotnet` host instead of global (#1387) Use current `dotnet` binary from `DOTNET_HOST_PATH` instead of just `dotnet`. Reasons: 1. Global (in `PATH`) may not exist (when used _Binaries_, but not _Installers_). 2. Global can have different runtime version. 3. Consistent with outer tools (`csc` for example). https://github.com/dotnet/roslyn/blob/324fd25331c969cd742ba68eee09ffd4b6fd29e3/src/Compilers/Shared/RuntimeHostInfo.cs#L61-L64 4. It is documented to be used for that purpose. https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables#dotnet_host_path --- Src/CSharpier.MsBuild/build/CSharpier.MsBuild.targets | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Src/CSharpier.MsBuild/build/CSharpier.MsBuild.targets b/Src/CSharpier.MsBuild/build/CSharpier.MsBuild.targets index b9f292b3b..10d4787a6 100644 --- a/Src/CSharpier.MsBuild/build/CSharpier.MsBuild.targets +++ b/Src/CSharpier.MsBuild/build/CSharpier.MsBuild.targets @@ -4,6 +4,8 @@ net8.0 net8.0 $(MSBuildThisFileDirectory)../tools/csharpier/$(CSharpier_FrameworkVersion)/dotnet-csharpier.dll + $(DOTNET_HOST_PATH) + dotnet $(CSharpierArgs) --check $(CSharpierArgs) --loglevel $(CSharpier_LogLevel) $(TargetFramework) @@ -23,7 +25,7 @@ StdOutEncoding="utf-8" StdErrEncoding="utf-8" IgnoreExitCode="true" - Command="dotnet "$(CSharpierDllPath)" $(CSharpierArgs) --no-msbuild-check --compilation-errors-as-warnings "$(MSBuildProjectDirectory)" > $(NullOutput) " /> + Command=""$(CSharpier_dotnet_Path)" exec "$(CSharpierDllPath)" $(CSharpierArgs) --no-msbuild-check --compilation-errors-as-warnings "$(MSBuildProjectDirectory)" > $(NullOutput) " />