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

remove netstandard1.6 replace with netstandard2.0 #202

Merged
merged 3 commits into from
Aug 1, 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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Breaking
Copy link
Member

@ermshiperete ermshiperete Aug 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(After the fact: this should be ### Removed)


- Removed support for [netstandard1.6](https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-1-6#select-net-standard-version)
- Removed Icu.SortKey class which was only in the netstandard1.6 version of the dll

### Added

- Added support for netstandard2.0

### Fixed

- Fixed a bug when using a library compiled against icu-dotnet netstandard1.6, when your project referenced a different version of icu-dotnet


## [2.10.0] - 2024-06-17

### Added
Expand Down
2 changes: 1 addition & 1 deletion source/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net40;net451;netstandard1.6;net8.0</TargetFrameworks>
<TargetFrameworks>net40;net451;netstandard2.0;net8.0</TargetFrameworks>
<PlatformAlias>netstandard</PlatformAlias>
<OutputPath>$(MSBuildThisFileDirectory)\..\output\$(Configuration)</OutputPath>
<PackageOutputPath>$(MSBuildThisFileDirectory)\..\output</PackageOutputPath>
Expand Down
2 changes: 1 addition & 1 deletion source/icu.net.tests/SetUpFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private static bool IsWindows
{
// See Icu.Platform. Unfortunately that's internal, so we can't use it.

#if !NETSTANDARD1_6 && !NET
#if NETFRAMEWORK
// See http://www.mono-project.com/docs/faq/technical/#how-to-detect-the-execution-platform
switch ((int)Environment.OSVersion.Platform)
{
Expand Down
11 changes: 1 addition & 10 deletions source/icu.net/Collation/Collator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ namespace Icu.Collation
/// You use this class to build searching and sorting routines for natural
/// language text.
/// </summary>
public abstract class Collator : IComparer<string>, IDisposable
#if FEATURE_ICLONEABLE
, ICloneable
#endif
public abstract class Collator : IComparer<string>, IDisposable, ICloneable
{
/// <summary>
/// Gets or sets the minimum strength that will be used in comparison
Expand Down Expand Up @@ -194,18 +191,13 @@ static public SortKey CreateSortKey(string originalString, byte[] keyData, int k

var options = CompareOptions.None;

#if NETSTANDARD1_6
var sortKey = new SortKey(CultureInfo.InvariantCulture.Name, originalString, options, keyData);
#else
var sortKey = CultureInfo.InvariantCulture.CompareInfo.GetSortKey(string.Empty, options);
SetInternalOriginalStringField(sortKey, originalString);
SetInternalKeyDataField(sortKey, keyData, keyDataLength);
#endif

return sortKey;
}

#if !NETSTANDARD1_6
private static void SetInternalKeyDataField(SortKey sortKey, byte[] keyData, int keyDataLength)
{
var keyDataCopy = new byte[keyDataLength];
Expand Down Expand Up @@ -275,7 +267,6 @@ private static bool IsRunningOnMono()
{
return Type.GetType("Mono.Runtime") != null;
}
#endif

/// <summary>
/// Simple class to allow passing collation error info back to the caller of CheckRules.
Expand Down
7 changes: 2 additions & 5 deletions source/icu.net/Collation/RuleBasedCollator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
#if NETSTANDARD1_6
using Icu;
#else
using System.Globalization;
using System.Runtime.ConstrainedExecution;
#endif


namespace Icu.Collation
{
Expand All @@ -30,7 +27,7 @@ public SafeRuleBasedCollatorHandle() :
/// true if the handle is released successfully; otherwise, in the event of a catastrophic failure, false.
/// In this case, it generates a ReleaseHandleFailed Managed Debugging Assistant.
///</returns>
#if !NETSTANDARD1_6 && !NET
#if NETFRAMEWORK
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
protected override bool ReleaseHandle()
Expand Down
5 changes: 1 addition & 4 deletions source/icu.net/Locale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ namespace Icu
/// <summary>
/// A Locale object represents a specific geographical, political, or cultural region.
/// </summary>
public class Locale
#if FEATURE_ICLONEABLE
: ICloneable
#endif
public class Locale : ICloneable
{
/// <summary>
/// Construct a default locale object, a Locale for the default locale ID
Expand Down
14 changes: 1 addition & 13 deletions source/icu.net/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,7 @@ internal static class Platform
public const string x64 = nameof(x64);
public const string x86 = nameof(x86);

public static string ProcessArchitecture
{
get {

#if NET || NETSTANDARD
// Workaround described here since the API does not exist:
// https://github.com/dotnet/corefx/issues/999#issuecomment-75907756
return IntPtr.Size == 4 ? x86 : x64;
#else
return Environment.Is64BitProcess ? x64 : x86;
#endif
}
}
public static string ProcessArchitecture => Environment.Is64BitProcess ? x64 : x86;

public static OperatingSystemType OperatingSystem
{
Expand Down
6 changes: 2 additions & 4 deletions source/icu.net/SafeEnumeratorHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)
using System;
using System.Runtime.InteropServices;

#if !NETSTANDARD1_6
using System.Runtime.ConstrainedExecution;
#endif


namespace Icu
{
Expand All @@ -23,7 +21,7 @@ public SafeEnumeratorHandle() : base(IntPtr.Zero, true)
/// failure, false. In this case, it generates a ReleaseHandleFailed Managed Debugging
/// Assistant.
///</returns>
#if !NETSTANDARD1_6 && !NET
hahn-kev marked this conversation as resolved.
Show resolved Hide resolved
#if NETFRAMEWORK
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
protected override bool ReleaseHandle()
Expand Down
140 changes: 0 additions & 140 deletions source/icu.net/SortKey.cs

This file was deleted.

18 changes: 0 additions & 18 deletions source/icu.net/icu.net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,17 @@
<Description>icu.net is a C# Wrapper around ICU4C</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<!-- Full .NET Framework properties -->
<PropertyGroup Condition="'$(TargetFramework)' != 'netstandard1.6'">
<DefineConstants>$(DefineConstants);FEATURE_ICLONEABLE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3" PrivateAssets="all" />
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
<PackageReference Include="SIL.ReleaseTasks" Version="2.5.0" PrivateAssets="all" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.6'">
<!--System.ValueTuple v4.5 caused MSB3277 when consuming LibChorus in LibTriboroughBridge-ChorusPlugin -->
<!-- The reason is that .NET Standard comes with System.ValueTuple AssemblyVersion 4.0.2 -->
<!-- which corresponds to package version 4.4.0 -->
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
<PackageReference Include="System.Diagnostics.TraceSource" Version="4.3.0" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard1.6'">
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net40'">
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.0.4" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'netstandard1.6'">
<Compile Remove="SortKey.cs" />
</ItemGroup>

<!-- ICU must be installed using MacPorts before this will work -->
<ItemGroup>
<Content Include="/opt/local/lib/*.dylib" Condition="$([MSBuild]::IsOSPlatform('OSX'))">
Expand Down
Loading