Skip to content

Commit

Permalink
Migrated to net8.0, dropped older targets
Browse files Browse the repository at this point in the history
  • Loading branch information
stesee authored Nov 17, 2023
2 parents b52036a + 61e92bb commit a2bc7eb
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 149 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ jobs:
GITHUB_TOKEN: ${{ github.TOKEN }}
if: env.GITHUB_TOKEN != ''
run: |
gh release create ${{env.CURRENT_VERSION}} ./PdfAValidator/bin/Release/*.*nupkg --prerelease --generate-notes
gh release create ${{env.CURRENT_VERSION}} ./PdfAValidator/bin/Release/*.*nupkg --generate-notes
deployTest:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
Expand All @@ -77,15 +77,14 @@ jobs:
run: |
ls ./PdfAValidator/bin/Release
dotnet nuget push ./PdfAValidator/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TEST_TOKEN}} --source https://apiint.nugettest.org/v3/index.json
- name: Github prerelease
- name: Github Prerelease
shell: bash
env:
GITHUB_TOKEN: ${{ github.TOKEN }}
if: env.GITHUB_TOKEN != ''
run: |
gh release create ${{env.CURRENT_VERSION}} ./PdfAValidator/bin/Release/*.*nupkg --prerelease --generate-notes
deployAzure:
if: ${{ github.ref == 'refs/heads/release' || github.ref == 'refs/heads/AzureAppPublishUsingGithubActions'}}
runs-on: ubuntu-latest
Expand Down
24 changes: 9 additions & 15 deletions PdfAValidator/PdfAValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class PdfAValidator : IPdfAValidator
private const string maskedQuote = "\"";

/// <summary>
/// Max temp path length that VeraPdf fits into without throwing System.IO.DirectoryNotFoundException, value may change on new VeraPdf versions. Value does differ between .net and .net framework and linux. See also https://github.com/Codeuctivity/PdfAValidatorApi/issues/59
/// Max temp path length that VeraPdf fits into without throwing System.IO.DirectoryNotFoundException, value may change on new VeraPdf versions. Value does differ between .net and .net framework and Linux. See also https://github.com/Codeuctivity/PdfAValidatorApi/issues/59
/// </summary>
public int MaxLengthTempDirectoryThatVeraPdfFitsIn { get; private set; }

Expand Down Expand Up @@ -113,7 +113,7 @@ public PdfAValidator(string pathToVeraPdfBin, string pathToJava) : this(pathToVe
/// </summary>
/// <param name="pathToVeraPdfBin"></param>
/// <param name="pathToJava"></param>
/// <param name="veraPdfOutputFilter">Optional VerapPdf console output filter</param>
/// <param name="veraPdfOutputFilter">Optional VeraPdf console output filter</param>
public PdfAValidator(string pathToVeraPdfBin, string pathToJava, IVeraPdfOutputFilter? veraPdfOutputFilter)
{
InitRuntimeSpecificMaxLengthTempdirectoryThatVeraPdfFitsIn();
Expand All @@ -126,7 +126,7 @@ public PdfAValidator(string pathToVeraPdfBin, string pathToJava, IVeraPdfOutputF
}

/// <summary>
/// Use this constructor to use the embedded veraPdf binaries
/// Use this constructor to use the embedded VeraPdf binaries
/// </summary>
public PdfAValidator() : this(new NullVeraPdfOutputFilter())
{
Expand All @@ -135,7 +135,7 @@ public PdfAValidator() : this(new NullVeraPdfOutputFilter())
}

/// <summary>
/// Use this constructor to use the embedded veraPdf binaries with a custom temp path (default is %temp%)
/// Use this constructor to use the embedded VeraPdf binaries with a custom temp path (default is %temp%)
/// </summary>
public PdfAValidator(string tempPath) : this(new NullVeraPdfOutputFilter())
{
Expand All @@ -144,9 +144,9 @@ public PdfAValidator(string tempPath) : this(new NullVeraPdfOutputFilter())
}

/// <summary>
/// Use this constructor to use the embedded veraPdf binaries
/// Use this constructor to use the embedded VeraPdf binaries
/// </summary>
/// <param name="veraPdfOutputFilter">Optional VerapPdf console output filter</param>
/// <param name="veraPdfOutputFilter">Optional VeraPdf console output filter</param>
public PdfAValidator(IVeraPdfOutputFilter? veraPdfOutputFilter)
{
InitRuntimeSpecificMaxLengthTempdirectoryThatVeraPdfFitsIn();
Expand Down Expand Up @@ -210,10 +210,7 @@ public async Task<Report> ValidateWithDetailedReportAsync(string pathToPdfFile,
/// <returns></returns>
public async Task<Report> ValidateBatchWithDetailedReportAsync(IEnumerable<string> pathsToPdfFiles, string commandLineArguments)
{
if (pathsToPdfFiles == null)
{
throw new ArgumentNullException(nameof(pathsToPdfFiles));
}
ArgumentNullException.ThrowIfNull(pathsToPdfFiles);

await IntiPathToVeraPdfBinAndJava().ConfigureAwait(false);

Expand Down Expand Up @@ -307,10 +304,7 @@ private static void WaitAndReceiveOutput(Process process, out string outputResul

private static bool IsSingleFolder(IEnumerable<string> pathsToPdfFiles)
{
if (pathsToPdfFiles == null)
{
throw new ArgumentNullException(nameof(pathsToPdfFiles));
}
ArgumentNullException.ThrowIfNull(pathsToPdfFiles);

var enumeratedPathsToPdfFiles = pathsToPdfFiles.ToArray();

Expand Down Expand Up @@ -416,7 +410,7 @@ private async Task IntiPathToVeraPdfBinAndJava()
private static void SetLinuxFileExecutable(string filePath)
{
var chmodCmd = "chmod 700 " + filePath;
var escapedArgs = chmodCmd.Replace(maskedQuote, "\\\"");
var escapedArgs = chmodCmd.Replace(maskedQuote, "\\\"", StringComparison.InvariantCulture);

using var process = new Process
{
Expand Down
153 changes: 76 additions & 77 deletions PdfAValidator/PdfAValidator.csproj
Original file line number Diff line number Diff line change
@@ -1,88 +1,87 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RepositoryUrl>https://github.com/Codeuctivity/PdfAValidatorApi</RepositoryUrl>
<PackageTags>PdfAValidator Pdf PdfA VeraPdf Pdf/A Validate</PackageTags>
<Authors>Stefan Seeland</Authors>
<Company>Codeuctivity</Company>
<Version Condition="'$(CURRENT_VERSION)' != ''">$(CURRENT_VERSION)</Version>
<Version Condition="'$(CURRENT_VERSION)' == ''">0.0.1</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<FileVersion>$(Version)</FileVersion>
<PackageVersion>$(Version)</PackageVersion>
<PackageReleaseNotes>$(LAST_COMMIT_MESSAGE)</PackageReleaseNotes>
<PackageIcon>NugetIcon.png</PackageIcon>
<PackageProjectUrl>https://github.com/Codeuctivity/PdfAValidatorApi</PackageProjectUrl>
<Description>PdfAValidator is based on VeraPdf and is an open source conformance checker for PDF/A files. It is designed to help archives and libraries check that their PDF/A collections conform to the appropriate ISO 19005 archiving standard specification.</Description>
<PackageLicenseExpression>AGPL-3.0-only</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<AssemblyOriginatorKeyFile>PdfAValidator.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<Nullable>enable</Nullable>
<LangVersion>8.0</LangVersion>
<RootNamespace>Codeuctivity</RootNamespace>
<NeutralLanguage>en</NeutralLanguage>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<AnalysisLevel>latest</AnalysisLevel> <PackageId>Codeuctivity.PdfAValidator</PackageId>
<PackageReadmeFile>nugetReadme.md</PackageReadmeFile>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RepositoryUrl>https://github.com/Codeuctivity/PdfAValidatorApi</RepositoryUrl>
<PackageTags>PdfAValidator Pdf PdfA VeraPdf Pdf/A Validate</PackageTags>
<Authors>Stefan Seeland</Authors>
<Company>Codeuctivity</Company>
<Version Condition="'$(CURRENT_VERSION)' != ''">$(CURRENT_VERSION)</Version>
<Version Condition="'$(CURRENT_VERSION)' == ''">0.0.1</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<FileVersion>$(Version)</FileVersion>
<PackageVersion>$(Version)</PackageVersion>
<PackageReleaseNotes>$(LAST_COMMIT_MESSAGE)</PackageReleaseNotes>
<PackageIcon>NugetIcon.png</PackageIcon>
<PackageProjectUrl>https://github.com/Codeuctivity/PdfAValidatorApi</PackageProjectUrl>
<Description>PdfAValidator is based on VeraPdf and is an open source conformance checker for PDF/A files. It is designed to help archives and libraries check that their PDF/A collections conform to the appropriate ISO 19005 archiving standard specification.</Description>
<PackageLicenseExpression>AGPL-3.0-only</PackageLicenseExpression>
<AssemblyOriginatorKeyFile>PdfAValidator.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<Nullable>enable</Nullable>
<RootNamespace>Codeuctivity</RootNamespace>
<NeutralLanguage>en</NeutralLanguage>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<AnalysisLevel>latest</AnalysisLevel>
<PackageId>Codeuctivity.PdfAValidator</PackageId>
<PackageReadmeFile>nugetReadme.md</PackageReadmeFile>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<None Include="docs\nugetReadme.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<None Include="docs\nugetReadme.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<None Remove="VeraPdf.zip" />
</ItemGroup>

<ItemGroup>
<None Remove="Java.zip" />
</ItemGroup>
<ItemGroup>
<None Remove="VeraPdf.zip" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="VeraPdf.zip" />
</ItemGroup>
<ItemGroup>
<None Remove="Java.zip" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Java.zip" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="VeraPdf.zip" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.11.0.78383">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Java.zip" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.12.0.78982">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
<None Include="NugetIcon.png" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="NugetIcon.png" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>
13 changes: 0 additions & 13 deletions PdfAValidator/VeraPdfException.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using System;
using System.Runtime.Serialization;

namespace Codeuctivity
{
/// <summary>
/// The exception that is thrown when the call of verapdf fails execution of a program.
/// </summary>
[Serializable]
public class VeraPdfException : Exception
{
/// <summary>
Expand Down Expand Up @@ -35,16 +33,5 @@ public VeraPdfException(string message) : base(message)
public VeraPdfException(string message, Exception innerException) : base(message, innerException)
{
}

/// <summary>
/// Initializes a new instance of the PdfAValidator.VeraPdfException class with a specified
/// error message and a reference to the inner exception that is the cause of this
/// exception.
/// </summary>
/// <param name="info">The info message that explains the reason for the exception.</param>
/// <param name="context">The context that is the cause of the current exception. If the innerException parameter is not a null reference (Nothing in Visual Basic), the current exception is raised in a catch block that handles the inner exception.</param>
protected VeraPdfException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
15 changes: 6 additions & 9 deletions PdfAValidatorTest/PdfAValidatorTest.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT' ">net8.0;net6.0;net48</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT' ">net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<LangVersion>8.0</LangVersion>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
</PropertyGroup>

Expand Down Expand Up @@ -68,17 +65,17 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.0.0.68202">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.12.0.78982">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
43 changes: 20 additions & 23 deletions PdfAValidatorWebApi/PdfAValidatorWebApi.csproj
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<Version Condition="'$(CURRENT_API_VERSION)' != ''">$(CURRENT_VERSION)</Version>
<Version Condition="'$(CURRENT_API_VERSION)' == ''">0.0.1</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<FileVersion>$(Version)</FileVersion>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Nullable>enable</Nullable>
<LangVersion>8.0</LangVersion>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<AssemblyVersion>$(Version)</AssemblyVersion>
<FileVersion>$(Version)</FileVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.0.0.68202">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.12" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.12.0.78982">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.12" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\PdfAValidator\PdfAValidator.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PdfAValidator\PdfAValidator.csproj" />
</ItemGroup>
</Project>
Loading

0 comments on commit a2bc7eb

Please sign in to comment.