Skip to content

Commit

Permalink
Target Framework Updates (#389)
Browse files Browse the repository at this point in the history
* Reference to Cysharp ZString v2.6.0 package (#382)
* Reference Cysharp `ZString` v2.6.0 in `SmartFormat` project (net461 target use the netstandard2.0 assemblies)
* Remove project `SmartFormat.Zstring`
* Move internal static class ZStringBuilderExtensions to namespace SmartFormat.ZString
* Rename ZStringBuilderExtensions to ZStringBuilderUtilities
* Exclude ZString wrappers from code coverage (#384)
* Flag `ZStringBuilder` and `ZStringWriter`with `[ExcludeFromCodeCoverage]`
* Add AltCoverAttributeFilter="ExcludeFromCodeCoverage" in CI tests
* #380 Add net60 as additional target framework (#381)
* #380 Add net 6 to STJ project and make other dependencies conditional
* Optimize package properties.
* Fix nullability and warning issues for Demo and Performance projects
* chore: net60/ZString related housekeeping (#385)
* Directory.Build.props: Remove duplicate entries from Demo and Performance projects
* Enable NRT for Demo and Performance projects
* Remove folder SmartFormat.ZString from former projects SmartFormat.ZString
* Remove obsolete entries from SmartFormat.sln
* Remove reference to former SmartFormat.ZString.dll from SmartFormat.csproj
* Enable net60 for project SmartFormat (#387)
* feat: Add net8.0 as a target framework (#388)
* Mark CTOR overload (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) as obsolete (like it is in net8.0).
* Update proprocessor directives and nuget packages
* Change appveyor_build_worker_image to Ubuntu2204
* Add net8.0 as target framework
* Update target framework net461 to net462
* Bump version to v3.4.0

---------

Co-authored-by: James Thompson <thompson.tomo@outlook.com>
  • Loading branch information
axunonb and thompson-tomo committed May 15, 2024
1 parent c48f7c6 commit 44165bb
Show file tree
Hide file tree
Showing 337 changed files with 3,343 additions and 69,747 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/SonarCloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ jobs:
# (PRs from forks can't access secrets other than secrets.GITHUB_TOKEN for security reasons)
if: ${{ !github.event.pull_request.head.repo.fork }}
env:
version: '3.3.2'
versionFile: '3.3.2'
version: '3.4.0'
versionFile: '3.4.0'
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '17'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
echo "Packing Version: ${{ env.version }}, File Version: ${{ env.versionFile }}"
dotnet pack ./src/SmartFormat.Deploy.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 }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Packages_${{ env.version }}
path: ${{ github.workspace }}/artifacts/
6 changes: 2 additions & 4 deletions PkgReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ Custom source or formatter extensions can be added easily using simple interface
* Custom formatting and source extensions are easy to integrate
* Comprehensive documentation: current Wiki, complete xmldoc

### Supported Frameworks
* .Net Framework 4.6.1 and later
* .Net Standard 2.0
* .Net Standard 2.1 and later for best optimizations
### Note
Use .Net Standard 2.1 and later for best optimizations

[![Paypal-Donations](https://img.shields.io/badge/Donate-PayPal-important.svg?style=flat-square)](https://www.paypal.com/donate?hosted_button_id=KSC3LRAR26AHN)
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ environment:
- job_name: windows
appveyor_build_worker_image: Visual Studio 2022
- job_name: linux
appveyor_build_worker_image: Ubuntu
appveyor_build_worker_image: Ubuntu2204
matrix:
fast_finish: true

Expand All @@ -23,7 +23,7 @@ for:
- ps: dotnet restore SmartFormat.sln --verbosity quiet
- ps: dotnet add .\SmartFormat.Tests\SmartFormat.Tests.csproj package AltCover
- ps: |
$version = "3.3.2"
$version = "3.4.0"
$versionFile = $version + "." + ${env:APPVEYOR_BUILD_NUMBER}
if ($env:APPVEYOR_PULL_REQUEST_NUMBER) {
Expand All @@ -38,7 +38,7 @@ for:
}
test_script:
- cmd: nuget install Appveyor.TestLogger
- cmd: dotnet test --framework net6.0 --test-adapter-path:. --logger:Appveyor SmartFormat.sln /p:configuration=release /p:AltCover=true /p:AltCoverXmlReport="coverage.xml" /p:AltCover=true /p:AltCoverStrongNameKey="..\SmartFormat\SmartFormat.snk" /p:AltCoverAssemblyExcludeFilter="SmartFormat.Tests|SmartFormat.ZString|NUnit3.TestAdapter" /p:AltCoverLineCover="true"
- cmd: dotnet test --framework net6.0 SmartFormat.sln /p:configuration=release /p:AltCover=true /p:AltCoverXmlReport="coverage.xml" /p:AltCoverStrongNameKey="..\SmartFormat\SmartFormat.snk" /p:AltCoverAssemblyExcludeFilter="SmartFormat.Tests|NUnit3.TestAdapter" /p:AltCoverAttributeFilter="ExcludeFromCodeCoverage" /p:AltCoverLineCover="true"
- cmd: nuget install codecov -excludeversion
- cmd: .\Codecov\Tools\win7-x86\codecov.exe -f ".\SmartFormat.Tests\coverage.net6.0.xml" -n net6.0win
artifacts:
Expand All @@ -64,5 +64,5 @@ for:
- dotnet add ./SmartFormat.Tests/SmartFormat.Tests.csproj package AltCover
- dotnet build SmartFormat.sln /verbosity:minimal /t:rebuild /p:configuration=release /nowarn:CS1591,CS0618
test_script:
- dotnet test --no-build --framework net6.0 SmartFormat.sln /p:configuration=release /p:AltCover=true /p:AltCoverXmlReport="coverage.xml" /p:AltCover=true /p:AltCoverStrongNameKey="..\SmartFormat\SmartFormat.snk" /p:AltCoverAssemblyExcludeFilter="SmartFormat.Tests|SmartFormat.ZString|NUnit3.TestAdapter" /p:AltCoverLineCover="true"
- dotnet test --no-build --framework net6.0 SmartFormat.sln /p:configuration=release /p:AltCover=true /p:AltCoverXmlReport="coverage.xml" /p:AltCoverStrongNameKey="..\SmartFormat\SmartFormat.snk" /p:AltCoverAssemblyExcludeFilter="SmartFormat.Tests|NUnit3.TestAdapter" /p:AltCoverAttributeFilter="ExcludeFromCodeCoverage" /p:AltCoverLineCover="true"
- bash <(curl -s https://codecov.io/bash) -f ./SmartFormat.Tests/coverage.net6.0.xml -n net6.0linux
4 changes: 2 additions & 2 deletions src/Demo/Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFrameworks>net6.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>SmartFormat.Demo.ico</ApplicationIcon>
<LangVersion>8.0</LangVersion>
<NoWarn>$(NoWarn);1591,1573</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
23 changes: 11 additions & 12 deletions src/Demo/Program.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
using System;
using System.Windows.Forms;

namespace SmartFormat.Demo
namespace SmartFormat.Demo;

internal static class Program
{
static class Program
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main()
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new SmartFormatDemo());
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new SmartFormatDemo());
}
}
40 changes: 20 additions & 20 deletions src/Demo/Sample Extensions/ArgumentValidator.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
using System;
#nullable enable
using System;
using System.Collections;
#nullable enable
namespace SmartFormat.Demo.Sample_Extensions

namespace Demo.Sample_Extensions;

public class ArgumentValidator
{
public class ArgumentValidator
public static void CheckForNullReference(object? argument, string argumentName)
{
public static void CheckForNullReference(object? argument, string argumentName)
{
if (argument != null) return;
throw new ArgumentNullException(argumentName);
}
if (argument != null) return;
throw new ArgumentNullException(argumentName);
}

public static void CheckForZeroValue(int argument, string argumentName)
{
if (argument != 0) return;
throw new ArgumentOutOfRangeException(argumentName, argument, argumentName + " cannot be zero");
}
public static void CheckForZeroValue(int argument, string argumentName)
{
if (argument != 0) return;
throw new ArgumentOutOfRangeException(argumentName, argument, argumentName + " cannot be zero");
}

public static void CheckForEmpty(IEnumerable argument, string argumentName)
{
var enumerator = argument.GetEnumerator();
if (enumerator.MoveNext()) return;
throw new ArgumentException(argumentName + " cannot be empty", argumentName);
}
public static void CheckForEmpty(IEnumerable argument, string argumentName)
{
var enumerator = argument.GetEnumerator();
if (enumerator.MoveNext()) return;
throw new ArgumentException(argumentName + " cannot be empty", argumentName);
}
}

0 comments on commit 44165bb

Please sign in to comment.