Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Add the default globalization implementation for Linux
Browse files Browse the repository at this point in the history
The change here is just adding some default implmentation to be used for
Linux so we can avoid calling any path end up calling Win32 API.

The change also will make it easier in the future to determine what
functionality needed for Linux to implement the real PAL layer.

Note that, the changes here cover most of the globalization implemntation but
we may need to do more as needed if we run into any other problem when getting
the demo ready
  • Loading branch information
tarekgh committed Oct 24, 2015
1 parent 9b01515 commit d56f145
Show file tree
Hide file tree
Showing 9 changed files with 662 additions and 26 deletions.
1 change: 1 addition & 0 deletions src/System.Private.CoreLib/src/Interop/Interop.manual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,7 @@ internal partial class mincore_obsolete
// declare the specialized callback context type, deriving from the CallbackContext type that MCG expects the class library to implement.
internal partial class mincore_private
{
#pragma warning disable 649
internal class LParamCallbackContext : CallbackContext
{
// Put any user data to pass to the callback here. The user code being called back will get the instance of this class that was passed to the API originally.
Expand Down
45 changes: 29 additions & 16 deletions src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />

<PropertyGroup>
<ProjectGuid>{BE95C560-B508-4588-8907-F9FC5BC1A0CF}</ProjectGuid>
<OutputType>Library</OutputType>
Expand All @@ -12,13 +12,13 @@
</PropertyGroup>

<PropertyGroup>
<!--
temporary workaround to exclude all references including mscorlib.dll
<!--
temporary workaround to exclude all references including mscorlib.dll
<_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories>
<_FullFrameworkReferenceAssemblyPaths>$(_TargetFrameworkDirectories)</_FullFrameworkReferenceAssemblyPaths>
Condition="'$(IsProjectNLibrary)' != 'true'
Condition="'$(IsProjectNLibrary)' != 'true'
-->
<IsCoreAssembly>true</IsCoreAssembly>
<IsCoreAssembly>true</IsCoreAssembly>
<!--
Need to avoid target platform being empty because that would drag in an mscorlib design-time
facade into the references and break us.
Expand All @@ -29,17 +29,17 @@
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
<TargetFrameworkMonikerDisplayName>.NET Portable Subset</TargetFrameworkMonikerDisplayName>
<ImplicitlyExpandTargetFramework>false</ImplicitlyExpandTargetFramework>
<!--

<!--
<ExcludeDefaultReferences>true</ExcludeDefaultReferences>
<ExcludeVersioningImport>true</ExcludeVersioningImport>
<TargetingDefaultPlatform>true</TargetingDefaultPlatform>
<ExcludeFrameworkTargetingImport>true</ExcludeFrameworkTargetingImport>
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
-->
</PropertyGroup>

<!-- Default configurations to help VS understand the options -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
Expand Down Expand Up @@ -70,7 +70,7 @@
<Link>Resources\Common</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<Compile Include="Internal\Diagnostics\ExceptionExtensions.cs" />
<Compile Include="Internal\Diagnostics\StackTraceHelper.cs" />
Expand Down Expand Up @@ -223,14 +223,10 @@
<Compile Include="System\GC.cs" />
<Compile Include="System\Globalization\Calendar.cs" />
<Compile Include="System\Globalization\CalendarData.cs" />
<Compile Include="System\Globalization\CalendarData.Win32.cs" />
<Compile Include="System\Globalization\CharUnicodeInfo.cs" />
<Compile Include="System\Globalization\CompareInfo.cs" />
<Compile Include="System\Globalization\CompareInfo.Win32.cs" />
<Compile Include="System\Globalization\CultureData.cs" />
<Compile Include="System\Globalization\CultureData.Win32.cs" />
<Compile Include="System\Globalization\CultureInfo.cs" />
<Compile Include="System\Globalization\CultureInfo.Win32.cs" />
<Compile Include="System\Globalization\FormatProvider.DateTimeFormat.cs" />
<Compile Include="System\Globalization\DateTimeFormatInfo.cs" />
<Compile Include="System\Globalization\DateTimeFormatInfoScanner.cs" />
Expand All @@ -250,7 +246,6 @@
<Compile Include="System\Globalization\NumberFormatInfo.cs" />
<Compile Include="System\Globalization\NumberStyles.cs" />
<Compile Include="System\Globalization\TextInfo.cs" />
<Compile Include="System\Globalization\TextInfo.Win32.cs" />
<Compile Include="System\Globalization\TimeSpanStyles.cs" />
<Compile Include="System\Globalization\UnicodeCategory.cs" />
<Compile Include="System\Guid.cs" />
Expand Down Expand Up @@ -471,6 +466,24 @@
<Compile Include="System\WeakReference.cs" />
<Compile Include="System\WeakReferenceOfT.cs" />
</ItemGroup>

<!-- Windows is default build -->
<ItemGroup Condition="'$(OSGroup)' != 'Linux'">
<Compile Include="System\Globalization\CultureInfo.Win32.cs" />
<Compile Include="System\Globalization\CompareInfo.Win32.cs" />
<Compile Include="System\Globalization\CultureData.Win32.cs" />
<Compile Include="System\Globalization\TextInfo.Win32.cs" />
<Compile Include="System\Globalization\CalendarData.Win32.cs" />
</ItemGroup>

<ItemGroup Condition="'$(OSGroup)' == 'Linux'">
<Compile Include="System\Globalization\CultureInfo.Dummy.cs" />
<Compile Include="System\Globalization\CompareInfo.Dummy.cs" />
<Compile Include="System\Globalization\CultureData.Dummy.cs" />
<Compile Include="System\Globalization\TextInfo.Dummy.cs" />
<Compile Include="System\Globalization\CalendarData.Dummy.cs" />
</ItemGroup>

<ItemGroup>
<Compile Include="Internal\Reflection\Tracing\ReflectionTrace.Public.cs" />
<Compile Include="Internal\Reflection\Tracing\ReflectionTrace.Public.Events.cs" />
Expand Down Expand Up @@ -500,7 +513,7 @@
<LogicalName>Resources.$(AssemblyName).rd.xml</LogicalName>
</EmbeddedResource>
</ItemGroup>

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Diagnostics.Contracts;
using System.Collections.Generic;

namespace System.Globalization
{
internal partial class CalendarData
{
private bool LoadCalendarDataFromSystem(String localeName, CalendarId calendarId)
{
return true;
}

internal static CalendarData GetCalendarData(CalendarId calendarId)
{
return CultureInfo.InvariantCulture.m_cultureData.GetCalendar(calendarId);
}

internal static int GetCalendars(String localeName, bool useUserOverride, CalendarId[] calendars)
{
return 1;
}

private static bool SystemSupportsTaiwaneseCalendar()
{
return false;
}

internal static int GetTwoDigitYearMax(CalendarId calendarId)
{
return 2029;
}
}
}

0 comments on commit d56f145

Please sign in to comment.