Skip to content
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

Formatting with alpha10 #1452

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.30.1",
"version": "1.0.0-alpha10",
"commands": [
"dotnet-csharpier"
"csharpier"
]
}
}
Expand Down
2 changes: 2 additions & 0 deletions .csharpierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
build

Uploads/

Tests/MsBuild/TestCases/
3 changes: 1 addition & 2 deletions .github/Github.csproj
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<Project Sdk="Microsoft.Build.NoTargets/3.1.0">
</Project>
<Project Sdk="Microsoft.Build.NoTargets/3.1.0"></Project>
2 changes: 1 addition & 1 deletion .github/workflows/validate_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- run: |
rm -r -f ./Tests/CSharpier.MsBuild.Test
dotnet tool restore
dotnet csharpier . --check
dotnet csharpier check .
test_msbuild:
strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .idea/.idea.CSharpier/.idea/CSharpierPlugin.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/.idea.CSharpier/.idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/.idea.CSharpier/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/.idea.CSharpier/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/prettier.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions .run/Playground.run.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Playground" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/Src/CSharpier.Playground/CSharpier.Playground.csproj" />
<configuration
default="false"
name="Playground"
type="LaunchSettings"
factoryName=".NET Launch Settings Profile"
>
<option
name="LAUNCH_PROFILE_PROJECT_FILE_PATH"
value="$PROJECT_DIR$/Src/CSharpier.Playground/CSharpier.Playground.csproj"
/>
<option name="LAUNCH_PROFILE_TFM" value="net9.0" />
<option name="LAUNCH_PROFILE_NAME" value="Watch" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
Expand All @@ -14,4 +22,4 @@
<option name="Build" />
</method>
</configuration>
</component>
</component>
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageVersion Include="YamlDotNet" Version="16.1.2" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion Nuget/Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\README.md" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
</Project>
3 changes: 1 addition & 2 deletions Scripts/Scripts.csproj
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<Project Sdk="Microsoft.Build.NoTargets/3.1.0">
</Project>
<Project Sdk="Microsoft.Build.NoTargets/3.1.0"></Project>
3 changes: 1 addition & 2 deletions Shell/Shell.csproj
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<Project Sdk="Microsoft.Build.NoTargets/3.1.0">
</Project>
<Project Sdk="Microsoft.Build.NoTargets/3.1.0"></Project>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 20 additions & 23 deletions Src/CSharpier.MsBuild/CSharpier.MsBuild.csproj
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../Nuget/Build.props"/>
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<PackageId>CSharpier.MsBuild</PackageId>
<DevelopmentDependency>true</DevelopmentDependency>
<CSharpierOutputDir>../CSharpier.Cli/bin/$(Configuration)/$(TargetFramework)</CSharpierOutputDir>
</PropertyGroup>

<!--
<Import Project="../../Nuget/Build.props" />
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<PackageId>CSharpier.MsBuild</PackageId>
<DevelopmentDependency>true</DevelopmentDependency>
<CSharpierOutputDir>../CSharpier.Cli/bin/$(Configuration)/$(TargetFramework)</CSharpierOutputDir>
</PropertyGroup>
<!--
Note: There is no <ProjectReference /> here because that would cause msbuild to
make it a dependency in the output package, which causes all sorts of issues as
CSharpier is a net9.0 project with <PackAsTool> and this is neither.
-->
<Target Name="BuildCSharpier" BeforeTargets="Restore">
<Exec command="dotnet build -c $(Configuration)" WorkingDirectory="../CSharpier.Cli" />
</Target>

<ItemGroup>
<None Include="..\..\logo.png" Pack="true" PackagePath="">
<Link>logo.png</Link>
</None>
</ItemGroup>

