From 743aea0eb218fc07a025e74f483b741a471413c5 Mon Sep 17 00:00:00 2001 From: Paul Irwin Date: Tue, 12 Mar 2024 21:32:24 -0600 Subject: [PATCH] Upgrade tests and CLI to .NET 8, fix benchmark formatting issue --- ...publish-test-results-for-test-projects.yml | 12 ++-- .idea/.idea.Lucene.Net/.idea/.gitignore | 2 + Directory.Build.targets | 66 ++++++++++--------- TestTargetFramework.props | 15 +++-- azure-pipelines.yml | 40 +++++------ src/Lucene.Net.Analysis.OpenNLP/overview.md | 4 +- .../ByTask/Utils/Format.cs | 8 +-- .../Lucene.Net.Replicator.csproj | 4 +- .../Lucene.Net.Tests.AllProjects.csproj | 4 +- .../Lucene.Net.Tests.Analysis.OpenNLP.csproj | 6 +- .../Lucene.Net.Tests.Cli.csproj | 6 +- src/dotnet/tools/lucene-cli/.gitignore | 2 + src/dotnet/tools/lucene-cli/lucene-cli.csproj | 8 +-- 13 files changed, 94 insertions(+), 83 deletions(-) create mode 100644 src/dotnet/tools/lucene-cli/.gitignore diff --git a/.build/azure-templates/publish-test-results-for-test-projects.yml b/.build/azure-templates/publish-test-results-for-test-projects.yml index 11ebac78fb..a113396c0e 100644 --- a/.build/azure-templates/publish-test-results-for-test-projects.yml +++ b/.build/azure-templates/publish-test-results-for-test-projects.yml @@ -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 @@ -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 }}' @@ -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 }}' diff --git a/.idea/.idea.Lucene.Net/.idea/.gitignore b/.idea/.idea.Lucene.Net/.idea/.gitignore index e4c6e33706..77961c0be9 100644 --- a/.idea/.idea.Lucene.Net/.idea/.gitignore +++ b/.idea/.idea.Lucene.Net/.idea/.gitignore @@ -11,3 +11,5 @@ # Datasource local storage ignored files /dataSources/ /dataSources.local.xml +# GitHub Copilot persisted chat sessions +/copilot/chatSessions diff --git a/Directory.Build.targets b/Directory.Build.targets index 042d188449..df4827092b 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -22,24 +22,24 @@ - - + + $(DefineConstants);FEATURE_SPANFORMATTABLE $(DefineConstants);FEATURE_RANDOM_NEXTINT64_NEXTSINGLE - - + + $(DefineConstants);FEATURE_ASPNETCORE_ENDPOINT_CONFIG $(DefineConstants);FEATURE_READONLYSET - - - + + + $(DefineConstants);FEATURE_ARGITERATOR $(DefineConstants);FEATURE_DICTIONARY_REMOVE_CONTINUEENUMERATION @@ -47,20 +47,20 @@ $(DefineConstants);FEATURE_STRING_CONCAT_READONLYSPAN - - - - + + + + $(DefineConstants);NETSTANDARD $(DefineConstants);FEATURE_ARRAYEMPTY $(DefineConstants);FEATURE_CULTUREINFO_CURRENTCULTURE_SETTER $(DefineConstants);FEATURE_ENCODINGPROVIDERS - + portable - - + + $(DefineConstants);FEATURE_ARRAY_FILL $(DefineConstants);FEATURE_CONDITIONALWEAKTABLE_ENUMERATOR @@ -71,26 +71,32 @@ - - + + $(DefineConstants);FEATURE_ICONFIGURATIONROOT_PROVIDERS - - + + $(DefineConstants);FEATURE_ASSEMBLY_GETCALLINGASSEMBLY $(DefineConstants);FEATURE_FILESTREAM_LOCK - $(DefineConstants);FEATURE_SERIALIZABLE - $(DefineConstants);FEATURE_SERIALIZABLE_EXCEPTIONS $(DefineConstants);FEATURE_TEXTWRITER_CLOSE $(DefineConstants);FEATURE_THREADPOOL_UNSAFEQUEUEWORKITEM $(DefineConstants);FEATURE_TYPE_GETMETHOD__BINDINGFLAGS_PARAMS + + + + $(DefineConstants);FEATURE_SERIALIZABLE + $(DefineConstants);FEATURE_SERIALIZABLE_EXCEPTIONS + + + @@ -102,14 +108,14 @@ - + $(DefineConstants);FEATURE_ICONFIGURATIONROOT_PROVIDERS - + - + $(DefineConstants);FEATURE_ARRAYEMPTY @@ -125,21 +131,21 @@ $(DefineConstants);FEATURE_MEMORYMAPPEDFILESECURITY $(DefineConstants);FEATURE_STACKOVERFLOWEXCEPTION__ISCATCHABLE $(DefineConstants);FEATURE_TEXTWRITER_CREATEOBJREF - + full - + $(DefineConstants);FEATURE_OPENNLP - + - portable @@ -183,13 +189,13 @@ - + - + @@ -201,4 +207,4 @@ - \ No newline at end of file + diff --git a/TestTargetFramework.props b/TestTargetFramework.props index ad02d3bf56..0e499e9667 100644 --- a/TestTargetFramework.props +++ b/TestTargetFramework.props @@ -30,22 +30,23 @@ - net7.0 + + net8.0 - - net7.0;net6.0;net5.0 + + net8.0;net6.0;net5.0 $(TargetFrameworks);net48;net461 @@ -66,7 +67,7 @@ false - + $(NoWarn);CA1034 $(NoWarn);CA1802 $(NoWarn);CA1806 @@ -90,5 +91,5 @@ $(NoWarn);S2699 - + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 513b30aca9..84de7f7162 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -63,7 +63,7 @@ variables: - name: WebsiteArtifactName value: 'website' - name: WebsiteArtifactZipFileName - value: 'website.zip' + value: 'website.zip' - name: BinaryArtifactName value: 'testbinaries' - name: NuGetArtifactName @@ -105,7 +105,7 @@ stages: PublishTempDirectory: '$(Build.ArtifactStagingDirectory)/publish' steps: - + - checkout: self # self represents the repo where the initial Pipelines YAML file was found fetchDepth: '1' # the depth of commits to ask Git to fetch @@ -144,7 +144,7 @@ stages: displayName: 'PSake Build, Pack, and Publish' #- template: '.build/azure-templates/show-all-environment-variables.yml' # Uncomment for debugging - + - pwsh: | $dir = '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)' if (!(Test-Path $dir)) { New-Item -ItemType Directory -Path "$dir" -Force } @@ -195,15 +195,15 @@ stages: version.props TargetFolder: '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)' condition: and(succeeded(), eq(variables['IsRelease'], 'true')) - + - task: PublishPipelineArtifact@1 displayName: 'Publish Artifact: $(VersionArtifactName)' inputs: targetPath: '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)' artifact: '$(VersionArtifactName)' publishLocation: 'pipeline' - - # Copy the .pdb files as build artifacts, which will + + # Copy the .pdb files as build artifacts, which will # later be used to push to the Azure Artifacts symbol server. - task: CopyFiles@2 displayName: 'Copy .pdb Files to: /$(DebugArtifactName)' @@ -220,7 +220,7 @@ stages: artifact: '$(NuGetArtifactName)' publishLocation: 'pipeline' condition: and(succeeded(), ne(variables['RunPack'], 'false')) - + - task: PublishPipelineArtifact@1 displayName: 'Publish Artifact: $(DebugArtifactName)' inputs: @@ -232,7 +232,7 @@ stages: - template: '.build/azure-templates/publish-test-binaries.yml' parameters: publishDirectory: $(PublishTempDirectory) - framework: 'net7.0' + framework: 'net8.0' binaryArtifactName: '$(BinaryArtifactName)' testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)' @@ -263,7 +263,7 @@ stages: framework: 'net48' binaryArtifactName: '$(BinaryArtifactName)' testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)' - + - job: Docs condition: and(succeeded(), eq(variables['GenerateDocs'], 'true')) pool: @@ -325,7 +325,7 @@ stages: displayName: 'Test Stage:' jobs: - - job: Test_net7_0_x64 + - job: Test_net8_0_x64 condition: and(succeeded(), ne(variables['RunTests'], 'false')) strategy: matrix: @@ -344,14 +344,14 @@ stages: imageName: 'macOS-latest' maximumParallelJobs: 7 maximumAllowedFailures: 0 # Maximum allowed failures for a successful build - displayName: 'Test net7.0,x64 on' + displayName: 'Test net8.0,x64 on' pool: vmImage: $(imageName) steps: - template: '.build/azure-templates/run-tests-on-os.yml' parameters: osName: $(osName) - framework: 'net7.0' + framework: 'net8.0' vsTestPlatform: 'x64' testBinariesArtifactName: '$(TestBinariesArtifactName)' nugetArtifactName: '$(NuGetArtifactName)' @@ -360,7 +360,7 @@ stages: maximumAllowedFailures: $(maximumAllowedFailures) dotNetSdkVersion: '$(DotNetSDKVersion)' - - job: Test_net7_0_x86 # Only run Nightly or if explicitly enabled with RunX86Tests + - job: Test_net8_0_x86 # Only run Nightly or if explicitly enabled with RunX86Tests condition: and(succeeded(), ne(variables['RunTests'], 'false'), or(eq(variables['IsNightly'], 'true'), eq(variables['RunX86Tests'], 'true'))) strategy: matrix: @@ -369,14 +369,14 @@ stages: imageName: 'windows-latest' maximumParallelJobs: 8 maximumAllowedFailures: 0 # Maximum allowed failures for a successful build - displayName: 'Test net7.0,x86 on' + displayName: 'Test net8.0,x86 on' pool: vmImage: $(imageName) steps: - template: '.build/azure-templates/run-tests-on-os.yml' parameters: osName: $(osName) - framework: 'net7.0' + framework: 'net8.0' vsTestPlatform: 'x86' testBinariesArtifactName: '$(TestBinariesArtifactName)' nugetArtifactName: '$(NuGetArtifactName)' @@ -617,7 +617,7 @@ stages: targetPath: '$(System.DefaultWorkingDirectory)/$(VersionArtifactName)' # For debugging this pipeline - #- pwsh: | + #- pwsh: | # Get-ChildItem -Path $(System.DefaultWorkingDirectory) # Get-ChildItem -Path '$(VersionArtifactName)' @@ -665,7 +665,7 @@ stages: inputs: artifactName: '$(VersionArtifactName)' targetPath: '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)' - + - template: '.build/azure-templates/show-all-files.yml' # Uncomment for debugging # NOTE: We are setting Build.BuildNumber here to the NuGet package version to work around the limitation that @@ -744,4 +744,4 @@ stages: inputs: targetPath: '$(Build.ArtifactStagingDirectory)/$(ReleaseArtifactName)' artifact: '$(ReleaseArtifactName)' - publishLocation: 'pipeline' \ No newline at end of file + publishLocation: 'pipeline' diff --git a/src/Lucene.Net.Analysis.OpenNLP/overview.md b/src/Lucene.Net.Analysis.OpenNLP/overview.md index 882ddff08c..1667c7f52e 100644 --- a/src/Lucene.Net.Analysis.OpenNLP/overview.md +++ b/src/Lucene.Net.Analysis.OpenNLP/overview.md @@ -57,7 +57,7 @@ Here's a basic outline of how you might extend an existing Lucene.NET analyzer t ```xml - net7.0 + net8.0 @@ -119,4 +119,4 @@ In the above example, `CustomOpenNLPAnalyzer` extends `OpenNLPTokenizerFactory` > [!NOTE] > IKVM (and ``) does not support Java SE higher than version 8. So it will not be possible to add a `` to OpenNLP 2.x until support is added for it in IKVM. -For a more complete example, see the [lucenenet-opennlp-mavenreference-demo](https://github.com/NightOwl888/lucenenet-opennlp-mavenreference-demo). \ No newline at end of file +For a more complete example, see the [lucenenet-opennlp-mavenreference-demo](https://github.com/NightOwl888/lucenenet-opennlp-mavenreference-demo). diff --git a/src/Lucene.Net.Benchmark/ByTask/Utils/Format.cs b/src/Lucene.Net.Benchmark/ByTask/Utils/Format.cs index e9903df490..4161488f76 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Utils/Format.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Utils/Format.cs @@ -25,15 +25,15 @@ namespace Lucene.Net.Benchmarks.ByTask.Utils public static class Formatter // LUCENENET specific - renamed from Format because of method name collision, CA1052 Static holder types should be Static or NotInheritable { private static readonly string[] numFormat = { - "N0", - "N1", - "N2" + "{0:N0}", + "{0:N1}", + "{0:N2}" }; private const string padd = " "; /// - /// Padd a number from left. + /// Pad a number from left. /// /// Number of digits in fraction part - must be 0 or 1 or 2. /// Number to be formatted. diff --git a/src/Lucene.Net.Replicator/Lucene.Net.Replicator.csproj b/src/Lucene.Net.Replicator/Lucene.Net.Replicator.csproj index d584846dd7..9d721ac034 100644 --- a/src/Lucene.Net.Replicator/Lucene.Net.Replicator.csproj +++ b/src/Lucene.Net.Replicator/Lucene.Net.Replicator.csproj @@ -28,7 +28,7 @@ - + net6.0;netstandard2.1;netstandard2.0;net462 @@ -38,7 +38,7 @@ $(NoWarn);1591;1573 - + diff --git a/src/Lucene.Net.Tests.AllProjects/Lucene.Net.Tests.AllProjects.csproj b/src/Lucene.Net.Tests.AllProjects/Lucene.Net.Tests.AllProjects.csproj index 92056ba0ab..8e92713782 100644 --- a/src/Lucene.Net.Tests.AllProjects/Lucene.Net.Tests.AllProjects.csproj +++ b/src/Lucene.Net.Tests.AllProjects/Lucene.Net.Tests.AllProjects.csproj @@ -33,7 +33,7 @@ - + $(SetTargetFramework) @@ -118,7 +118,7 @@ - + diff --git a/src/Lucene.Net.Tests.Analysis.OpenNLP/Lucene.Net.Tests.Analysis.OpenNLP.csproj b/src/Lucene.Net.Tests.Analysis.OpenNLP/Lucene.Net.Tests.Analysis.OpenNLP.csproj index d880584623..d68830caeb 100644 --- a/src/Lucene.Net.Tests.Analysis.OpenNLP/Lucene.Net.Tests.Analysis.OpenNLP.csproj +++ b/src/Lucene.Net.Tests.Analysis.OpenNLP/Lucene.Net.Tests.Analysis.OpenNLP.csproj @@ -25,9 +25,9 @@ - net7.0;net6.0 + net8.0;net6.0 $(TargetFrameworks);net48 - + Lucene.Net.Tests.Analysis.OpenNLP Lucene.Net.Analysis.OpenNlp @@ -37,7 +37,7 @@ false false - net7.0 + net8.0 net48 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 9e9a0105ae..012c8326ee 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 @@ -18,14 +18,14 @@ specific language governing permissions and limitations under the License. ---> +--> - net7.0;net6.0 + net8.0;net6.0 Lucene.Net.Tests.Cli @@ -34,7 +34,7 @@ false false - net7.0 + net8.0 diff --git a/src/dotnet/tools/lucene-cli/.gitignore b/src/dotnet/tools/lucene-cli/.gitignore new file mode 100644 index 0000000000..49fa42319a --- /dev/null +++ b/src/dotnet/tools/lucene-cli/.gitignore @@ -0,0 +1,2 @@ +work/ + diff --git a/src/dotnet/tools/lucene-cli/lucene-cli.csproj b/src/dotnet/tools/lucene-cli/lucene-cli.csproj index a648450719..21b398da86 100644 --- a/src/dotnet/tools/lucene-cli/lucene-cli.csproj +++ b/src/dotnet/tools/lucene-cli/lucene-cli.csproj @@ -24,14 +24,14 @@ - net7.0;net6.0 - Major + net8.0;net6.0 + Major true false true lucene - + lucene-cli Exe lucene-cli @@ -39,7 +39,7 @@ $(PackageTags);maintenance;utility readme.md bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - + $(NoWarn);1591;1573 $(NoWarn);CA1034 $(NoWarn);IDE0060