Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
2 changes: 2 additions & 0 deletions .globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ dotnet_diagnostic.S1135.severity = suggestion
# logging performance
dotnet_diagnostic.CA1848.severity = none

# Add at least one assertion to this test case.
dotnet_diagnostic.S2699.severity = suggestion
Comment thread
bmazzarol marked this conversation as resolved.
42 changes: 19 additions & 23 deletions Common.Benchmark.props
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
<!--
This file contains all the shared properties for
the benchmark projects that are in this solution
-->

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<SonarQubeExclude>true</SonarQubeExclude>
<ProjectName>$(AssemblyName.Replace('.Benchmarks', ''))</ProjectName>
<OutputType>Exe</OutputType>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet"/>
<PackageReference Include="BenchmarkDotNet.Diagnostics.dotTrace"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(MSBuildProjectDirectory)\..\$(ProjectName)\$(ProjectName).csproj"/>
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute"/>
</ItemGroup>

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<SonarQubeExclude>true</SonarQubeExclude>
<ProjectName>$(AssemblyName.Replace('.Benchmarks', ''))</ProjectName>
<OutputType>Exe</OutputType>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.dotTrace" />
<PackageReference Include=" Microsoft.CodeAnalysis.CSharp" VersionOverride="4.14.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(MSBuildProjectDirectory)\..\$(ProjectName)\$(ProjectName).csproj" />
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute" />
</ItemGroup>
</Project>
86 changes: 42 additions & 44 deletions Common.Docs.props
Original file line number Diff line number Diff line change
@@ -1,51 +1,49 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
<!--
This file contains all the shared properties for
the docs projects that are in this solution
-->

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<Target Name="BuildDocs" AfterTargets="AfterBuild" BeforeTargets="PostBuildEvent">
<!-- Prevent parallel execution -->
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<BuildDocInParallel>false</BuildDocInParallel>
</PropertyGroup>

<Target Name="BuildDocs" AfterTargets="AfterBuild" BeforeTargets="PostBuildEvent">
<!-- Prevent parallel execution -->
<PropertyGroup>
<BuildDocInParallel>false</BuildDocInParallel>
</PropertyGroup>

<!-- Check if docfx.json exists -->
<PropertyGroup>
<DocFxConfigExists Condition="Exists('docfx.json')">true</DocFxConfigExists>
</PropertyGroup>

<!-- Only proceed if docfx.json exists -->
<Message Text="docfx.json not found. Skipping documentation generation."
Condition="'$(DocFxConfigExists)' != 'true'"/>

<CallTarget Targets="ExecuteBuildDocs"
Condition="'$(DocFxConfigExists)' == 'true'"/>
</Target>

<Target Name="ExecuteBuildDocs">
<!-- Restore tools with error handling -->
<Exec Command="dotnet tool restore"
ContinueOnError="false"
StandardOutputImportance="low"
StandardErrorImportance="high"/>

<!-- Clean output directories -->
<RemoveDir Directories="_site;api"/>

<!-- Generate and build documentation -->
<Exec Command="dotnet docfx metadata docfx.json"
ContinueOnError="false"
StandardOutputImportance="normal"
StandardErrorImportance="high"/>

<Exec Command="dotnet docfx build docfx.json --warningsAsErrors"
ContinueOnError="false"
StandardOutputImportance="normal"
StandardErrorImportance="high"/>
</Target>
<!-- Check if docfx.json exists -->
<PropertyGroup>
<DocFxConfigExists Condition="Exists('docfx.json')">true</DocFxConfigExists>
</PropertyGroup>
<!-- Only proceed if docfx.json exists -->
<Message
Text="docfx.json not found. Skipping documentation generation."
Condition="'$(DocFxConfigExists)' != 'true'"
/>
<CallTarget Targets="ExecuteBuildDocs" Condition="'$(DocFxConfigExists)' == 'true'" />
</Target>
<Target Name="ExecuteBuildDocs">
<!-- Restore tools with error handling -->
<Exec
Command="dotnet tool restore"
ContinueOnError="false"
StandardOutputImportance="low"
StandardErrorImportance="high"
/>
<!-- Clean output directories -->
<RemoveDir Directories="_site;api" />
<!-- Generate and build documentation -->
<Exec
Command="dotnet docfx metadata docfx.json"
ContinueOnError="false"
StandardOutputImportance="normal"
StandardErrorImportance="high"
/>
<Exec
Command="dotnet docfx build docfx.json --warningsAsErrors"
ContinueOnError="false"
StandardOutputImportance="normal"
StandardErrorImportance="high"
/>
</Target>
</Project>
66 changes: 30 additions & 36 deletions Common.Release.props
Original file line number Diff line number Diff line change
@@ -1,40 +1,34 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
<!--
This file contains all the shared properties for
the projects that are released from this solution
-->

