Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target .NET 8, #928 #982

Merged
merged 4 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .build/runbuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ task Init -depends CheckSDK, UpdateLocalSDKVersion -description "This task makes
Write-Host "Powershell Version: $($PSVersionTable.PSVersion)"

Ensure-Directory-Exists "$artifactsDirectory"
Ensure-Directory-Exists "$nugetPackageDirectory" # helpful when adding this path to your nuget sources for local installs
}

task Restore -description "This task restores the dependencies" {
Expand Down
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

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

</PropertyGroup>

Expand Down
5 changes: 3 additions & 2 deletions TestTargetFramework.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<Project>

<PropertyGroup>
<!-- Changing this setting will allow testing on all target frameworks within Visual Studio 2019.
<!-- Changing this setting will allow testing on all target frameworks within Visual Studio.
Note that the main libraries are multi-targeted, so this has no effect on how they are compiled,
this setting only affects the test projects. -->
<!--<TargetFramework>net472</TargetFramework>-->
Expand All @@ -38,7 +38,7 @@

<!-- Test Client to DLL target works as follows:
Test Client | Target Under Test
net8.0 | net6.0
net8.0 | net8.0
net6.0 | net6.0
net5.0 | netstandard2.1
net48 | net462
Expand Down Expand Up @@ -67,6 +67,7 @@

<!-- We purposely test on EoL frameworks for testing netstandard2.1, but we want to keep this warning in production code. -->
<CheckEolTargetFramework Condition=" '$(TargetFramework)' == 'net5.0' ">false</CheckEolTargetFramework>
<SuppressTfmSupportBuildWarnings Condition=" '$(TargetFramework)' == 'net5.0' ">true</SuppressTfmSupportBuildWarnings>

<NoWarn Label="Nested types should not be visible">$(NoWarn);CA1034</NoWarn>
<NoWarn Label="Use Literals Where Appropriate">$(NoWarn);CA1802</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Lucene version compatibility level 4.10.4
using J2N;
using J2N.Collections.Generic.Extensions;
using J2N.Numerics;
using J2N.Text;
using Lucene.Net.Diagnostics;
Expand Down Expand Up @@ -726,11 +725,11 @@ internal static string GetDictionaryEncoding(Stream affix)
internal static readonly IDictionary<string, string> CHARSET_ALIASES = LoadCharsetAliases();
private static IDictionary<string, string> LoadCharsetAliases() // LUCENENET: Avoid static constructors (see https://github.com/apache/lucenenet/pull/224#issuecomment-469284006)
{
return new Dictionary<string, string>
return Collections.AsReadOnly(new Dictionary<string, string>
{
["microsoft-cp1251"] = "windows-1251",
["TIS620-2533"] = "TIS-620"
}.AsReadOnly();
});
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Lucene version compatibility level 4.8.1
using J2N.Collections.Generic.Extensions;
using Lucene.Net.Analysis.Core;
using Lucene.Net.Support;
using Lucene.Net.Util;
Expand Down Expand Up @@ -38,7 +37,7 @@ namespace Lucene.Net.Analysis.Util
/// The typical lifecycle for a factory consumer is:
/// <list type="bullet">
/// <item><description>Create factory via its constructor (or via XXXFactory.ForName)</description></item>
/// <item><description>(Optional) If the factory uses resources such as files,
/// <item><description>(Optional) If the factory uses resources such as files,
/// <see cref="IResourceLoaderAware.Inform(IResourceLoader)"/> is called to initialize those resources.</description></item>
/// <item><description>Consumer calls create() to obtain instances.</description></item>
/// </list>
Expand All @@ -62,7 +61,7 @@ public abstract class AbstractAnalysisFactory
protected AbstractAnalysisFactory(IDictionary<string, string> args)
{
IsExplicitLuceneMatchVersion = false;
originalArgs = args.AsReadOnly();
originalArgs = Collections.AsReadOnly(args);
string version = Get(args, LUCENE_MATCH_VERSION_PARAM);
// LUCENENET TODO: What should we do if the version is null?
//luceneMatchVersion = version is null ? (LuceneVersion?)null : LuceneVersionHelpers.ParseLeniently(version);
Expand All @@ -79,7 +78,7 @@ protected AbstractAnalysisFactory(IDictionary<string, string> args)
/// <summary>
/// this method can be called in the <see cref="TokenizerFactory.Create(TextReader)"/>
/// or <see cref="TokenFilterFactory.Create(TokenStream)"/> methods,
/// to inform user, that for this factory a <see cref="m_luceneMatchVersion"/> is required
/// to inform user, that for this factory a <see cref="m_luceneMatchVersion"/> is required
/// </summary>
[SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "By design")]
protected void AssureMatchVersion() // LUCENENET TODO: Remove this method (not used anyway in .NET)
Expand Down Expand Up @@ -296,7 +295,7 @@ public virtual ISet<string> GetSet(IDictionary<string, string> args, string name
}

/// <summary>
/// Compiles a pattern for the value of the specified argument key <paramref name="name"/>
/// Compiles a pattern for the value of the specified argument key <paramref name="name"/>
/// </summary>
protected Regex GetPattern(IDictionary<string, string> args, string name)
{
Expand Down Expand Up @@ -372,7 +371,7 @@ protected IList<string> GetLines(IResourceLoader loader, string resource)

/// <summary>
/// Same as <see cref="GetWordSet(IResourceLoader, string, bool)"/>,
/// except the input is in snowball format.
/// except the input is in snowball format.
/// </summary>
protected CharArraySet GetSnowballWordSet(IResourceLoader loader, string wordFiles, bool ignoreCase)
{
Expand Down Expand Up @@ -428,7 +427,7 @@ private static class SplitFileNameHolder

private const string CLASS_NAME = "class";

/// <returns> the string used to specify the concrete class name in a serialized representation: the class arg.
/// <returns> the string used to specify the concrete class name in a serialized representation: the class arg.
/// If the concrete class name was not specified via a class arg, returns <c>GetType().Name</c>. </returns>
public virtual string GetClassArg()
{
Expand All @@ -445,4 +444,4 @@ public virtual string GetClassArg()

public virtual bool IsExplicitLuceneMatchVersion { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Lucene version compatibility level 4.8.1
using J2N.Collections.Generic.Extensions;
using Lucene.Net.Support;
using Lucene.Net.Support.Threading;
using Lucene.Net.Util;
Expand Down Expand Up @@ -98,7 +97,7 @@ public void Reload()
services.Add(name, service);
}
}
this.services = services.AsReadOnly();
this.services = Collections.AsReadOnly(services);
}
finally
{
Expand Down Expand Up @@ -136,4 +135,4 @@ public Type LookupClass(string name)

public ICollection<string> AvailableServices => services.Keys;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
<Description>Analyzers for indexing content in different languages and domains for the Lucene.NET full-text search engine library from The Apache Software Foundation.</Description>
<PackageDocumentationRelativeUrl>analysis-common/overview.html</PackageDocumentationRelativeUrl>
</PropertyGroup>

<Import Project="$(SolutionDir).build/nuget.props" />

<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>

<AssemblyTitle>Lucene.Net.Analysis.Common</AssemblyTitle>
<PackageTags>$(PackageTags);analysis</PackageTags>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<NoWarn>$(NoWarn);1591;1573</NoWarn>
</PropertyGroup>



<ItemGroup>
<EmbeddedResource Include="**/*.rslp" Exclude="bin/**/*;obj/**/*" Label="RSLP Test Data" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
</PropertyGroup>

<Import Project="$(SolutionDir).build/nuget.props" />

<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>

<AssemblyTitle>Lucene.Net.Analysis.Kuromoji</AssemblyTitle>
<PackageTags>$(PackageTags);analysis;japanese</PackageTags>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<NoWarn>$(NoWarn);1591;1573</NoWarn>
</PropertyGroup>



<ItemGroup>
<EmbeddedResource Include="**/*.txt" Exclude="bin/**/*;obj/**/*" Label="Text Test Data" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
<Description>Analyzer for dictionary stemming, built-in Polish dictionary for the Lucene.NET full-text search engine library from The Apache Software Foundation.</Description>
<PackageDocumentationRelativeUrl>analysis-morfologik/Lucene.Net.Analysis.Morfologik.html</PackageDocumentationRelativeUrl>
</PropertyGroup>

<Import Project="$(SolutionDir).build/nuget.props" />

<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>

<AssemblyTitle>Lucene.Net.Analysis.Morfologik</AssemblyTitle>
<RootNamespace>Lucene.Net.Analysis</RootNamespace>
Expand All @@ -39,7 +39,7 @@
<NoWarn>$(NoWarn);1591;1573</NoWarn>
</PropertyGroup>



<ItemGroup>
<Compile Remove="Properties\AssemblyInfo.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<PropertyGroup>
<!-- Currently, IKVM doesn't officially support building NetFX on anything but Windows, so we skip it for contributors who may be on various platforms.
We can remove the condition once that has been addressed. See: https://github.com/ikvmnet/ikvm-maven/issues/49 -->
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(TargetFrameworks);net472</TargetFrameworks>

<AssemblyTitle>Lucene.Net.Analysis.OpenNLP</AssemblyTitle>
Expand Down
4 changes: 2 additions & 2 deletions src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// commons-codec version compatibility level: 1.9
using J2N;
using J2N.Collections.Generic.Extensions;
using J2N.Text;
using Lucene.Net.Support;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -218,7 +218,7 @@ public static Lang LoadFromResource(string languageRulesResourceName, Languages

private Lang(IList<LangRule> rules, Languages languages)
{
this.rules = rules.AsReadOnly();
this.rules = Collections.AsReadOnly(rules);
this.languages = languages;
}

Expand Down
11 changes: 5 additions & 6 deletions src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// commons-codec version compatibility level: 1.9
using J2N;
using J2N.Collections.Generic.Extensions;
using J2N.Text;
using Lucene.Net.Support;
using Lucene.Net.Util;
Expand Down Expand Up @@ -150,10 +149,10 @@ private static IDictionary<NameType, IDictionary<RuleType, IDictionary<string, I
rs["common"] = ParseRules(CreateScanner(s, rt, "common"), CreateResourceName(s, rt, "common"));
}

rts[rt] = rs.AsReadOnly();
rts[rt] = Collections.AsReadOnly(rs);
}

rules[s] = rts.AsReadOnly();
rules[s] = Collections.AsReadOnly(rts);
}
return rules;
}
Expand Down Expand Up @@ -217,7 +216,7 @@ private static TextReader CreateScanner(NameType nameType, RuleType rt, string l

private static TextReader CreateScanner(string lang)
{
string resName = string.Format("{0}.txt", lang);
string resName = string.Format("{0}.txt", lang);
Stream rulesIS = typeof(Languages).FindAndGetManifestResourceStream(resName);

if (rulesIS is null)
Expand Down Expand Up @@ -869,7 +868,7 @@ public virtual bool PatternAndContextMatches(ICharSequence input, int i)
/// <param name="i">The int position within the input.</param>
/// <returns><c>true</c> if the pattern and left/right context match, <c>false</c> otherwise.</returns>
// LUCENENET specific
public virtual bool PatternAndContextMatches(string input, int i)
public virtual bool PatternAndContextMatches(string input, int i)
{
if (i < 0)
{
Expand Down Expand Up @@ -940,7 +939,7 @@ public virtual bool PatternAndContextMatches(StringBuilder input, int i)

public sealed class Phoneme : IPhonemeExpr
{
// LUCENENET: It is no longer good practice to use binary serialization.
// LUCENENET: It is no longer good practice to use binary serialization.
// See: https://github.com/dotnet/corefx/issues/23584#issuecomment-325724568
#if FEATURE_SERIALIZABLE
[Serializable]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
<Import Project="$(SolutionDir).build/nuget.props" />

<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>

<AssemblyTitle>Lucene.Net.Analysis.Phonetic</AssemblyTitle>
<PackageTags>$(PackageTags);analysis;soundex;double;metaphone;sounds;like;beider;morse;cologne;caverphone;nysiis;match;rating</PackageTags>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<NoWarn>$(NoWarn);1591;1573</NoWarn>
</PropertyGroup>



<ItemGroup>
<EmbeddedResource Include="Language\*.txt" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
</PropertyGroup>

<Import Project="$(SolutionDir).build/nuget.props" />

<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>

<AssemblyTitle>Lucene.Net.Analysis.SmartCn</AssemblyTitle>
<PackageTags>$(PackageTags);analysis;chinese;smart</PackageTags>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<NoWarn>$(NoWarn);1591;1573</NoWarn>
</PropertyGroup>



<ItemGroup>
<EmbeddedResource Include="Hhmm/*.mem" Label="Dict Test Data" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
</PropertyGroup>

<Import Project="$(SolutionDir).build/nuget.props" />

<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>

<AssemblyTitle>Lucene.Net.Analysis.Stempel</AssemblyTitle>
<PackageTags>$(PackageTags);analysis;polish</PackageTags>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<NoWarn>$(NoWarn);1591;1573</NoWarn>
</PropertyGroup>



<ItemGroup>
<EmbeddedResource Include="Pl\*.tbl;Pl\*.txt" />
Expand Down
6 changes: 3 additions & 3 deletions src/Lucene.Net.Benchmark/Lucene.Net.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
<Description>System for benchmarking the Lucene.NET full-text search engine library from The Apache Software Foundation.</Description>
<PackageDocumentationRelativeUrl>benchmark/Lucene.Net.Benchmarks.html</PackageDocumentationRelativeUrl>
</PropertyGroup>

<Import Project="$(SolutionDir).build/nuget.props" />

<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>

<AssemblyTitle>Lucene.Net.Benchmark</AssemblyTitle>
<PackageTags>$(PackageTags);benchmark</PackageTags>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<NoWarn>$(NoWarn);1591;1573</NoWarn>
</PropertyGroup>



<ItemGroup>
<ProjectReference Include="..\dotnet\Lucene.Net.ICU\Lucene.Net.ICU.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
</PropertyGroup>

<Import Project="$(SolutionDir).build/nuget.props" />

<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>

<AssemblyTitle>Lucene.Net.Classification</AssemblyTitle>
<PackageTags>$(PackageTags);classification</PackageTags>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
<NoWarn>$(NoWarn);1591;1573</NoWarn>
</PropertyGroup>



<ItemGroup>
<ProjectReference Include="..\Lucene.Net\Lucene.Net.csproj" />
Expand Down
Loading
Loading