This is an automated email from the ASF dual-hosted git repository. nightowl888 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit e4f6f8d7335cc262a3540a21b39195bb255d2473 Author: Shad Storhaug <[email protected]> AuthorDate: Sat Nov 19 14:58:16 2022 +0700 Added net7.0 tests and retargeted lucene-cli to net6.0 and net7.0. --- Directory.Build.targets | 26 +++++++++++----------- TestTargetFramework.props | 5 +++-- .../Lucene.Net.Benchmark.csproj | 17 +------------- .../Flexible/Standard/TestNumericQueryParser.cs | 2 +- src/Lucene.Net/Lucene.Net.csproj | 9 -------- .../Lucene.Net.Tests.CodeAnalysis.csproj | 3 +++ .../Lucene.Net.Tests.Cli.csproj | 8 +++---- src/dotnet/tools/lucene-cli/lucene-cli.csproj | 5 +++-- 8 files changed, 28 insertions(+), 47 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index 0caed447e..9ba3a39f5 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -22,23 +22,23 @@ <Import Project=".build/dependencies.props" Condition="Exists('.build/dependencies.props')" /> - <!-- Features in .NET 6.x only --> - <PropertyGroup Condition=" $(TargetFramework.StartsWith('net6.')) "> + <!-- Features in .NET 6.x and .NET 7.x only --> + <PropertyGroup Condition=" $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) "> <DefineConstants>$(DefineConstants);FEATURE_SPANFORMATTABLE</DefineConstants> </PropertyGroup> - <!-- Features in .NET 5.x and .NET 6.x only --> - <PropertyGroup Condition=" $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) "> + <!-- Features in .NET 5.x, .NET 6.x, and .NET 7.x only --> + <PropertyGroup Condition=" $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) "> <DefineConstants>$(DefineConstants);FEATURE_ASPNETCORE_ENDPOINT_CONFIG</DefineConstants> <DefineConstants>$(DefineConstants);FEATURE_READONLYSET</DefineConstants> </PropertyGroup> - <!-- Features in .NET Core 3.x, .NET 5.x, and .NET 6.x only --> - <PropertyGroup Condition=" $(TargetFramework.StartsWith('netcoreapp3.')) Or $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) "> + <!-- Features in .NET Core 3.x, .NET 5.x, .NET 6.x, and .NET 7.x only --> + <PropertyGroup Condition=" $(TargetFramework.StartsWith('netcoreapp3.')) Or $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) "> <DefineConstants>$(DefineConstants);FEATURE_ARGITERATOR</DefineConstants> <DefineConstants>$(DefineConstants);FEATURE_DICTIONARY_REMOVE_CONTINUEENUMERATION</DefineConstants> @@ -47,7 +47,7 @@ </PropertyGroup> <!-- Features in .NET Standard, .NET Core, .NET 5.x, and .NET 6.x only (no .NET Framework support) --> - <PropertyGroup Condition=" $(TargetFramework.StartsWith('netstandard')) Or $(TargetFramework.StartsWith('netcoreapp')) Or $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) "> + <PropertyGroup Condition=" $(TargetFramework.StartsWith('netstandard')) Or $(TargetFramework.StartsWith('netcoreapp')) Or $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) "> <DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants> <DefineConstants>$(DefineConstants);FEATURE_ARRAYEMPTY</DefineConstants> @@ -57,8 +57,8 @@ <DebugType>portable</DebugType> </PropertyGroup> - <!-- Features in .NET Standard 2.1, .NET 5.x, and .NET 6.x only --> - <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' Or $(TargetFramework.StartsWith('netcoreapp3.')) Or $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) "> + <!-- Features in .NET Standard 2.1, .NET 5.x, .NET 6.x, and .NET 7.x only --> + <PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' Or $(TargetFramework.StartsWith('netcoreapp3.')) Or $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) "> <DefineConstants>$(DefineConstants);FEATURE_ARRAY_FILL</DefineConstants> <DefineConstants>$(DefineConstants);FEATURE_CONDITIONALWEAKTABLE_ENUMERATOR</DefineConstants> @@ -69,15 +69,15 @@ </PropertyGroup> - <!-- Features in .NET Standard 2.x, .NET Core 2.x, .NET Core 3.x, .NET 5.x, and .NET 6.x --> - <PropertyGroup Condition=" $(TargetFramework.StartsWith('netstandard2.')) Or $(TargetFramework.StartsWith('netcoreapp2.')) Or $(TargetFramework.StartsWith('netcoreapp3.')) Or $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) "> + <!-- Features in .NET Standard 2.x, .NET Core 2.x, .NET Core 3.x, .NET 5.x, .NET 6.x, and .NET 7.x --> + <PropertyGroup Condition=" $(TargetFramework.StartsWith('netstandard2.')) Or $(TargetFramework.StartsWith('netcoreapp2.')) Or $(TargetFramework.StartsWith('netcoreapp3.')) Or $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) "> <DefineConstants>$(DefineConstants);FEATURE_ICONFIGURATIONROOT_PROVIDERS</DefineConstants> </PropertyGroup> - <!-- Features in .NET Framework 4.5+, .NET Standard 2.x, .NET Core 2.x, .NET Core 3.x, .NET 5.x, and .NET 6.x --> - <PropertyGroup Condition=" $(TargetFramework.StartsWith('net4')) Or $(TargetFramework.StartsWith('netstandard2.')) Or $(TargetFramework.StartsWith('netcoreapp2.')) Or $(TargetFramework.StartsWith('netcoreapp3.')) Or $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) "> + <!-- Features in .NET Framework 4.5+, .NET Standard 2.x, .NET Core 2.x, .NET Core 3.x, .NET 5.x, .NET 6.x, and .NET 7.x --> + <PropertyGroup Condition=" $(TargetFramework.StartsWith('net4')) Or $(TargetFramework.StartsWith('netstandard2.')) Or $(TargetFramework.StartsWith('netcoreapp2.')) Or $(TargetFramework.StartsWith('netcoreapp3.')) Or $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) "> <DefineConstants>$(DefineConstants);FEATURE_ASSEMBLY_GETCALLINGASSEMBLY</DefineConstants> <DefineConstants>$(DefineConstants);FEATURE_FILESTREAM_LOCK</DefineConstants> diff --git a/TestTargetFramework.props b/TestTargetFramework.props index f6f485196..fbd97b11f 100644 --- a/TestTargetFramework.props +++ b/TestTargetFramework.props @@ -28,13 +28,14 @@ this setting only affects the test projects. --> <!--<TargetFramework>net461</TargetFramework>--> <!--<TargetFramework>net48</TargetFramework>--> - <TargetFramework>net5.0</TargetFramework> + <!--<TargetFramework>net5.0</TargetFramework>--> <!--<TargetFramework>net6.0</TargetFramework>--> + <TargetFramework>net7.0</TargetFramework> <!-- Allow the build script to pass in the test frameworks to build for. This overrides the above TargetFramework setting. LUCENENET TODO: Due to a parsing bug, we cannot pass a string with a ; to dotnet msbuild, so passing true as a workaround --> - <TargetFrameworks Condition=" '$(TestFrameworks)' == 'true' ">net6.0;net5.0</TargetFrameworks> + <TargetFrameworks Condition=" '$(TestFrameworks)' == 'true' ">net7.0;net6.0;net5.0</TargetFrameworks> <TargetFrameworks Condition=" '$(TestFrameworks)' == 'true' AND $([MSBuild]::IsOsPlatform('Windows')) ">$(TargetFrameworks);net48;net461</TargetFrameworks> <TargetFramework Condition=" '$(TargetFrameworks)' != '' "></TargetFramework> </PropertyGroup> diff --git a/src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj b/src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj index dceb2afd8..762ae8571 100644 --- a/src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj +++ b/src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj @@ -54,23 +54,8 @@ <ItemGroup> <PackageReference Include="J2N" Version="$(J2NPackageVersion)" /> <PackageReference Include="ICU4N.Collation" Version="$(ICU4NCollationPackageVersion)" /> - <PackageReference Include="Spatial4n" Version="$(Spatial4nPackageVersion)" /> - </ItemGroup> - - <ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' "> - <PackageReference Include="SharpZipLib" Version="$(SharpZipLibPackageVersion)" /> - </ItemGroup> - - <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' "> - <PackageReference Include="SharpZipLib" Version="$(SharpZipLibPackageVersion)" /> - </ItemGroup> - - <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' "> - <PackageReference Include="SharpZipLib" Version="$(SharpZipLibPackageVersion)" /> - </ItemGroup> - - <ItemGroup Condition=" '$(TargetFramework)' == 'net462' "> <PackageReference Include="SharpZipLib" Version="$(SharpZipLibPackageVersion)" /> + <PackageReference Include="Spatial4n" Version="$(Spatial4nPackageVersion)" /> </ItemGroup> <ItemGroup> diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs index 7f111eba8..bfb740b7c 100644 --- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs +++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestNumericQueryParser.cs @@ -240,7 +240,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard randomNumberMap[NumericType.DOUBLE.ToString()] = (J2N.Numerics.Double)randomDouble; randomNumberMap[DATE_FIELD_NAME] = (J2N.Numerics.Int64)randomDate; - RANDOM_NUMBER_MAP = randomNumberMap.AsReadOnly(); + RANDOM_NUMBER_MAP = JCG.Extensions.DictionaryExtensions.AsReadOnly(randomNumberMap); directory = NewDirectory(); RandomIndexWriter writer = new RandomIndexWriter(Random, directory, diff --git a/src/Lucene.Net/Lucene.Net.csproj b/src/Lucene.Net/Lucene.Net.csproj index 2b00ffc25..317590439 100644 --- a/src/Lucene.Net/Lucene.Net.csproj +++ b/src/Lucene.Net/Lucene.Net.csproj @@ -55,24 +55,15 @@ <ItemGroup> <PackageReference Include="J2N" Version="$(J2NPackageVersion)" /> - </ItemGroup> - - <ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' "> - <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="$(MicrosoftExtensionsConfigurationAbstractionsPackageVersion)" /> - </ItemGroup> - - <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' "> <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="$(MicrosoftExtensionsConfigurationAbstractionsPackageVersion)" /> </ItemGroup> <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' "> - <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="$(MicrosoftExtensionsConfigurationAbstractionsPackageVersion)" /> <PackageReference Include="Prism.Core" Version="$(PrismCorePackageVersion)" /> <PackageReference Include="System.Memory" Version="$(SystemMemoryPackageVersion)" /> </ItemGroup> <ItemGroup Condition=" '$(TargetFramework)' == 'net462' "> - <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="$(MicrosoftExtensionsConfigurationAbstractionsPackageVersion)" /> <PackageReference Include="Prism.Core" Version="$(PrismCorePackageVersion)" /> <PackageReference Include="System.Memory" Version="$(SystemMemoryPackageVersion)" /> </ItemGroup> diff --git a/src/dotnet/Lucene.Net.Tests.CodeAnalysis/Lucene.Net.Tests.CodeAnalysis.csproj b/src/dotnet/Lucene.Net.Tests.CodeAnalysis/Lucene.Net.Tests.CodeAnalysis.csproj index fc66c9037..768f84ad1 100644 --- a/src/dotnet/Lucene.Net.Tests.CodeAnalysis/Lucene.Net.Tests.CodeAnalysis.csproj +++ b/src/dotnet/Lucene.Net.Tests.CodeAnalysis/Lucene.Net.Tests.CodeAnalysis.csproj @@ -28,6 +28,9 @@ <IsPublishable>false</IsPublishable> <IsPublishable Condition=" '$(TargetFramework)' == 'net5.0' ">true</IsPublishable> <IsTestProject>true</IsTestProject> + + <!-- We purposely test on EoL frameworks for testing netstandard2.1, but we want to keep this warning in production code. --> + <CheckEolTargetFramework>false</CheckEolTargetFramework> </PropertyGroup> diff --git a/src/dotnet/tools/Lucene.Net.Tests.Cli/Lucene.Net.Tests.Cli.csproj b/src/dotnet/tools/Lucene.Net.Tests.Cli/Lucene.Net.Tests.Cli.csproj index 00f269642..d0cf2a720 100644 --- a/src/dotnet/tools/Lucene.Net.Tests.Cli/Lucene.Net.Tests.Cli.csproj +++ b/src/dotnet/tools/Lucene.Net.Tests.Cli/Lucene.Net.Tests.Cli.csproj @@ -25,13 +25,13 @@ <PropertyGroup> <!-- Allow specific target framework to flow in from TestTargetFrameworks.props --> - <TargetFrameworks Condition=" '$(TargetFramework)' == '' ">net6.0;net5.0</TargetFrameworks> + <TargetFrameworks Condition=" '$(TargetFramework)' == '' ">net7.0;net6.0</TargetFrameworks> <!-- If .NET Frameowrk is specified, just target the latest version --> - <TargetFramework Condition=" $(TargetFramework.StartsWith('net4')) ">net6.0</TargetFramework> + <TargetFramework Condition=" $(TargetFramework.StartsWith('net4')) ">net7.0</TargetFramework> <AssemblyTitle>Lucene.Net.Tests.Cli</AssemblyTitle> - <IsPublishable Condition="$(TargetFramework.StartsWith('net4'))">false</IsPublishable> - <IsTestProject Condition="$(TargetFramework.StartsWith('net4'))">false</IsTestProject> + <IsPublishable Condition="$(TargetFramework.StartsWith('net4')) Or $(TargetFramework.StartsWith('net5.'))">false</IsPublishable> + <IsTestProject Condition="$(TargetFramework.StartsWith('net4')) Or $(TargetFramework.StartsWith('net5.'))">false</IsTestProject> </PropertyGroup> <ItemGroup> diff --git a/src/dotnet/tools/lucene-cli/lucene-cli.csproj b/src/dotnet/tools/lucene-cli/lucene-cli.csproj index 6caebf627..a64845071 100644 --- a/src/dotnet/tools/lucene-cli/lucene-cli.csproj +++ b/src/dotnet/tools/lucene-cli/lucene-cli.csproj @@ -24,7 +24,8 @@ <Import Project="$(SolutionDir).build/nuget.props" /> <PropertyGroup> - <TargetFrameworks>net6.0;net5.0</TargetFrameworks> + <TargetFrameworks>net7.0;net6.0</TargetFrameworks> + <RollForward Condition=" $(TargetFramework.StartsWith('net7.')) ">Major</RollForward> <IsPublishable>true</IsPublishable> <IsPublishable Condition="$(TargetFramework.StartsWith('net4'))">false</IsPublishable> @@ -39,12 +40,12 @@ <PackageReadmeFile>readme.md</PackageReadmeFile> <DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile> - <NoWarn>$(NoWarn);1591;1573</NoWarn> <NoWarn Label="Nested types should not be visible">$(NoWarn);CA1034</NoWarn> <NoWarn Label="Remove unused parameter">$(NoWarn);IDE0060</NoWarn> </PropertyGroup> + <ItemGroup> <None Include="docs\index.md" Pack="true" PackagePath="\readme.md" /> <None Update="appsettings.json">
