-
-
Notifications
You must be signed in to change notification settings - Fork 101
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 #200 from shocklateboy92/features/msbuild
Add package with build tasks to format on build
- Loading branch information
Showing
10 changed files
with
118 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<Version>0.9.2</Version> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<RepositoryUrl>https://github.com/belav/csharpier</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
</PropertyGroup> | ||
</Project> |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
### MSBuild Package | ||
CSharpier can be run when a package is built by installing the CSharpier.MSBuild nuget package | ||
```console | ||
Install-Package CSharpier.MSBuild | ||
``` | ||
|
||
By default this will | ||
- In Debug - on build will run `dotnet csharpier` in the project folder to format all files in the project. | ||
- In Release - on build will run `dotnet csharpier --check` in the project folder to validate that all files in the project have already been formatted. | ||
|
||
You can control when `--check` is used with the following Property | ||
```xml | ||
<PropertyGroup> | ||
<CSharpier_Check>false</CSharpier_Check> | ||
</PropertyGroup> | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="../../CSharpier.Targets"/> | ||
<PropertyGroup> | ||
<TargetFrameworks>net5.0;netstandard2.0</TargetFrameworks> | ||
<PackageId>CSharpier.MsBuild</PackageId> | ||
<CSharpierOutputDir>../CSharpier/bin/$(Configuration)/net5.0</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 net5.0 project with <PackAsTool> and this is neither. | ||
--> | ||
<Target Name="BuildCSharpier" BeforeTargets="Build"> | ||
<Exec command="dotnet build -c $(Configuration)" WorkingDirectory="../CSharpier" /> | ||
</Target> | ||
|
||
<ItemGroup> | ||
<Content Include="build/*" PackagePath="build/" /> | ||
<Content Include="$(CSharpierOutputDir)/**" PackagePath="tools/csharpier" /> | ||
</ItemGroup> | ||
</Project> |
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,3 @@ | ||
You can test this by doing | ||
`dotnet pack -o publish` | ||
Then add a nuget source pointing to that folder and install the nuget package into a project |
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,10 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<!-- Setting default value here, so it can be overwritten by caller --> | ||
<CSharpier_Check>false</CSharpier_Check> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
<CSharpier_Check>true</CSharpier_Check> | ||
</PropertyGroup> | ||
</Project> |
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,13 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<CSharpierDllPath>$(MSBuildThisFileDirectory)../tools/csharpier/dotnet-csharpier.dll</CSharpierDllPath> | ||
<CSharpierArgs Condition="$(CSharpier_Check)">$(CSharpierArgs) --check</CSharpierArgs> | ||
</PropertyGroup> | ||
|
||
<!-- Target invokes the copy of csharpier from this package on the current project --> | ||
<Target | ||
Name="CSharpierFormat" | ||
BeforeTargets="Build"> | ||
<Exec Command="dotnet $(CSharpierDllPath) $(CSharpierArgs) $(MSBuildProjectDirectory)" /> | ||
</Target> | ||
</Project> |
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,33 +1,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<Import Project="../../CSharpier.Targets"/> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<PackageId>CSharpier</PackageId> | ||
<AssemblyName>dotnet-csharpier</AssemblyName> | ||
<OutputType>Exe</OutputType> | ||
<PackageId>CSharpier</PackageId> | ||
<AssemblyName>dotnet-csharpier</AssemblyName> | ||
<TargetFramework>net5.0</TargetFramework> | ||
<RootNamespace>CSharpier</RootNamespace> | ||
<PackAsTool>true</PackAsTool> | ||
<Version>0.9.3</Version> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<RepositoryUrl>https://github.com/belav/csharpier</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<PackAsTool>true</PackAsTool> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Ignore" Version="0.1.42" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> | ||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20574.7" /> | ||
<PackageReference Include="System.IO.Abstractions" Version="13.2.29" /> | ||
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="13.2.29" /> | ||
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" /> | ||
<PackageReference Include="UTF.Unknown" Version="2.3.0" /> | ||
<PackageReference Include="YamlDotNet" Version="11.1.1" /> | ||
<PackageReference Include="Ignore" Version="0.1.42" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> | ||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20574.7" /> | ||
<PackageReference Include="System.IO.Abstractions" Version="13.2.29" /> | ||
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="13.2.29" /> | ||
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" /> | ||
<PackageReference Include="UTF.Unknown" Version="2.3.0" /> | ||
<PackageReference Include="YamlDotNet" Version="11.1.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |