Skip to content

Commit

Permalink
Upgrade tests and CLI to .NET 8, fix benchmark formatting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirwin committed Mar 13, 2024
1 parent 63e1053 commit 743aea0
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,-with-title
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down Expand Up @@ -81,11 +81,11 @@ steps:
testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
testResultsFileName: '${{ parameters.testResultsFileName }}'

# Special case: Only supports net7.0 and net6.0
# Special case: Only supports net8.0 and net6.0
- template: publish-test-results.yml
parameters:
testProjectName: 'Lucene.Net.Tests.Cli'
framework: 'net7.0' # Since condtions are not supported for templates, we check for the file existence within publish-test-results.yml
framework: 'net8.0' # Since condtions are not supported for templates, we check for the file existence within publish-test-results.yml
vsTestPlatform: '${{ parameters.vsTestPlatform }}'
osName: '${{ parameters.osName }}'
testResultsFormat: '${{ parameters.testResultsFormat }}'
Expand All @@ -102,12 +102,12 @@ steps:
testResultsArtifactName: '${{ parameters.testResultsArtifactName }}'
testResultsFileName: '${{ parameters.testResultsFileName }}'

# Special case: Only supports net7.0, net6.0 and net48
# Special case: Only supports net8.0, net6.0 and net48

- template: publish-test-results.yml
parameters:
testProjectName: 'Lucene.Net.Tests.Analysis.OpenNLP'
framework: 'net7.0' # Since condtions are not supported for templates, we check for the file existence within publish-test-results.yml
framework: 'net8.0' # Since condtions are not supported for templates, we check for the file existence within publish-test-results.yml
vsTestPlatform: '${{ parameters.vsTestPlatform }}'
osName: '${{ parameters.osName }}'
testResultsFormat: '${{ parameters.testResultsFormat }}'
Expand Down
2 changes: 2 additions & 0 deletions .idea/.idea.Lucene.Net/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 36 additions & 30 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,45 @@

<Import Project=".build/dependencies.props" Condition="Exists('.build/dependencies.props')" />

<!-- Features in .NET 6.x and .NET 7.x only -->
<PropertyGroup Condition=" $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) ">
<!-- Features in .NET 6.x, .NET 7.x, and .NET 8.x only -->
<PropertyGroup Condition=" $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) Or $(TargetFramework.StartsWith('net8.')) ">

<DefineConstants>$(DefineConstants);FEATURE_SPANFORMATTABLE</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_RANDOM_NEXTINT64_NEXTSINGLE</DefineConstants>

</PropertyGroup>

<!-- 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.')) ">
<!-- Features in .NET 5.x, .NET 6.x, .NET 7.x, and .NET 8.x only -->
<PropertyGroup Condition=" $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) Or $(TargetFramework.StartsWith('net8.')) ">

<DefineConstants>$(DefineConstants);FEATURE_ASPNETCORE_ENDPOINT_CONFIG</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_READONLYSET</DefineConstants>

</PropertyGroup>
<!-- 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.')) ">

<!-- Features in .NET Core 3.x, .NET 5.x, .NET 6.x, .NET 7.x, and .NET 8.x only -->
<PropertyGroup Condition=" $(TargetFramework.StartsWith('netcoreapp3.')) Or $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) Or $(TargetFramework.StartsWith('net8.')) ">

<DefineConstants>$(DefineConstants);FEATURE_ARGITERATOR</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_DICTIONARY_REMOVE_CONTINUEENUMERATION</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_PROCESS_KILL_ENTIREPROCESSTREE</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_STRING_CONCAT_READONLYSPAN</DefineConstants>

</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.')) Or $(TargetFramework.StartsWith('net7.')) ">

<!-- Features in .NET Standard, .NET Core, .NET 5.x, .NET 6.x, .NET 7.x, and .NET 8.x only (no .NET Framework support) -->
<PropertyGroup Condition=" $(TargetFramework.StartsWith('netstandard')) Or $(TargetFramework.StartsWith('netcoreapp')) Or $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) Or $(TargetFramework.StartsWith('net8.')) ">

<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_ARRAYEMPTY</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_CULTUREINFO_CURRENTCULTURE_SETTER</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_ENCODINGPROVIDERS</DefineConstants>

<DebugType>portable</DebugType>
</PropertyGroup>

<!-- 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.')) ">
<!-- Features in .NET Standard 2.1, .NET 5.x, .NET 6.x, .NET 7.x, and .NET 8.x only -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' Or $(TargetFramework.StartsWith('netcoreapp3.')) Or $(TargetFramework.StartsWith('net5.')) Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) Or $(TargetFramework.StartsWith('net8.')) ">

<DefineConstants>$(DefineConstants);FEATURE_ARRAY_FILL</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_CONDITIONALWEAKTABLE_ENUMERATOR</DefineConstants>
Expand All @@ -71,26 +71,32 @@

</PropertyGroup>

<!-- 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.')) ">
<!-- Features in .NET Standard 2.x, .NET Core 2.x, .NET Core 3.x, .NET 5.x, .NET 6.x, .NET 7.x, and .NET 8.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.')) Or $(TargetFramework.StartsWith('net8.')) ">

<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, .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.')) ">
<!-- Features in .NET Framework 4.5+, .NET Standard 2.x, .NET Core 2.x, .NET Core 3.x, .NET 5.x, .NET 6.x, .NET 7.x, and .NET 8.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.')) Or $(TargetFramework.StartsWith('net8.')) ">

<DefineConstants>$(DefineConstants);FEATURE_ASSEMBLY_GETCALLINGASSEMBLY</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_FILESTREAM_LOCK</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_SERIALIZABLE</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_SERIALIZABLE_EXCEPTIONS</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_TEXTWRITER_CLOSE</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_THREADPOOL_UNSAFEQUEUEWORKITEM</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_TYPE_GETMETHOD__BINDINGFLAGS_PARAMS</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, but deprecated or removed in .NET 7+ -->
<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.')) ">

<DefineConstants>$(DefineConstants);FEATURE_SERIALIZABLE</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_SERIALIZABLE_EXCEPTIONS</DefineConstants>

</PropertyGroup>

<!-- Features in .NET Framework 4.5+ and .NET Standard 2.x only (No .NET Core support) -->
<PropertyGroup Condition=" $(TargetFramework.StartsWith('net4')) Or $(TargetFramework.StartsWith('netstandard2.')) ">

Expand All @@ -102,14 +108,14 @@

<!-- Features in .NET Framework 4.6.1+ only -->
<PropertyGroup Condition="'$(TargetFramework)' == 'net461' Or '$(TargetFramework)' == 'net462' Or $(TargetFramework.StartsWith('net47')) Or $(TargetFramework.StartsWith('net48'))">

<DefineConstants>$(DefineConstants);FEATURE_ICONFIGURATIONROOT_PROVIDERS</DefineConstants>

</PropertyGroup>

<!-- Features in .NET Framework 4.6+ only -->
<PropertyGroup Condition="$(TargetFramework.StartsWith('net46')) Or $(TargetFramework.StartsWith('net47')) Or $(TargetFramework.StartsWith('net48'))">

<DefineConstants>$(DefineConstants);FEATURE_ARRAYEMPTY</DefineConstants>

</PropertyGroup>
Expand All @@ -125,21 +131,21 @@
<DefineConstants>$(DefineConstants);FEATURE_MEMORYMAPPEDFILESECURITY</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_STACKOVERFLOWEXCEPTION__ISCATCHABLE</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_TEXTWRITER_CREATEOBJREF</DefineConstants>

<DebugType>full</DebugType>
</PropertyGroup>

