diff --git a/eng/testing/tests.ioslike.targets b/eng/testing/tests.ioslike.targets index 76b8b004b9f33..df77a1481fcc7 100644 --- a/eng/testing/tests.ioslike.targets +++ b/eng/testing/tests.ioslike.targets @@ -77,7 +77,7 @@ Include="@(AppleAssembliesToBundle)" TargetDir="extraFiles\%(AppleAssembliesToBundle.RecursiveDir)" /> - + + + true true true AppleTestRunner.dll diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 59c4999a0d777..107f750af7290 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -75,9 +75,9 @@ The .NET Foundation licenses this file to you under the MIT license. - - - + + + diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 3cad68e703b67..238aee9ccfd02 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -378,7 +378,7 @@ public static string GetDistroVersionString() public static bool IsIcuGlobalization => ICUVersion > new Version(0, 0, 0, 0); public static bool IsIcuGlobalizationAndNotHybridOnBrowser => IsIcuGlobalization && IsNotHybridGlobalizationOnBrowser; public static bool IsIcuGlobalizationAndNotHybrid => IsIcuGlobalization && IsNotHybridGlobalization; - public static bool IsNlsGlobalization => IsNotInvariantGlobalization && !IsIcuGlobalization; + public static bool IsNlsGlobalization => IsNotInvariantGlobalization && !IsIcuGlobalization && !IsHybridGlobalization; public static bool IsSubstAvailable { diff --git a/src/libraries/System.Collections.NonGeneric/tests/CaseInsensitiveComparerTests.cs b/src/libraries/System.Collections.NonGeneric/tests/CaseInsensitiveComparerTests.cs index 7974d075166b4..362a76fc3dc35 100644 --- a/src/libraries/System.Collections.NonGeneric/tests/CaseInsensitiveComparerTests.cs +++ b/src/libraries/System.Collections.NonGeneric/tests/CaseInsensitiveComparerTests.cs @@ -66,6 +66,7 @@ public void Ctor_CultureInfo_Compare(object a, object b, int expected) [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/37069", TestPlatforms.Android | TestPlatforms.LinuxBionic)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95338", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void Ctor_CultureInfo_Compare_TurkishI() { var cultureNames = Helpers.TestCultureNames; diff --git a/src/libraries/System.Collections.NonGeneric/tests/CaseInsensitiveHashCodeProviderTests.cs b/src/libraries/System.Collections.NonGeneric/tests/CaseInsensitiveHashCodeProviderTests.cs index 927dcb1b6b9e3..18b2e7421682c 100644 --- a/src/libraries/System.Collections.NonGeneric/tests/CaseInsensitiveHashCodeProviderTests.cs +++ b/src/libraries/System.Collections.NonGeneric/tests/CaseInsensitiveHashCodeProviderTests.cs @@ -96,6 +96,7 @@ public void Ctor_CultureInfo_ChangeCurrentCulture_GetHashCodeCompare(object a, o [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))] [ActiveIssue("https://github.com/dotnet/runtime/issues/37069", TestPlatforms.Android | TestPlatforms.LinuxBionic)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95338", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void Ctor_CultureInfo_GetHashCodeCompare_TurkishI() { var cultureNames = Helpers.TestCultureNames; @@ -152,6 +153,7 @@ public void Default_GetHashCodeCompare(object a, object b, bool expected) [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))] [ActiveIssue("https://github.com/dotnet/runtime/issues/37069", TestPlatforms.Android | TestPlatforms.LinuxBionic)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95338", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void Default_Compare_TurkishI() { // Turkish has lower-case and upper-case version of the dotted "i", so the upper case of "i" (U+0069) isn't "I" (U+0049) diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs index 7513730ee0416..1f8bdc8ba0253 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlDecimalTest.cs @@ -196,6 +196,7 @@ public void AdjustScale() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void ConvertToPrecScale() { Assert.Equal(new SqlDecimal(6464.6m).Value, SqlDecimal.ConvertToPrecScale(_test1, 5, 1).Value); diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringSortingTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringSortingTest.cs index 0cae8f7a40409..d6a17074d8d93 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringSortingTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringSortingTest.cs @@ -38,6 +38,7 @@ public static class SqlStringSortingTest private static readonly UnicodeEncoding s_unicodeEncoding = new UnicodeEncoding(bigEndian: false, byteOrderMark: false, throwOnInvalidBytes: true); [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] [InlineData("ja-JP", 0x0411)] // Japanese - Japan [InlineData("ar-SA", 0x0401)] // Arabic - Saudi Arabia [InlineData("de-DE", 0x0407)] // German - Germany diff --git a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs index 56f8fa51b06ca..1b79fdbe0fdd7 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/SqlTypes/SqlStringTest.cs @@ -56,6 +56,7 @@ public SqlStringTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void Constructor_Value_Success() { const string value = "foo"; @@ -219,6 +220,7 @@ public void CompareToSqlTypeException() } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void CompareTo() { Assert.True(_test1.CompareTo(_test3) < 0); @@ -259,6 +261,7 @@ public void CompareTo() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void EqualsMethods() { Assert.False(_test1.Equals(_test2)); @@ -275,6 +278,7 @@ public void EqualsMethods() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void Greaters() { // GreateThan () @@ -289,6 +293,7 @@ public void Greaters() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void Lessers() { // LessThan() @@ -304,6 +309,7 @@ public void Lessers() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void NotEquals() { Assert.True(SqlString.NotEquals(_test1, _test2).Value); @@ -314,6 +320,7 @@ public void NotEquals() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void Concat() { _test1 = new SqlString("First TestString"); @@ -325,6 +332,7 @@ public void Concat() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void Clone() { SqlString testSqlString = _test1.Clone(); @@ -344,6 +352,7 @@ public void CompareOptionsFromSqlCompareOptions() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void UnicodeBytes() { Assert.Equal((byte)105, _test1.GetNonUnicodeBytes()[1]); @@ -540,6 +549,7 @@ public void Conversions() // OPERATORS [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void ArithmeticOperators() { SqlString testString = new SqlString("...Testing..."); @@ -548,6 +558,7 @@ public void ArithmeticOperators() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void ThanOrEqualOperators() { // == -operator diff --git a/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.iOS.xml b/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.iOS.xml new file mode 100644 index 0000000000000..c000dde2dca0b --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.iOS.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index ec0fd93a48aef..7a2cbf5b43460 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -63,6 +63,7 @@ + diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs index 538e4b3551ca1..7d46be4685e0d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs @@ -1532,7 +1532,7 @@ private int GetSortKeyLengthCore(ReadOnlySpan source, CompareOptions optio NlsGetSortKeyLength(source, options) : #if TARGET_BROWSER GlobalizationMode.Hybrid ? - throw new PlatformNotSupportedException(GetPNSEText("SortKey")) : + throw new PlatformNotSupportedException(GetPNSEText("SortKey")) : #endif IcuGetSortKeyLength(source, options); diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs index 46850d3d090df..df937e56e34fe 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.Unix.cs @@ -12,6 +12,7 @@ private static partial class Settings /// the GlobalizationMode.Invariant check. Globalization P/Invokes, e.g. in CompareInfo.GetSortKey, /// rely on ICU already being loaded before they are called. /// +#if !TARGET_MACCATALYST && !TARGET_IOS && !TARGET_TVOS static Settings() { // Use GlobalizationMode.Invariant to allow ICU initialization to be trimmed when Invariant=true @@ -32,6 +33,7 @@ static Settings() } } } +#endif private static string GetIcuLoadFailureMessage() { diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.cs index a81023eedccc2..314bb33692dc7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.cs @@ -13,7 +13,9 @@ internal static partial class GlobalizationMode private static partial class Settings { internal static bool Invariant { get; } = AppContextConfigHelper.GetBooleanConfig("System.Globalization.Invariant", "DOTNET_SYSTEM_GLOBALIZATION_INVARIANT"); -#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS || TARGET_BROWSER +#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS + internal static bool Hybrid { get; } = true; +#elif TARGET_BROWSER internal static bool Hybrid { get; } = AppContextConfigHelper.GetBooleanConfig("System.Globalization.Hybrid", "DOTNET_SYSTEM_GLOBALIZATION_HYBRID"); #endif internal static bool PredefinedCulturesOnly { get; } = AppContextConfigHelper.GetBooleanConfig("System.Globalization.PredefinedCulturesOnly", "DOTNET_SYSTEM_GLOBALIZATION_PREDEFINED_CULTURES_ONLY", GlobalizationMode.Invariant); diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/GetStringComparerTests.cs b/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/GetStringComparerTests.cs index 1f2dc7714adc5..17801793edd56 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/GetStringComparerTests.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/GetStringComparerTests.cs @@ -20,6 +20,7 @@ public void GetStringComparer_Invalid() } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95338", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] [InlineData("hello", "hello", "fr-FR", CompareOptions.IgnoreCase, 0, 0)] [InlineData("hello", "HELLo", "fr-FR", CompareOptions.IgnoreCase, 0, 0)] [InlineData("hello", null, "fr-FR", CompareOptions.IgnoreCase, 1, 1)] diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/IdnMapping/Data/Factory.cs b/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/IdnMapping/Data/Factory.cs index 58a727143b2d9..05018f6ca7476 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/IdnMapping/Data/Factory.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/IdnMapping/Data/Factory.cs @@ -26,7 +26,7 @@ private static string RemoveComment(string line) private static Stream GetIdnaTestTxt() { string fileName = null; - if (PlatformDetection.ICUVersion >= new Version(66, 0)) + if (PlatformDetection.ICUVersion >= new Version(66, 0) || PlatformDetection.IsHybridGlobalizationOnOSX) fileName = "IdnaTest_13.txt"; else if (PlatformDetection.IsWindows7) fileName = "IdnaTest_Win7.txt"; @@ -61,7 +61,7 @@ private static IEnumerable ParseFile(Stream stream, Func= new Version(66, 0)) + if (PlatformDetection.ICUVersion >= new Version(66, 0) || PlatformDetection.IsHybridGlobalizationOnOSX) return new Unicode_13_0_IdnaTest(line, lineCount); else if (PlatformDetection.IsWindows7) return new Unicode_Win7_IdnaTest(line, lineCount); @@ -88,7 +88,7 @@ public static IEnumerable GetDataset() { // Nls is transitional so we filter out non transitional test cases. // Icu is the opposite. - IdnType idnFilter = PlatformDetection.IsNlsGlobalization ? IdnType.Nontransitional : IdnType.Transitional; + IdnType idnFilter = PlatformDetection.IsNlsGlobalization || PlatformDetection.IsHybridGlobalizationOnOSX ? IdnType.Nontransitional : IdnType.Transitional; foreach (var entry in ParseFile(GetIdnaTestTxt(), GetConformanceIdnaTest)) { if (entry.Type != idnFilter && entry.Source != string.Empty) diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/IdnMapping/IdnMappingGetAsciiTests.cs b/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/IdnMapping/IdnMappingGetAsciiTests.cs index 595b005c96d91..3ad3339754359 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/IdnMapping/IdnMappingGetAsciiTests.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/IdnMapping/IdnMappingGetAsciiTests.cs @@ -21,7 +21,7 @@ public static IEnumerable GetAscii_TestData() } string ascii = c.ToString(); - if (!PlatformDetection.IsIcuGlobalization || c != '-') // expected platform differences, see https://github.com/dotnet/runtime/issues/17190 + if ((!PlatformDetection.IsIcuGlobalization && !PlatformDetection.IsHybridGlobalizationOnOSX) || c != '-') // expected platform differences, see https://github.com/dotnet/runtime/issues/17190 { yield return new object[] { ascii, 0, 1, ascii }; } diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/IdnMapping/IdnMappingUseStd3AsciiRulesTests.cs b/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/IdnMapping/IdnMappingUseStd3AsciiRulesTests.cs index 481865437c16c..2839086a0b2f8 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/IdnMapping/IdnMappingUseStd3AsciiRulesTests.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/IdnMapping/IdnMappingUseStd3AsciiRulesTests.cs @@ -49,7 +49,7 @@ public void UseStd3AsciiRules_ChangesGetAsciiBehavior(string unicode, bool conta var idnStd3False = new IdnMapping { UseStd3AsciiRules = false }; var idnStd3True = new IdnMapping { UseStd3AsciiRules = true }; - if (containsInvalidHyphen && PlatformDetection.IsIcuGlobalization) + if (containsInvalidHyphen && (PlatformDetection.IsIcuGlobalization || PlatformDetection.IsHybridGlobalizationOnOSX)) { // ICU always fails on leading/trailing hyphens regardless of the Std3 rules option. AssertExtensions.Throws("unicode", () => idnStd3False.GetAscii(unicode)); diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoTests.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoTests.cs index eacdfb0455a67..6e09c2f9e5eaa 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoTests.cs @@ -67,7 +67,7 @@ public void NativeCalendarName_Get_ReturnsExpected(DateTimeFormatInfo dtfi, Cale { dtfi.Calendar = calendar; - if (PlatformDetection.IsNotUsingLimitedCultures) + if (PlatformDetection.IsNotUsingLimitedCultures || PlatformDetection.IsHybridGlobalizationOnOSX) { // Mobile / Browser ICU doesn't contain NativeCalendarName, Assert.Equal(nativeCalendarName, dtfi.NativeCalendarName); diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyNameTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyNameTests.cs index a2bf600407298..3079f6f0129f6 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyNameTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyNameTests.cs @@ -222,6 +222,7 @@ public void CultureName_Set(AssemblyName assemblyName, string originalCultureNam } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95195", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void CultureName_Set_Invalid_ThrowsCultureNotFoundException() { var assemblyName = new AssemblyName("Test"); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Convert.ToDateTime.cs b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Convert.ToDateTime.cs index 33609a72ceb1f..245ccd8f3af4f 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Convert.ToDateTime.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Convert.ToDateTime.cs @@ -11,6 +11,7 @@ public class ConvertToDateTimeTests : ConvertTestBase private static readonly DateTimeFormatInfo s_dateTimeFormatInfo = new DateTimeFormatInfo(); [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95338", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] public void FromString() { DateTime[] expectedValues = { new DateTime(1999, 12, 31, 23, 59, 59), new DateTime(100, 1, 1, 0, 0, 0), new DateTime(2216, 2, 29, 0, 0, 0), new DateTime(1, 1, 1, 0, 0, 0) }; diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/StringComparer.cs b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/StringComparer.cs index 79f1116340e89..ec855aca2d884 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/StringComparer.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/StringComparer.cs @@ -179,15 +179,18 @@ public static IEnumerable CreateFromCultureAndOptionsData() yield return new object[] { "turky i", "TURKY \u0130", "tr-TR", CompareOptions.IgnoreCase, true}; } - bool ignoreSymbolsIgnoresOnlyPunctuation = PlatformDetection.IsHybridGlobalizationOnBrowser; - yield return new object[] { "abcd", "ab cd", "en-US", CompareOptions.IgnoreSymbols, true }; - yield return new object[] { "abcd", "ab+cd", "en-US", CompareOptions.IgnoreSymbols, !ignoreSymbolsIgnoresOnlyPunctuation }; - yield return new object[] { "abcd", "ab%cd", "en-US", CompareOptions.IgnoreSymbols, true }; - yield return new object[] { "abcd", "ab&cd", "en-US", CompareOptions.IgnoreSymbols, true }; - yield return new object[] { "abcd", "ab$cd", "en-US", CompareOptions.IgnoreSymbols, !ignoreSymbolsIgnoresOnlyPunctuation }; - yield return new object[] { "a-bcd", "ab$cd", "en-US", CompareOptions.IgnoreSymbols, true }; - yield return new object[] { "abcd*", "ab$cd", "en-US", CompareOptions.IgnoreSymbols, true }; - yield return new object[] { "ab$dd", "ab$cd", "en-US", CompareOptions.IgnoreSymbols, false }; + if (PlatformDetection.IsNotHybridGlobalizationOnOSX) + { + bool ignoreSymbolsIgnoresOnlyPunctuation = PlatformDetection.IsHybridGlobalizationOnBrowser; + yield return new object[] { "abcd", "ab cd", "en-US", CompareOptions.IgnoreSymbols, true }; + yield return new object[] { "abcd", "ab+cd", "en-US", CompareOptions.IgnoreSymbols, !ignoreSymbolsIgnoresOnlyPunctuation }; + yield return new object[] { "abcd", "ab%cd", "en-US", CompareOptions.IgnoreSymbols, true }; + yield return new object[] { "abcd", "ab&cd", "en-US", CompareOptions.IgnoreSymbols, true }; + yield return new object[] { "abcd", "ab$cd", "en-US", CompareOptions.IgnoreSymbols, !ignoreSymbolsIgnoresOnlyPunctuation }; + yield return new object[] { "a-bcd", "ab$cd", "en-US", CompareOptions.IgnoreSymbols, true }; + yield return new object[] { "abcd*", "ab$cd", "en-US", CompareOptions.IgnoreSymbols, true }; + yield return new object[] { "ab$dd", "ab$cd", "en-US", CompareOptions.IgnoreSymbols, false }; + } } public static TheoryData CreateFromCultureAndOptionsStringSortData => new TheoryData diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DateTimeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DateTimeTests.cs index d60ce55673aa0..e5cec1467d318 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DateTimeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DateTimeTests.cs @@ -2003,6 +2003,7 @@ public static IEnumerable Parse_ValidInput_Succeeds_MemberData() } [Theory] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95338", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] [MemberData(nameof(Parse_ValidInput_Succeeds_MemberData))] public static void Parse_ValidInput_Succeeds(string input, CultureInfo culture, DateTime? expected) { @@ -2463,6 +2464,7 @@ public static IEnumerable ToString_MatchesExpected_MemberData() } [Theory] + [ActiveIssue("https://github.com/dotnet/runtime/issues/95338", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))] [MemberData(nameof(Parse_ValidInput_Succeeds_MemberData))] public static void Parse_Span_ValidInput_Succeeds(string input, CultureInfo culture, DateTime? expected) { diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index 6c6c39e6ca302..623944f3ec464 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -748,9 +748,15 @@ elseif(HOST_BROWSER) set(ICU_LIBS "icucore") elseif(HOST_IOS OR HOST_TVOS OR HOST_MACCAT) set(ICU_FLAGS "-DTARGET_UNIX -DU_DISABLE_RENAMING -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option -Wno-deprecated-declarations") + if(HOST_IOS) + string(APPEND ICU_FLAGS " -DTARGET_IOS") + elseif(HOST_TVOS) + string(APPEND ICU_FLAGS " -DTARGET_TVOS") + elseif(HOST_MACCAT) + string(APPEND ICU_FLAGS " -DTARGET_MACCATALYST") + endif() set(HAVE_SYS_ICU 1) set(STATIC_ICU 1) - set(ICU_LIBS icuuc icui18n icudata) elseif(HOST_ANDROID) set(ICU_FLAGS "-DPALEXPORT=\"\" -DHAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS -DHAVE_SET_MAX_VARIABLE -DTARGET_UNIX -DTARGET_ANDROID -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option") set(HAVE_SYS_ICU 1) diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 297a7058dffaa..1cea9512ef6d3 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -481,9 +481,6 @@ <_MonoCMakeVersionMin Condition="'$(TargetsiOS)' == 'true'">$(iOSVersionMin) <_MonoCMakeVersionMin Condition="'$(TargetstvOS)' == 'true'">$(tvOSVersionMin) - - <_IcuLibdir>$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)/runtimes/$(TargetOS)-$(TargetArchitecture)/native/lib - <_MonoCMakeArgs Include="-DCMAKE_SYSTEM_NAME=$(_MonoCMakeSystemName)"/> <_MonoCMakeArgs Include="-DCMAKE_OSX_DEPLOYMENT_TARGET=$(_MonoCMakeVersionMin)" /> @@ -496,9 +493,7 @@ <_MonoCMakeArgs Condition="'$(Platform)' == 'arm64'" Include="-DCMAKE_OSX_ARCHITECTURES=arm64" /> - <_MonoCMakeArgs Include="-DICU_LIBDIR=$(_IcuLibdir)"/> <_MonoCMakeArgs Include="-DENABLE_ICALL_EXPORT=1"/> - <_MonoCFLAGS Include="-I$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)/runtimes/$(TargetOS)-$(TargetArchitecture)/native/include" /> diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt index 3060ccf6c89d4..609765da38e35 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -57,18 +57,24 @@ if(HAVE_SYS_ICU) endif() set(icu_shim_sources_base + pal_idna.c + pal_common.c + entrypoints.c + ${pal_icushim_sources_base}) + +if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS) + set(icu_shim_sources_base + ${icu_shim_sources_base} pal_calendarData.c pal_casing.c pal_collation.c - pal_common.c - pal_idna.c pal_locale.c pal_localeNumberData.c pal_localeStringData.c pal_normalization.c pal_timeZoneInfo.c - entrypoints.c - ${pal_icushim_sources_base}) + ) +endif() addprefix(icu_shim_sources "${ICU_SHIM_PATH}" "${icu_shim_sources_base}") @@ -96,6 +102,9 @@ if(HAVE_SYS_ICU) if(ICU_LIBDIR) set(ICU_LDFLAGS "-L${ICU_LIBDIR}") endif() + if(CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) + set(ICU_LDFLAGS "-licucore") + endif() add_library(icu_shim_objects OBJECT "${icu_shim_sources}") set(HAVE_ICU_SHIM 1) @@ -426,7 +435,11 @@ if(NOT DISABLE_SHARED_LIBS) # to avoid a conflict we rename the import library with the .import.lib suffix set_target_properties(monosgen-shared PROPERTIES IMPORT_SUFFIX ".import.lib") endif() - target_link_libraries(monosgen-shared PRIVATE ${OS_LIBS} ${LLVM_LIBS} ${ICU_LIBS} ${Z_LIBS}) + if(CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) + target_link_libraries(monosgen-shared PRIVATE ${OS_LIBS} ${LLVM_LIBS} ${Z_LIBS}) + else() + target_link_libraries(monosgen-shared PRIVATE ${OS_LIBS} ${LLVM_LIBS} ${ICU_LIBS} ${Z_LIBS}) + endif() if(ICU_LDFLAGS) set_property(TARGET monosgen-shared APPEND_STRING PROPERTY LINK_FLAGS " ${ICU_LDFLAGS}") endif() diff --git a/src/mono/msbuild/apple/build/AppleBuild.targets b/src/mono/msbuild/apple/build/AppleBuild.targets index 6629acfa5bcf8..df0bf82e95bd5 100644 --- a/src/mono/msbuild/apple/build/AppleBuild.targets +++ b/src/mono/msbuild/apple/build/AppleBuild.targets @@ -73,6 +73,7 @@ <_CommonLinkerArgs Include="-lz" /> <_CommonLinkerArgs Include="-lc++" /> <_CommonLinkerArgs Include="-liconv" /> + <_CommonLinkerArgs Include="-licucore" /> <_CommonLinkerArgs Include="-framework Foundation" /> <_CommonLinkerArgs Include="-framework Security" /> <_CommonLinkerArgs Include="-framework UIKit" /> diff --git a/src/mono/sample/iOS-NativeAOT/Makefile b/src/mono/sample/iOS-NativeAOT/Makefile index c50f01c05a913..0e203be2ddcb1 100644 --- a/src/mono/sample/iOS-NativeAOT/Makefile +++ b/src/mono/sample/iOS-NativeAOT/Makefile @@ -9,7 +9,7 @@ DEPLOY_AND_RUN?=false STRIP_DEBUG_SYMBOLS?=false USE_RUNTIME_PACKS?=false STATS?=false -HYBRID_GLOBALIZATION?=false +HYBRID_GLOBALIZATION?=true REPO_DIR=$(realpath $(TOP)) TASKS_DIR=$(REPO_DIR)/src/tasks diff --git a/src/mono/sample/iOS/Makefile b/src/mono/sample/iOS/Makefile index e3c8320dcd96e..a7579772a7977 100644 --- a/src/mono/sample/iOS/Makefile +++ b/src/mono/sample/iOS/Makefile @@ -6,7 +6,7 @@ TARGET?=iossimulator DEPLOY_AND_RUN?=true APP_SANDBOX?=false STRIP_DEBUG_SYMBOLS?=false # only used when measuring SOD via build-appbundle make target -HYBRID_GLOBALIZATION?=false +HYBRID_GLOBALIZATION?=true #If DIAGNOSTIC_PORTS is enabled, @(RuntimeComponents) must also include 'diagnostics_tracing'. #If @(RuntimeComponents) includes 'diagnostics_tracing', DIAGNOSTIC_PORTS is optional. diff --git a/src/native/libs/System.Globalization.Native/CMakeLists.txt b/src/native/libs/System.Globalization.Native/CMakeLists.txt index 6e4dee71fe681..5e9ccb1e8991b 100644 --- a/src/native/libs/System.Globalization.Native/CMakeLists.txt +++ b/src/native/libs/System.Globalization.Native/CMakeLists.txt @@ -21,7 +21,8 @@ if(CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_WASI) add_compile_options(-Wno-extra-semi-stmt) add_compile_options(-Wno-unknown-warning-option) - if (NOT CLR_CMAKE_TARGET_ANDROID AND NOT DEFINED CMAKE_ICU_DIR) + # The mobile configurations in particular bring their own ICU, so skip + if (NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT DEFINED CMAKE_ICU_DIR) if (CLR_CMAKE_TARGET_OSX) execute_process(COMMAND brew --prefix OUTPUT_VARIABLE brew_prefix OUTPUT_STRIP_TRAILING_WHITESPACE) set(ICU_HOMEBREW_INC_PATH "${brew_prefix}/opt/icu4c/include") @@ -57,23 +58,32 @@ endif() include(configure.cmake) set(NATIVEGLOBALIZATION_SOURCES - pal_calendarData.c - pal_casing.c - pal_collation.c - pal_common.c pal_idna.c - pal_locale.c - pal_localeNumberData.c - pal_localeStringData.c - pal_normalization.c + pal_common.c ) +if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS) + set(NATIVEGLOBALIZATION_SOURCES + ${NATIVEGLOBALIZATION_SOURCES} + pal_calendarData.c + pal_casing.c + pal_collation.c + pal_locale.c + pal_localeNumberData.c + pal_localeStringData.c + pal_normalization.c + ) +endif() -if (DEFINED CMAKE_ICU_DIR) +if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND DEFINED CMAKE_ICU_DIR) include_directories(${CMAKE_ICU_DIR}/include) link_libraries(${CMAKE_ICU_DIR}/lib/libicuuc.a ${CMAKE_ICU_DIR}/lib/libicui18n.a ${CMAKE_ICU_DIR}/lib/libicudata.a) link_libraries(stdc++) endif() +if ((CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) AND NOT DEFINED CMAKE_ICU_DIR) + link_libraries(icucore) +endif() + if (CMAKE_USE_PTHREADS) add_compile_options(-pthread) add_linker_flag(-pthread) @@ -109,7 +119,7 @@ if (CLR_CMAKE_TARGET_APPLE) endif() # time zone names are filtered out of icu data for the browser and associated functionality is disabled -if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) +if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS) set(NATIVEGLOBALIZATION_SOURCES ${NATIVEGLOBALIZATION_SOURCES} pal_timeZoneInfo.c) endif() diff --git a/src/native/libs/System.Globalization.Native/entrypoints.c b/src/native/libs/System.Globalization.Native/entrypoints.c index bc173b1c2c13e..cb3b845b8861a 100644 --- a/src/native/libs/System.Globalization.Native/entrypoints.c +++ b/src/native/libs/System.Globalization.Native/entrypoints.c @@ -19,6 +19,7 @@ typedef uint16_t UChar; static const Entry s_globalizationNative[] = { +#if !defined(__APPLE__) || (defined(__APPLE__) && !(TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS)) DllImportEntry(GlobalizationNative_ChangeCase) DllImportEntry(GlobalizationNative_ChangeCaseInvariant) DllImportEntry(GlobalizationNative_ChangeCaseTurkish) @@ -45,7 +46,6 @@ static const Entry s_globalizationNative[] = DllImportEntry(GlobalizationNative_IanaIdToWindowsId) DllImportEntry(GlobalizationNative_IndexOf) DllImportEntry(GlobalizationNative_InitICUFunctions) - DllImportEntry(GlobalizationNative_InitOrdinalCasingPage) DllImportEntry(GlobalizationNative_IsNormalized) DllImportEntry(GlobalizationNative_IsPredefinedLocale) DllImportEntry(GlobalizationNative_LastIndexOf) @@ -55,13 +55,12 @@ static const Entry s_globalizationNative[] = #endif DllImportEntry(GlobalizationNative_NormalizeString) DllImportEntry(GlobalizationNative_StartsWith) - DllImportEntry(GlobalizationNative_ToAscii) - DllImportEntry(GlobalizationNative_ToUnicode) DllImportEntry(GlobalizationNative_WindowsIdToIanaId) -#if defined(TARGET_MACCATALYST) || defined(TARGET_IOS) || defined(TARGET_TVOS) +#else DllImportEntry(GlobalizationNative_ChangeCaseInvariantNative) DllImportEntry(GlobalizationNative_ChangeCaseNative) DllImportEntry(GlobalizationNative_CompareStringNative) + DllImportEntry(GlobalizationNative_GetDefaultLocaleNameNative) DllImportEntry(GlobalizationNative_EndsWithNative) DllImportEntry(GlobalizationNative_GetCalendarInfoNative) DllImportEntry(GlobalizationNative_GetCalendarsNative) @@ -81,6 +80,9 @@ static const Entry s_globalizationNative[] = DllImportEntry(GlobalizationNative_NormalizeStringNative) DllImportEntry(GlobalizationNative_StartsWithNative) #endif + DllImportEntry(GlobalizationNative_ToAscii) + DllImportEntry(GlobalizationNative_ToUnicode) + DllImportEntry(GlobalizationNative_InitOrdinalCasingPage) }; EXTERN_C const void* GlobalizationResolveDllImport(const char* name); diff --git a/src/native/libs/System.Globalization.Native/pal_calendarData.h b/src/native/libs/System.Globalization.Native/pal_calendarData.h index ab725f7f65df1..3abd02446b317 100644 --- a/src/native/libs/System.Globalization.Native/pal_calendarData.h +++ b/src/native/libs/System.Globalization.Native/pal_calendarData.h @@ -79,6 +79,7 @@ typedef enum // the function pointer definition for the callback used in EnumCalendarInfo typedef void (PAL_CALLBACK_CALLTYPE *EnumCalendarInfoCallback)(const UChar*, const void*); +#if !defined(__APPLE__) || (defined(__APPLE__) && !(TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS)) PALEXPORT int32_t GlobalizationNative_GetCalendars(const UChar* localeName, CalendarId* calendars, int32_t calendarsCapacity); @@ -101,8 +102,7 @@ PALEXPORT int32_t GlobalizationNative_GetJapaneseEraStartDate(int32_t era, int32_t* startYear, int32_t* startMonth, int32_t* startDay); - -#ifdef __APPLE__ +#else PALEXPORT const char* GlobalizationNative_GetCalendarInfoNative(const char* localeName, CalendarId calendarId, CalendarDataType dataType); diff --git a/src/native/libs/System.Globalization.Native/pal_calendarData.m b/src/native/libs/System.Globalization.Native/pal_calendarData.m index f401a03e4afc0..8cfa15000fc69 100644 --- a/src/native/libs/System.Globalization.Native/pal_calendarData.m +++ b/src/native/libs/System.Globalization.Native/pal_calendarData.m @@ -10,8 +10,7 @@ #error This file relies on ARC for memory management, but ARC is not enabled. #endif -#if defined(TARGET_MACCATALYST) || defined(TARGET_IOS) || defined(TARGET_TVOS) - +#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS /* Function: GetCalendarIdentifier diff --git a/src/native/libs/System.Globalization.Native/pal_casing.h b/src/native/libs/System.Globalization.Native/pal_casing.h index e39d38ecb1c11..cf006b4387faa 100644 --- a/src/native/libs/System.Globalization.Native/pal_casing.h +++ b/src/native/libs/System.Globalization.Native/pal_casing.h @@ -4,6 +4,9 @@ #include "pal_locale.h" #include "pal_compiler.h" +PALEXPORT void GlobalizationNative_InitOrdinalCasingPage(int32_t pageNumber, UChar* pTarget); + +#if !defined(__APPLE__) || (defined(__APPLE__) && !(TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS)) PALEXPORT void GlobalizationNative_ChangeCase(const UChar* lpSrc, int32_t cwSrcLength, UChar* lpDst, @@ -21,10 +24,7 @@ PALEXPORT void GlobalizationNative_ChangeCaseTurkish(const UChar* lpSrc, UChar* lpDst, int32_t cwDstLength, int32_t bToUpper); - -PALEXPORT void GlobalizationNative_InitOrdinalCasingPage(int32_t pageNumber, UChar* pTarget); - -#ifdef __APPLE__ +#else PALEXPORT int32_t GlobalizationNative_ChangeCaseNative(const uint16_t* localeName, int32_t lNameLength, const uint16_t* lpSrc, diff --git a/src/native/libs/System.Globalization.Native/pal_casing.m b/src/native/libs/System.Globalization.Native/pal_casing.m index 31fd647347daf..8f826769a603e 100644 --- a/src/native/libs/System.Globalization.Native/pal_casing.m +++ b/src/native/libs/System.Globalization.Native/pal_casing.m @@ -11,8 +11,7 @@ #error This file relies on ARC for memory management, but ARC is not enabled. #endif -#if defined(TARGET_MACCATALYST) || defined(TARGET_IOS) || defined(TARGET_TVOS) - +#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS /** * Is this code unit a lead surrogate (U+d800..U+dbff)? * @param c 16-bit code unit @@ -148,5 +147,4 @@ int32_t GlobalizationNative_ChangeCaseInvariantNative(const uint16_t* lpSrc, int return Success; } } - #endif diff --git a/src/native/libs/System.Globalization.Native/pal_collation.h b/src/native/libs/System.Globalization.Native/pal_collation.h index 197da249a0a04..4f86ac11e64bf 100644 --- a/src/native/libs/System.Globalization.Native/pal_collation.h +++ b/src/native/libs/System.Globalization.Native/pal_collation.h @@ -13,6 +13,7 @@ typedef struct _Range { int32_t length; } Range; +#if !defined(__APPLE__) || (defined(__APPLE__) && !(TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS)) PALEXPORT ResultCode GlobalizationNative_GetSortHandle(const char* lpLocaleName, SortHandle** ppSortHandle); PALEXPORT void GlobalizationNative_CloseSortHandle(SortHandle* pSortHandle); @@ -65,8 +66,7 @@ PALEXPORT int32_t GlobalizationNative_GetSortKey(SortHandle* pSortHandle, uint8_t* sortKey, int32_t cbSortKeyLength, int32_t options); - -#ifdef __APPLE__ +#else PALEXPORT int32_t GlobalizationNative_CompareStringNative(const uint16_t* localeName, int32_t lNameLength, const uint16_t* lpTarget, diff --git a/src/native/libs/System.Globalization.Native/pal_collation.m b/src/native/libs/System.Globalization.Native/pal_collation.m index 6326b267c582c..aa51b8d6ba138 100644 --- a/src/native/libs/System.Globalization.Native/pal_collation.m +++ b/src/native/libs/System.Globalization.Native/pal_collation.m @@ -11,8 +11,7 @@ #error This file relies on ARC for memory management, but ARC is not enabled. #endif -#if defined(TARGET_MACCATALYST) || defined(TARGET_IOS) || defined(TARGET_TVOS) - +#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS // Enum that corresponds to C# CompareOptions typedef enum { @@ -72,7 +71,7 @@ static NSStringCompareOptions ConvertFromCompareOptionsToNSStringCompareOptions( return options; } -NSString *ConvertToKatakana(NSString *input) +static NSString *ConvertToKatakana(NSString *input) { NSMutableString *mutableString = [input mutableCopy]; CFStringTransform((__bridge CFMutableStringRef)mutableString, NULL, kCFStringTransformHiraganaKatakana, false); diff --git a/src/native/libs/System.Globalization.Native/pal_icushim_internal.h b/src/native/libs/System.Globalization.Native/pal_icushim_internal.h index bc04acaf55b1e..88026f9ddec48 100644 --- a/src/native/libs/System.Globalization.Native/pal_icushim_internal.h +++ b/src/native/libs/System.Globalization.Native/pal_icushim_internal.h @@ -21,6 +21,11 @@ // All ICU headers need to be included here so that all function prototypes are // available before the function pointers are declared below. +#if defined(__APPLE__) && (TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS) +#include +#include +#include +#else #include #include #include @@ -41,6 +46,7 @@ #include #include +#endif #endif #elif defined(TARGET_WINDOWS) diff --git a/src/native/libs/System.Globalization.Native/pal_icushim_static.c b/src/native/libs/System.Globalization.Native/pal_icushim_static.c index ebf271429573e..052fe9285726b 100644 --- a/src/native/libs/System.Globalization.Native/pal_icushim_static.c +++ b/src/native/libs/System.Globalization.Native/pal_icushim_static.c @@ -10,7 +10,10 @@ #include #include #include + +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) #include +#endif #if defined(TARGET_UNIX) #include @@ -18,7 +21,7 @@ #define strcasecmp _stricmp #define strncasecmp _strnicmp #endif - +#if !defined(TARGET_MACCATALYST) && !defined(TARGET_IOS) && !defined(TARGET_TVOS) static int32_t isLoaded = 0; static int32_t isDataSet = 0; @@ -247,3 +250,5 @@ int32_t GlobalizationNative_GetICUVersion(void) return (versionInfo[0] << 24) + (versionInfo[1] << 16) + (versionInfo[2] << 8) + versionInfo[3]; } +#endif + diff --git a/src/native/libs/System.Globalization.Native/pal_locale.h b/src/native/libs/System.Globalization.Native/pal_locale.h index c3cb16ff2ee45..3249ff15176da 100644 --- a/src/native/libs/System.Globalization.Native/pal_locale.h +++ b/src/native/libs/System.Globalization.Native/pal_locale.h @@ -5,6 +5,7 @@ #include "pal_compiler.h" +#if !defined(__APPLE__) || (defined(__APPLE__) && !(TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS)) PALEXPORT int32_t GlobalizationNative_GetLocales(UChar *value, int32_t valueLength); PALEXPORT int32_t GlobalizationNative_GetLocaleName(const UChar* localeName, UChar* value, int32_t valueLength); @@ -16,8 +17,8 @@ PALEXPORT int32_t GlobalizationNative_IsPredefinedLocale(const UChar* localeName PALEXPORT int32_t GlobalizationNative_GetLocaleTimeFormat(const UChar* localeName, int shortFormat, UChar* value, int32_t valueLength); +#else -#ifdef __APPLE__ PALEXPORT const char* GlobalizationNative_GetDefaultLocaleNameNative(void); PALEXPORT const char* GlobalizationNative_GetLocaleNameNative(const char* localeName); diff --git a/src/native/libs/System.Globalization.Native/pal_locale.m b/src/native/libs/System.Globalization.Native/pal_locale.m index 9cb806cd1a650..4d35dbe0dcddb 100644 --- a/src/native/libs/System.Globalization.Native/pal_locale.m +++ b/src/native/libs/System.Globalization.Native/pal_locale.m @@ -36,8 +36,7 @@ return strdup([localeName UTF8String]); } -#if defined(TARGET_MACCATALYST) || defined(TARGET_IOS) || defined(TARGET_TVOS) - +#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS const char* GlobalizationNative_GetLocaleNameNative(const char* localeName) { @autoreleasepool @@ -766,9 +765,6 @@ int32_t GlobalizationNative_GetLocalesNative(UChar* value, int32_t length) } } -#endif - -#if defined(TARGET_MACCATALYST) || defined(TARGET_IOS) || defined(TARGET_TVOS) const char* GlobalizationNative_GetICUDataPathRelativeToAppBundleRoot(const char* path) { @autoreleasepool @@ -841,3 +837,4 @@ int32_t GlobalizationNative_IsPredefinedLocaleNative(const char* localeName) } } #endif + diff --git a/src/native/libs/System.Globalization.Native/pal_localeNumberData.h b/src/native/libs/System.Globalization.Native/pal_localeNumberData.h index a68f1e32e334a..2fef6b294673c 100644 --- a/src/native/libs/System.Globalization.Native/pal_localeNumberData.h +++ b/src/native/libs/System.Globalization.Native/pal_localeNumberData.h @@ -34,7 +34,7 @@ typedef enum WeekRule_FirstFullWeek = 1, WeekRule_FirstFourDayWeek = 2 } CalendarWeekRule; - +#if !defined(__APPLE__) || (defined(__APPLE__) && !(TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS)) PALEXPORT int32_t GlobalizationNative_GetLocaleInfoInt(const UChar* localeName, LocaleNumberData localeNumberData, int32_t* value); @@ -43,8 +43,7 @@ PALEXPORT int32_t GlobalizationNative_GetLocaleInfoGroupingSizes(const UChar* lo LocaleNumberData localeGroupingData, int32_t* primaryGroupSize, int32_t* secondaryGroupSize); - -#ifdef __APPLE__ +#else PALEXPORT int32_t GlobalizationNative_GetLocaleInfoIntNative(const char* localeName, LocaleNumberData localeNumberData); diff --git a/src/native/libs/System.Globalization.Native/pal_localeStringData.h b/src/native/libs/System.Globalization.Native/pal_localeStringData.h index b93d5d7dc85f4..cfa3e1575f891 100644 --- a/src/native/libs/System.Globalization.Native/pal_localeStringData.h +++ b/src/native/libs/System.Globalization.Native/pal_localeStringData.h @@ -43,14 +43,13 @@ typedef enum LocaleString_PercentSymbol = 0x00000076, LocaleString_PerMilleSymbol = 0x00000077 } LocaleStringData; - +#if !defined(__APPLE__) || (defined(__APPLE__) && !(TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS)) PALEXPORT int32_t GlobalizationNative_GetLocaleInfoString(const UChar* localeName, LocaleStringData localeStringData, UChar* value, int32_t valueLength, const UChar* uiLocaleName); - -#ifdef __APPLE__ +#else PALEXPORT const char* GlobalizationNative_GetLocaleInfoStringNative(const char* localeName, LocaleStringData localeStringData, const char* currentUILocaleName); #endif diff --git a/src/native/libs/System.Globalization.Native/pal_normalization.h b/src/native/libs/System.Globalization.Native/pal_normalization.h index 198d3f9d518f0..44b937e35075c 100644 --- a/src/native/libs/System.Globalization.Native/pal_normalization.h +++ b/src/native/libs/System.Globalization.Native/pal_normalization.h @@ -17,7 +17,7 @@ typedef enum FormKC = 0x5, FormKD = 0x6 } NormalizationForm; - +#if !defined(__APPLE__) || (defined(__APPLE__) && !(TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS)) PALEXPORT int32_t GlobalizationNative_IsNormalized(NormalizationForm normalizationForm, const UChar* lpStr, int32_t cwStrLength); @@ -27,8 +27,7 @@ PALEXPORT int32_t GlobalizationNative_NormalizeString(NormalizationForm normaliz int32_t cwSrcLength, UChar* lpDst, int32_t cwDstLength); - -#ifdef __APPLE__ +#else PALEXPORT int32_t GlobalizationNative_IsNormalizedNative(NormalizationForm normalizationForm, const uint16_t* lpStr, int32_t cwStrLength); diff --git a/src/native/libs/System.Globalization.Native/pal_normalization.m b/src/native/libs/System.Globalization.Native/pal_normalization.m index 62c3ecde53c9d..ac3a2fd5cb521 100644 --- a/src/native/libs/System.Globalization.Native/pal_normalization.m +++ b/src/native/libs/System.Globalization.Native/pal_normalization.m @@ -11,7 +11,7 @@ #error This file relies on ARC for memory management, but ARC is not enabled. #endif -#if defined(TARGET_MACCATALYST) || defined(TARGET_IOS) || defined(TARGET_TVOS) +#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS static NSString* GetNormalizedStringForForm(NormalizationForm normalizationForm, NSString* sourceString) { switch (normalizationForm) diff --git a/src/native/libs/System.Globalization.Native/pal_timeZoneInfo.h b/src/native/libs/System.Globalization.Native/pal_timeZoneInfo.h index 99653b939196e..1bf1fe98f9936 100644 --- a/src/native/libs/System.Globalization.Native/pal_timeZoneInfo.h +++ b/src/native/libs/System.Globalization.Native/pal_timeZoneInfo.h @@ -20,12 +20,11 @@ typedef enum TimeZoneDisplayName_ExemplarCity = 4, TimeZoneDisplayName_TimeZoneName = 5, } TimeZoneDisplayNameType; - +#if !defined(__APPLE__) || (defined(__APPLE__) && !(TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS)) PALEXPORT int32_t GlobalizationNative_WindowsIdToIanaId(const UChar* windowsId, const char* region, UChar* ianaId, int32_t ianaIdLength); PALEXPORT int32_t GlobalizationNative_IanaIdToWindowsId(const UChar* ianaId, UChar* windowsId, int32_t windowsIdLength); PALEXPORT ResultCode GlobalizationNative_GetTimeZoneDisplayName(const UChar* localeName, const UChar* timeZoneId, TimeZoneDisplayNameType type, UChar* result, int32_t resultLength); - -#ifdef __APPLE__ +#else PALEXPORT int32_t GlobalizationNative_GetTimeZoneDisplayNameNative(const uint16_t* localeName, int32_t lNameLength, const uint16_t* timeZoneId, int32_t timeZoneIdLength, TimeZoneDisplayNameType type, uint16_t* result, int32_t resultLength); #endif diff --git a/src/native/libs/System.Globalization.Native/pal_timeZoneInfo.m b/src/native/libs/System.Globalization.Native/pal_timeZoneInfo.m index 1cd51dc6704ff..017f982ebb2c9 100644 --- a/src/native/libs/System.Globalization.Native/pal_timeZoneInfo.m +++ b/src/native/libs/System.Globalization.Native/pal_timeZoneInfo.m @@ -11,8 +11,7 @@ #error This file relies on ARC for memory management, but ARC is not enabled. #endif -#if defined(TARGET_MACCATALYST) || defined(TARGET_IOS) || defined(TARGET_TVOS) - +#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS /* Gets the localized display name that is currently in effect for the specified time zone. */ diff --git a/src/native/libs/build-native.proj b/src/native/libs/build-native.proj index f0b394604a7a2..bbf272365a899 100644 --- a/src/native/libs/build-native.proj +++ b/src/native/libs/build-native.proj @@ -16,7 +16,7 @@ <_UsePThreads /> <_UsePThreads Condition="'$(MonoWasmBuildVariant)' == 'multithread'"> usepthreads - <_IcuDir Condition="'$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)' != ''">$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)/runtimes/$(TargetOS)-$(TargetArchitecture)$(_RuntimeVariant)/native + <_IcuDir Condition="'$(TargetsAppleMobile)' != 'true' and '$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)' != ''">$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)/runtimes/$(TargetOS)-$(TargetArchitecture)$(_RuntimeVariant)/native <_IcuDirArg Condition="'$(_IcuDir)' != ''"> icudir "$(_IcuDir)" <_BuildNativeArgs>$(_BuildNativeArgs)$(_IcuDirArg)$(_UsePThreads) @@ -55,7 +55,7 @@ - <_IcuArtifacts Condition="'$(_IcuDir)' != ''" + <_IcuArtifacts Condition="'$(_IcuDir)' != '' and '$(TargetsAppleMobile)' != 'true'" Include="$(_IcuDir)/lib/libicuuc.a; $(_IcuDir)/lib/libicui18n.a; $(_IcuDir)/lib/libicudata.a; diff --git a/src/tasks/AppleAppBuilder/Templates/CMakeLists-librarymode.txt.template b/src/tasks/AppleAppBuilder/Templates/CMakeLists-librarymode.txt.template index 4ac9ad76006f1..edb0989f2bdf7 100644 --- a/src/tasks/AppleAppBuilder/Templates/CMakeLists-librarymode.txt.template +++ b/src/tasks/AppleAppBuilder/Templates/CMakeLists-librarymode.txt.template @@ -69,6 +69,7 @@ target_link_libraries( "-lz" "-lc++" "-liconv" + "-licucore" %NativeLibrariesToLink% %APP_LINK_LIBRARIES% ) diff --git a/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template b/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template index 8bd0126f7d2aa..614d9a7cf64fb 100644 --- a/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template +++ b/src/tasks/AppleAppBuilder/Templates/CMakeLists.txt.template @@ -75,6 +75,7 @@ target_link_libraries( "-lz" "-lc++" "-liconv" + "-licucore" %NativeLibrariesToLink% %APP_LINK_LIBRARIES% ) diff --git a/src/tasks/AppleAppBuilder/Templates/runtime.m b/src/tasks/AppleAppBuilder/Templates/runtime.m index 4cef34a8d67ee..3d825f50f0079 100644 --- a/src/tasks/AppleAppBuilder/Templates/runtime.m +++ b/src/tasks/AppleAppBuilder/Templates/runtime.m @@ -261,10 +261,6 @@ static bool is_pinvoke_override_library (const char* libraryName) setenv ("DOTNET_SYSTEM_GLOBALIZATION_INVARIANT", "1", TRUE); #endif -#if HYBRID_GLOBALIZATION - setenv ("DOTNET_SYSTEM_GLOBALIZATION_HYBRID", "1", TRUE); -#endif - #if ENABLE_RUNTIME_LOGGING setenv ("MONO_LOG_LEVEL", "debug", TRUE); setenv ("MONO_LOG_MASK", "all", TRUE); @@ -290,19 +286,17 @@ static bool is_pinvoke_override_library (const char* libraryName) char icu_dat_path [1024]; int res; -#if defined(HYBRID_GLOBALIZATION) - res = snprintf (icu_dat_path, sizeof (icu_dat_path) - 1, "%s/%s", bundle, "icudt_hybrid.dat"); -#else +#if !defined(HYBRID_GLOBALIZATION) res = snprintf (icu_dat_path, sizeof (icu_dat_path) - 1, "%s/%s", bundle, "icudt.dat"); -#endif assert (res > 0); +#endif // TODO: set TRUSTED_PLATFORM_ASSEMBLIES, APP_PATHS and NATIVE_DLL_SEARCH_DIRECTORIES const char *appctx_keys [] = { "RUNTIME_IDENTIFIER", "APP_CONTEXT_BASE_DIRECTORY", "PINVOKE_OVERRIDE", -#if !defined(INVARIANT_GLOBALIZATION) +#if !defined(INVARIANT_GLOBALIZATION) && !defined(HYBRID_GLOBALIZATION) "ICU_DAT_FILE_PATH" #endif }; @@ -310,7 +304,7 @@ static bool is_pinvoke_override_library (const char* libraryName) APPLE_RUNTIME_IDENTIFIER, bundle, pinvoke_override, -#if !defined(INVARIANT_GLOBALIZATION) +#if !defined(INVARIANT_GLOBALIZATION) && !defined(HYBRID_GLOBALIZATION) icu_dat_path #endif }; diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs index 867bb2cec15c4..e3c4d8149249c 100644 --- a/src/tasks/AppleAppBuilder/Xcode.cs +++ b/src/tasks/AppleAppBuilder/Xcode.cs @@ -271,7 +271,7 @@ public string GenerateCMake( string[] resources = Directory.GetFileSystemEntries(workspace, "", SearchOption.TopDirectoryOnly) .Where(f => !predefinedExcludes.Any(e => (!e.EndsWith('*') && f.EndsWith(e, StringComparison.InvariantCultureIgnoreCase)) || (e.EndsWith('*') && Path.GetFileName(f).StartsWith(e.TrimEnd('*'), StringComparison.InvariantCultureIgnoreCase) && - !(hybridGlobalization ? Path.GetFileName(f) == "icudt_hybrid.dat" : Path.GetFileName(f) == "icudt.dat")))) + !(!hybridGlobalization && Path.GetFileName(f) == "icudt.dat")))) .ToArray(); if (string.IsNullOrEmpty(nativeMainSource)) diff --git a/src/tasks/LibraryBuilder/Templates/CMakeLists.txt.template b/src/tasks/LibraryBuilder/Templates/CMakeLists.txt.template index defe196388114..51c00ad72a916 100644 --- a/src/tasks/LibraryBuilder/Templates/CMakeLists.txt.template +++ b/src/tasks/LibraryBuilder/Templates/CMakeLists.txt.template @@ -46,6 +46,7 @@ elseif(TARGETS_APPLE_MOBILE) "-framework UIKit" "-lz" "-lc++" + "-licucore" "-liconv" ) add_definitions(-DHOST_APPLE_MOBILE=1) diff --git a/src/tests/Directory.Build.props b/src/tests/Directory.Build.props index 485ef96914b0a..60badfac3c1a3 100644 --- a/src/tests/Directory.Build.props +++ b/src/tests/Directory.Build.props @@ -223,6 +223,7 @@ <_IsApplePlatform Condition="'$(TargetsAppleMobile)' == 'true'">true <_IsiOSLikePlatform Condition="'$(TargetsAppleMobile)' == 'true'">true <_SymbolPrefix Condition="'$(_IsApplePlatform)' == 'true'">_ + true diff --git a/src/tests/FunctionalTests/Directory.Build.props b/src/tests/FunctionalTests/Directory.Build.props index d8316f8a0a1b2..16117373adea2 100644 --- a/src/tests/FunctionalTests/Directory.Build.props +++ b/src/tests/FunctionalTests/Directory.Build.props @@ -5,6 +5,7 @@ true true true + true diff --git a/src/tests/build.proj b/src/tests/build.proj index 9622cdf945d21..f543dbe85bd81 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -309,7 +309,7 @@ - + @(TestDlls->'%(Filename)') @@ -435,10 +435,6 @@ <_LinkerFlagsToDrop Include="@(NativeFramework->'-framework %(Identity)')" /> -