<PropertyGroup>
<Authors>Ben Mazzarol</Authors>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Copyright>Copyright (c) Ben Mazzarol. All rights reserved.</Copyright>
</PropertyGroup>

<PropertyGroup>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IsPackable>True</IsPackable>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<LangVersion>latest</LangVersion>
<OutputType>library</OutputType>
</PropertyGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<Content Include="build\**" Pack="true" PackagePath="build"/>
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>$(AssemblyName).Tests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>

</Project>
<PropertyGroup>
<Authors>Ben Mazzarol</Authors>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Copyright>Copyright (c) Ben Mazzarol. All rights reserved.</Copyright>
</PropertyGroup>
<PropertyGroup>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IsPackable>True</IsPackable>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<LangVersion>latest</LangVersion>
<OutputType>library</OutputType>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<Content Include="build\**" Pack="true" PackagePath="build" />
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>$(AssemblyName).Tests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
</Project>
66 changes: 31 additions & 35 deletions Common.Test.props
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
<!--
This file contains all the shared properties for
the test projects that are in this solution
-->

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<SonarQubeExclude>true</SonarQubeExclude>
<ProjectName>$(AssemblyName.Replace('.Tests', ''))</ProjectName>
<OutputType>Exe</OutputType>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
</PropertyGroup>

<Import Project="$(MSBuildProjectDirectory)\..\$(ProjectName)\build\$(ProjectName).props"
Condition="Exists('$(MSBuildProjectDirectory)\..\$(ProjectName)\build\$(ProjectName).props')"/>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage"/>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(MSBuildProjectDirectory)\..\$(ProjectName)\$(ProjectName).csproj"/>
</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute"/>
</ItemGroup>

<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<SonarQubeExclude>true</SonarQubeExclude>
<ProjectName>$(AssemblyName.Replace('.Tests', ''))</ProjectName>
<OutputType>Exe</OutputType>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
</PropertyGroup>
<Import
Project="$(MSBuildProjectDirectory)\..\$(ProjectName)\build\$(ProjectName).props"
Condition="Exists('$(MSBuildProjectDirectory)\..\$(ProjectName)\build\$(ProjectName).props')"
/>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" />
<PackageReference Include="xunit.v3" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(MSBuildProjectDirectory)\..\$(ProjectName)\$(ProjectName).csproj" />
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute" />
</ItemGroup>
<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>
</Project>
22 changes: 12 additions & 10 deletions Cutout.Sample/Cutout.Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<RootNamespace>Cutout.Sample</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Cutout\Cutout.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
</ItemGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<RootNamespace>Cutout.Sample</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference
Include="..\Cutout\Cutout.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false"
/>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ internal static partial class Test
internal static partial void Test(this StringBuilder builder, String product)
{
builder.Append(@"Some text before ");
Case2(builder,product);
Case2(builder, product);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ internal static partial class Test
internal static void Test(this StringBuilder builder, String product, string whitespace)
{
builder.Append(@"Some text before ");
Case2(builder,product);
Case2(builder, product);
}
}
6 changes: 3 additions & 3 deletions Cutout.Tests/CallStatementTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public static partial class CallTemplates
{
public sealed record Product(string Title);

private const string CallExample1 = "Some text before {{ call Case2(product.Title) }}";
private const string CallExample1 = "Some text before {% call Case2(product.Title) %}";

[Template(CallExample1)]
public static partial void Case1(this StringBuilder builder, Product product);
Expand All @@ -20,7 +20,7 @@ public sealed record Product(string Title);
private const string CallExample3 = """
This is an example with a call with leading whitespace,
```
{{ call Case4(product) }}
{% call Case4(product) %}
```
""";

Expand Down Expand Up @@ -50,7 +50,7 @@ public void Case1()
[Fact(DisplayName = "Case1 produces the expected source")]
public Task Case1a() =>
"""
[Template("Some text before {{ call Case2(product) }}")]
[Template("Some text before {% call Case2(product) %}")]
public static partial void Test(this StringBuilder builder, string product);
""".VerifyTemplate();

Expand Down
Loading