<!-- Features in .NET Framework 4.5+ and .NET 6.0+ but not in .NET Standard 2.0 or .NET Standard 2.1 -->
<!-- net461 is used to test .NET Standard 2.0, so we treat it like it is not part of this group -->
<PropertyGroup Condition=" ($(TargetFramework.StartsWith('net4')) And '$(TargetFramework)' != 'net461') Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.'))">
<PropertyGroup Condition=" ($(TargetFramework.StartsWith('net4')) And '$(TargetFramework)' != 'net461') Or $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) Or $(TargetFramework.StartsWith('net8.')) ">

<DefineConstants>$(DefineConstants);FEATURE_OPENNLP</DefineConstants>

</PropertyGroup>


<PropertyGroup>
<!-- NuGet.org only supports portable debug symbol format:
<!-- NuGet.org only supports portable debug symbol format:
https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg#nugetorg-symbol-package-constraints -->
<DebugType Condition=" '$(PortableDebugTypeOnly)' == 'true' ">portable</DebugType>
</PropertyGroup>
Expand Down Expand Up @@ -183,13 +189,13 @@
</ItemGroup>
</Target>


<!-- Global PackageReferences -->
<ItemGroup>
<!-- This is to allow the .NET Framework references to be machine-indepenedent so builds can happen without installing prerequisites -->
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="$(MicrosoftNETFrameworkReferenceAssembliesPackageReferenceVersion)" PrivateAssets="All" />
</ItemGroup>

<!-- This is for testing only, we use SourceLink from any Azure DevOps git repo -->
<ItemGroup Condition=" '$(BUILD_REPOSITORY_PROVIDER)' == 'TfsGit' " Label="SourceLink Packages (experimental Azure Repos)">
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="$(MicrosoftSourceLinkAzureReposGitPackageReferenceVersion)" PrivateAssets="All"/>
Expand All @@ -201,4 +207,4 @@

<Import Project=".build/release.targets" Condition="Exists('.build/release.targets')" />

</Project>
</Project>
15 changes: 8 additions & 7 deletions TestTargetFramework.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,23 @@
<!--<TargetFramework>net48</TargetFramework>-->
<!--<TargetFramework>net5.0</TargetFramework>-->
<!--<TargetFramework>net6.0</TargetFramework>-->
<TargetFramework>net7.0</TargetFramework>
<!--<TargetFramework>net7.0</TargetFramework>-->
<TargetFramework>net8.0</TargetFramework>

<!-- Allow the build script to pass in the test frameworks to build for.
This overrides the above TargetFramework setting.
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 -->

<!-- Test Client to DLL target works as follows:
Test Client | Target Under Test
net7.0 | net6.0
net8.0 | net6.0
net6.0 | net6.0
net5.0 | netstandard2.1
net48 | net462
net461 | netstandard2.0
-->
<TargetFrameworks Condition=" '$(TestFrameworks)' == 'true' ">net7.0;net6.0;net5.0</TargetFrameworks>

<TargetFrameworks Condition=" '$(TestFrameworks)' == 'true' ">net8.0;net6.0;net5.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(TestFrameworks)' == 'true' AND $([MSBuild]::IsOsPlatform('Windows')) ">$(TargetFrameworks);net48;net461</TargetFrameworks>
<TargetFramework Condition=" '$(TargetFrameworks)' != '' "></TargetFramework>
</PropertyGroup>
Expand All @@ -66,7 +67,7 @@
<PropertyGroup Label="Warnings to be Disabled in Test Projects">
<!-- We purposely test on EoL frameworks for testing netstandard2.1, but we want to keep this warning in production code. -->
<CheckEolTargetFramework>false</CheckEolTargetFramework>

<NoWarn Label="Nested types should not be visible">$(NoWarn);CA1034</NoWarn>
<NoWarn Label="Use Literals Where Appropriate">$(NoWarn);CA1802</NoWarn>
<NoWarn Label="Do not ignore method results">$(NoWarn);CA1806</NoWarn>
Expand All @@ -90,5 +91,5 @@
<!-- SonarCloud issues -->
<NoWarn Label="Add at least one assertion to this test case">$(NoWarn);S2699</NoWarn>
</PropertyGroup>

</Project>

0 comments on commit 743aea0

Please sign in to comment.