<ItemGroup>
<Content Include="build/*" PackagePath="build/" />
<Content Include="$(CSharpierOutputDir)/**" PackagePath="tools/csharpier" />
</ItemGroup>
<Target Name="BuildCSharpier" BeforeTargets="Restore">
<Exec command="dotnet build -c $(Configuration)" WorkingDirectory="../CSharpier.Cli" />
</Target>
<ItemGroup>
<None Include="..\..\logo.png" Pack="true" PackagePath="">
<Link>logo.png</Link>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="build/*" PackagePath="build/" />
<Content Include="$(CSharpierOutputDir)/**" PackagePath="tools/csharpier" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions Src/CSharpier.MsBuild/MsBuild.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.Build.NoTargets/3.1.0">
<ItemGroup>
<Content Include="CSharpier.MsBuild.csproj"/>
</ItemGroup>
<ItemGroup>
<Content Include="CSharpier.MsBuild.csproj" />
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions Src/CSharpier.MsBuild/build/CSharpier.MsBuild.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup Condition=" '$(CSharpier_Check)' == '' ">
<!-- Setting default value here, so it can be overwritten by caller -->
<CSharpier_Check>false</CSharpier_Check>
<CSharpier_Check Condition=" '$(Configuration)' == 'Release' ">true</CSharpier_Check>
</PropertyGroup>
<PropertyGroup Condition=" '$(CSharpier_Check)' == '' ">
<!-- Setting default value here, so it can be overwritten by caller -->
<CSharpier_Check>false</CSharpier_Check>
<CSharpier_Check Condition=" '$(Configuration)' == 'Release' ">true</CSharpier_Check>
</PropertyGroup>
</Project>
62 changes: 45 additions & 17 deletions Src/CSharpier.MsBuild/build/CSharpier.MsBuild.targets
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
<Project>
<PropertyGroup>
<CSharpier_FrameworkVersion Condition="'$(CSharpier_FrameworkVersion)' == '' and $([MSBuild]::VersionGreaterThanOrEquals($(NETCoreSdkVersion), '9.0'))">net9.0</CSharpier_FrameworkVersion>
<CSharpier_FrameworkVersion Condition="'$(CSharpier_FrameworkVersion)' == '' and $([MSBuild]::VersionGreaterThanOrEquals($(NETCoreSdkVersion), '8.0'))">net8.0</CSharpier_FrameworkVersion>
<CSharpier_FrameworkVersion Condition="'$(CSharpier_FrameworkVersion)' == ''" Label="Fallback">net8.0</CSharpier_FrameworkVersion>
<CSharpier_FrameworkVersion
Condition="'$(CSharpier_FrameworkVersion)' == '' and $([MSBuild]::VersionGreaterThanOrEquals($(NETCoreSdkVersion), '9.0'))"
>net9.0</CSharpier_FrameworkVersion
>
<CSharpier_FrameworkVersion
Condition="'$(CSharpier_FrameworkVersion)' == '' and $([MSBuild]::VersionGreaterThanOrEquals($(NETCoreSdkVersion), '8.0'))"
>net8.0</CSharpier_FrameworkVersion
>
<CSharpier_FrameworkVersion Condition="'$(CSharpier_FrameworkVersion)' == ''" Label="Fallback"
>net8.0</CSharpier_FrameworkVersion
>
<CSharpierDllPath>$(MSBuildThisFileDirectory)../tools/csharpier/$(CSharpier_FrameworkVersion)/dotnet-csharpier.dll</CSharpierDllPath>
<CSharpier_dotnet_Path Condition="'$(CSharpier_dotnet_Path)' == ''">$(DOTNET_HOST_PATH)</CSharpier_dotnet_Path>
<CSharpier_dotnet_Path Condition="'$(CSharpier_dotnet_Path)' == ''">dotnet</CSharpier_dotnet_Path>
<CSharpierArgs Condition="'$(CSharpier_Check)' == 'true'">$(CSharpierArgs) --check</CSharpierArgs>
<CSharpierArgs Condition="'$(CSharpier_LogLevel)' != ''">$(CSharpierArgs) --loglevel $(CSharpier_LogLevel)</CSharpierArgs>
<FirstTargetFramework Condition=" '$(TargetFrameworks)' == '' ">$(TargetFramework)</FirstTargetFramework>
<FirstTargetFramework Condition=" '$(FirstTargetFrameworks)' == '' ">$(TargetFrameworks.Split(';')[0])</FirstTargetFramework>
<CSharpier_dotnet_Path Condition="'$(CSharpier_dotnet_Path)' == ''"
>$(DOTNET_HOST_PATH)</CSharpier_dotnet_Path
>
<CSharpier_dotnet_Path Condition="'$(CSharpier_dotnet_Path)' == ''"
>dotnet</CSharpier_dotnet_Path
>
<CSharpierArgs Condition="'$(CSharpier_Check)' == 'true'"
>$(CSharpierArgs) --check</CSharpierArgs
>
<CSharpierArgs Condition="'$(CSharpier_LogLevel)' != ''"
>$(CSharpierArgs) --loglevel $(CSharpier_LogLevel)</CSharpierArgs
>
<FirstTargetFramework Condition=" '$(TargetFrameworks)' == '' "
>$(TargetFramework)</FirstTargetFramework
>
<FirstTargetFramework Condition=" '$(FirstTargetFrameworks)' == '' "
>$(TargetFrameworks.Split(';')[0])</FirstTargetFramework
>
<NullOutput>NUL</NullOutput>
</PropertyGroup>

