Skip to content

Commit

Permalink
Breaking Change: Update dependencies (#5)
Browse files Browse the repository at this point in the history
**breaking change(TextTemplating): Update dependencies**
* Microsoft.Extensions.FileProviders.Composite v6 => v7.0.0
* Microsoft.Extensions.FileProviders.Embedded v6 => v7.0.0
* Microsoft.Extensions.FileProviders.Physical" v6 => v7.0.0
* Microsoft.Extensions.Localization v6 => v7.0.0
* Scriban.Signed v.5.4.6 => 5.5.2

**breaking change(TextTemplating.Tests): Update dependencies**
* Microsoft.Extensions.DependencyInjection v6 => v7.0.0
* Microsoft.Extensions.Logging.Abstractions v6 => v7.0.0
* Microsoft.NET.Test.Sdk v17.2.0 => v17.4.1
* NUnit3TestAdapter v4.2.1. => 4.3.1

**chore: Miscellaneous**
chore: Update `.editorconfig`
chore: Update GitHub action
chore: disable warnings CS8766, CS1591
chore: Refactoring using latest language features
chore: Create artifacts with GitHub action
  • Loading branch information
axunonb authored Jan 10, 2023
1 parent c3d6c96 commit d54a1d1
Show file tree
Hide file tree
Showing 10 changed files with 181 additions and 141 deletions.
41 changes: 33 additions & 8 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,51 @@
name: build + test
name: .NET

on:
push:
branches: [ main ]
branches: [ main, 'version/**', 'pr/**', 'pr-**' ]
paths-ignore:
- '**/*.md'
pull_request:
branches: [ main ]
branches: [ main, 'version/**', 'pr/**', 'pr-**' ]
types: [opened, synchronize, reopened]
paths-ignore:
- '**/*.md'

jobs:
build:

runs-on: ubuntu-latest
name: Build
runs-on: ${{ matrix.os }}
env:
version: '2.0.0'
versionFile: '2.0.0'
packDotNetVersion: '6'
strategy:
matrix:
dotnet-version: [ '3.1.x', '5.0.x' ]
os: [ ubuntu-latest ]
dotnet-version: [ '3.x', '6.x' ]

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Restore dependencies
run: dotnet restore ./Src/TextTemplating.sln
- name: Build
run: dotnet build --no-restore ./Src/TextTemplating.sln
- name: Test
run: dotnet test --no-build --verbosity normal ./Src/TextTemplating.sln
- name: Pack
if: startsWith(matrix.dotnet-version, env.packDotNetVersion)
run: |
echo "Packing Version: ${{ env.version }}, File Version: ${{ env.versionFile }}"
dotnet build ./Src/TextTemplating.sln /verbosity:minimal --configuration release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:ContinuousIntegrationBuild=true /p:PackageOutputPath=${{ github.workspace }}/artifacts/ /p:Version=${{ env.version }} /p:FileVersion=${{ env.versionFile }}
dotnet pack ./Src/TextTemplating.sln /verbosity:minimal --configuration release
- name: Upload Artifacts
uses: actions/upload-artifact@v3
if: startsWith(matrix.dotnet-version, env.packDotNetVersion)
with:
name: Packages_${{ env.version }}
path: ${{ github.workspace }}/artifacts/
20 changes: 20 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>

<PropertyGroup>
<Product>Axuno.TextTemplating</Product>
<Version>2.0.0</Version>
<FileVersion>2.0.0</FileVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion> <!--only update AssemblyVersion with major releases -->
<Company>axuno gGmbH</Company>
<Authors>axuno gGmbH</Authors>
<CurrentYear>$([System.DateTime]::Now.ToString(yyyy))</CurrentYear>
<Copyright>© 2013-$(CurrentYear) Volosoft. Open source license with LGPLv3.0</Copyright>
<LangVersion>latest</LangVersion>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>Default</AnalysisMode>
<AnalysisModeSecurity>All</AnalysisModeSecurity>
<AnalysisLevel>latest</AnalysisLevel>
<Features>strict</Features>
</PropertyGroup>

</Project>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Text templating is used to dynamically render contents based on a template and a
* You can define layout templates to be used as the layout while rendering other templates.
* You can pass arbitrary objects to the template context (beside the model) for advanced scenarios.

The library is a modified version of [Volo.Abp.TextTemplating](https://github.com/abpframework/abp/tree/dev/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating) 4.1
Modifications to the source code were made by axuno in 2020/21. Changes focused on:
The library is a modified version of the lightweight TextTemplating.Scriban part of [Volo.Abp.TextTemplating](https://github.com/abpframework/abp/tree/dev/framework/src/Volo.Abp.TextTemplating/Volo/Abp/TextTemplating) 7.0, (i.e., exluding the more heavy TextTemplating.Razor)
Modifications to the source code were made by axuno in 2020-23. Changes focused on:

* decouple Volo.Abp.TextTemplating from all dependencies of the Abp Framework
* replace the dependency Volo.Abp.VirtualFileSystem with a modified forked version of it ([Axuno.VirtualFileSystem](https://github.com/axuno/Axuno.VirtualFileSystem))
Expand Down
2 changes: 1 addition & 1 deletion Src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ dotnet_style_qualification_for_property = false:suggestion
csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_namespace_declarations = file_scoped:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_lambdas = true:silent
Expand Down
73 changes: 36 additions & 37 deletions Src/Axuno.TextTemplating.Tests/Axuno.TextTemplating.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\Axuno.TextTemplating\Axuno.TextTemplating.snk</AssemblyOriginatorKeyFile>
<Authors>axuno gGmbH</Authors>
<Company>axuno gGmbH</Company>
<Product>Axuno.TextTemplating</Product>
<Copyright>© axuno gGmbH</Copyright>
<PackageProjectUrl>https://github.com/axuno/Axuno.TextTemplating</PackageProjectUrl>
<RepositoryType>Git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<DelaySign>false</DelaySign>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\Axuno.TextTemplating\Axuno.TextTemplating.snk</AssemblyOriginatorKeyFile>
<Authors>axuno gGmbH</Authors>
<Company>axuno gGmbH</Company>
<Product>Axuno.TextTemplating</Product>
<CurrentYear>$([System.DateTime]::Now.ToString(yyyy))</CurrentYear>
<Copyright>© 2013-$(CurrentYear) axuno gGmbH</Copyright>
<RepositoryType>Git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Nullable>enable</Nullable>
<DelaySign>false</DelaySign>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Axuno.TextTemplating\Axuno.TextTemplating.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Axuno.TextTemplating\Axuno.TextTemplating.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Localization\TestLocalizationResource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>TestLocalizationResource.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Update="Localization\TestLocalizationResource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>TestLocalizationResource.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Localization\TestLocalizationResource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>TestLocalizationResource.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Localization\TestLocalizationResource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>TestLocalizationResource.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

</Project>
25 changes: 11 additions & 14 deletions Src/Axuno.TextTemplating/Axuno.TextTemplating.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.1;net60</TargetFrameworks>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);1591</NoWarn>
<Description>Text templating is used to dynamically render contents based on a template and a model.

* It is based on the Scriban library, so it supports conditional logics, loops and much more.
* Template content can be localized.
* You can define layout templates to be used as the layout while rendering other templates.
* You can pass arbitrary objects to the template context (beside the model) for advanced scenarios.

The library is a modified version of Volo.Abp.TextTemplating 4.1</Description>
<Copyright>© 2013 - 2022 Volosoft. Open source license with LGPLv3.0</Copyright>
<Version>1.1.0</Version>
<Authors>axuno gGmbH</Authors>
The library is a modified version of the lightweight TextTemplating.Scriban part of Volo.Abp.TextTemplating 7.0
(i.e., exluding the more heavy TextTemplating.Razor).</Description>
<PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression>
<PackageTags>text templating netstandard c#</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<LangVersion>latest</LangVersion>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
Expand All @@ -27,10 +25,9 @@ The library is a modified version of Volo.Abp.TextTemplating 4.1</Description>
<RepositoryType>Git</RepositoryType>
<PackageIcon>TextTemplating.png</PackageIcon>
<PackageProjectUrl>https://github.com/axuno/Axuno.TextTemplating</PackageProjectUrl>
<PackageReleaseNotes>Replaced package Scriban with Scriban.Signed 5.4.6</PackageReleaseNotes>
<PackageReleaseNotes>Bumped to v2.0.0
Breaking changes caused by updated dependencies</PackageReleaseNotes>
<OutputType>Library</OutputType>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -50,16 +47,16 @@ The library is a modified version of Volo.Abp.TextTemplating 4.1</Description>

<ItemGroup>
<PackageReference Include="Axuno.VirtualFileSystem" Version="1.0.1" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Composite" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.5" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="6.0.5" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Composite" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="7.0.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Scriban.Signed" Version="5.4.6" />
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
<PackageReference Include="Scriban.Signed" Version="5.5.2" />
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 6 additions & 3 deletions Src/Axuno.TextTemplating/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static string Left(this string str, int len)
throw new ArgumentException("len argument can not be bigger than given string's length!");
}

return str.Substring(0, len);
return str[..len];
}

/// <summary>
Expand Down Expand Up @@ -199,7 +199,7 @@ public static string ReplaceFirst(this string str, string search, string replace
return str;
}

return str.Substring(0, pos) + replace + str[(pos + search.Length)..];
return str[..pos] + replace + str[(pos + search.Length)..];
}

/// <summary>
Expand Down Expand Up @@ -412,10 +412,13 @@ public static T ToEnum<T>(this string value, bool ignoreCase)
/// <returns>The <see cref="MD5"/> hash for the string.</returns>
public static string ToMd5(this string str)
{
#pragma warning disable CA5351
using var md5 = MD5.Create();
#pragma warning restore CA5351
var inputBytes = Encoding.UTF8.GetBytes(str);
#pragma warning disable CA1850
var hashBytes = md5.ComputeHash(inputBytes);

#pragma warning restore CA1850
var sb = new StringBuilder();
foreach (var hashByte in hashBytes)
{
Expand Down
Loading

0 comments on commit d54a1d1

Please sign in to comment.