<PropertyGroup Condition=" '$(OS)' != 'Windows_NT' ">
<NullOutput>/dev/null</NullOutput>
</PropertyGroup>

<Target Name="CSharpierFormatInner" Condition="'$(CSharpier_Bypass)' != 'true'">
<!-- IgnoreExitCode cleans up the output when files aren't formatted and fail the check -->
<!-- &gt; NullOutput suppresses the output from this so that compilation errors will show up a single time -->
Expand All @@ -27,16 +45,26 @@
IgnoreExitCode="true"
IgnoreStandardErrorWarningFormat="true"
CustomErrorRegularExpression="^Error "
Command="&quot;$(CSharpier_dotnet_Path)&quot; exec &quot;$(CSharpierDllPath)&quot; $(CSharpierArgs) --no-msbuild-check --compilation-errors-as-warnings &quot;$(MSBuildProjectDirectory)&quot; &gt; $(NullOutput) " />
Command="&quot;$(CSharpier_dotnet_Path)&quot; exec &quot;$(CSharpierDllPath)&quot; $(CSharpierArgs) --no-msbuild-check --compilation-errors-as-warnings &quot;$(MSBuildProjectDirectory)&quot; &gt; $(NullOutput) "
/>
</Target>

<!-- getting this to run a single time for projects that target multiple frameworks requires all of this
see https://github.com/dotnet/msbuild/issues/2781 -->
<Target Name="CSharpierFormat" BeforeTargets="DispatchToInnerBuilds;BeforeBuild">
<MSBuild Projects="$(MSBuildProjectFile)" Targets="CSharpierFormatInner" Properties="TargetFramework=$(FirstTargetFramework);CSharpier_FrameworkVersion=$(CSharpier_FrameworkVersion)" />
<MSBuild
Projects="$(MSBuildProjectFile)"
Targets="CSharpierFormatInner"
Properties="TargetFramework=$(FirstTargetFramework);CSharpier_FrameworkVersion=$(CSharpier_FrameworkVersion)"
/>
</Target>

<Target Name="CSharpierLogBypass" BeforeTargets="CSharpierFormatInner" Condition="'$(CSharpier_Bypass)' == 'true'">
<Message Text="CSharpier bypassed because CSharpier_Bypass is set to 'true'" Importance="high" />
<Target
Name="CSharpierLogBypass"
BeforeTargets="CSharpierFormatInner"
Condition="'$(CSharpier_Bypass)' == 'true'"
>
<Message
Text="CSharpier bypassed because CSharpier_Bypass is set to 'true'"
Importance="high"
/>
</Target>
</Project>
7 changes: 5 additions & 2 deletions Src/CSharpier.Playground/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Src/CSharpier.Playground/.idea/prettier.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Src/CSharpier.Playground/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 17 additions & 4 deletions Src/CSharpier.Playground/CSharpier.Playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,31 @@
<ItemGroup>
<ProjectReference Include="..\CSharpier\CSharpier.csproj" />
</ItemGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<Target
Name="DebugEnsureNodeEnv"
BeforeTargets="Build"
Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') "
>
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Error
Condition="'$(ErrorCode)' != '0'"
Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE."
/>
<Message
Importance="high"
Text="Restoring dependencies using 'npm'. This may take several minutes..."
/>
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
</Target>
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
<ItemGroup>
<BuildFiles Include="$(SpaRoot)build\**" />
<ResolvedFileToPublish Include="@(BuildFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
<ResolvedFileToPublish
Include="@(BuildFiles-&gt;'%(FullPath)')"
Exclude="@(ResolvedFileToPublish)"
>
<RelativePath>%(BuildFiles.Identity)</RelativePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Src/CSharpier.Playground/ClientApp/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading