Skip to content

Commit

Permalink
Move most of CoreLib interop under Common (#1247)
Browse files Browse the repository at this point in the history
Contributes to #1232
  • Loading branch information
jkotas authored Jan 3, 2020
1 parent d099bc9 commit f1c7ed8
Show file tree
Hide file tree
Showing 235 changed files with 1,203 additions and 974 deletions.
22 changes: 0 additions & 22 deletions src/coreclr/src/System.Private.CoreLib/Common/NotImplemented.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
Helper Paths
-->
<PropertyGroup>
<CommonPath>$(MSBuildThisFileDirectory)Common</CommonPath>
<CommonPath>$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'Common', 'src'))</CommonPath>
<BclSourcesRoot>$(MSBuildThisFileDirectory)src</BclSourcesRoot>
</PropertyGroup>

Expand Down Expand Up @@ -259,6 +259,7 @@
<Compile Include="$(BclSourcesRoot)\System\RuntimeHandles.cs" />
<Compile Include="$(BclSourcesRoot)\System\RuntimeType.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Security\DynamicSecurityMethodAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\SR.cs" />
<Compile Include="$(BclSourcesRoot)\System\StartupHookProvider.cs" />
<Compile Include="$(BclSourcesRoot)\System\String.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\StubHelpers.cs" />
Expand All @@ -283,11 +284,21 @@
<Compile Include="$(BclSourcesRoot)\System\ValueType.cs" />
<Compile Include="$(BclSourcesRoot)\System\WeakReference.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\WeakReference.T.CoreCLR.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Kernel32\Interop.GetStdHandle.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Kernel32\Interop.HandleTypes.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Kernel32\Interop.LocalAlloc.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Ole32\Interop.CoTaskMemAlloc.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\OleAut32\Interop.SysAllocStringByteLen.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetStdHandle.cs">
<Link>Common\Interop\Windows\Kernel32\Interop.GetStdHandle.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.HandleTypes.cs">
<Link>Common\Interop\Windows\Kernel32\Interop.HandleTypes.cs</Link>
</Compile>
<Compile Include="$(LibrariesProjectRoot)\System.Private.CoreLib\src\Interop\Windows\Kernel32\Interop.LocalAlloc.cs">
<Link>Interop\Windows\Kernel32\Interop.LocalAlloc.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Windows\Ole32\Interop.CoTaskMemAlloc.cs">
<Link>Common\Interop\Windows\Ole32\Interop.CoTaskMemAlloc.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Windows\OleAut32\Interop.SysAllocStringByteLen.cs">
<Link>Common\Interop\Windows\OleAut32\Interop.SysAllocStringByteLen.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition="'$(FeatureUtf8String)' == 'true'">
<Compile Include="$(BclSourcesRoot)\System\Char8.cs" />
Expand All @@ -310,7 +321,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Eventing\XplatEventLogger.cs" Condition="'$(FeatureXplatEventSource)' == 'true'" />
<Compile Include="$(IntermediateOutputPath)../../../Eventing/$(BuildArch)/$(Configuration)/NativeRuntimeEventSource.cs" Condition="'$(FeaturePerfTracing)' == 'true' AND '$(BuildingInsideVisualStudio)' != 'true' " />
<Compile Include="$(IntermediateOutputPath)..\..\..\Eventing\$(BuildArch)\$(Configuration)\NativeRuntimeEventSource.cs" Condition="'$(FeaturePerfTracing)' == 'true' AND '$(BuildingInsideVisualStudio)' != 'true' " />
</ItemGroup>
<ItemGroup Condition="'$(FeatureCominterop)' == 'true'">
<Compile Include="$(BclSourcesRoot)\Internal\Runtime\InteropServices\WindowsRuntime\ExceptionSupport.cs" />
Expand Down Expand Up @@ -382,7 +393,9 @@
<Compile Include="$(BclSourcesRoot)\System\Variant.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsUnix)' == 'true'">
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Interop.BOOL.cs" /> <!-- The CLR internally uses a BOOL type analogous to the Windows BOOL type on Unix -->
<Compile Include="$(CommonPath)Interop\Windows\Interop.BOOL.cs"> <!-- The CLR internally uses a BOOL type analogous to the Windows BOOL type on Unix -->
<Link>Common\Interop\Windows\Interop.BOOL.cs</Link>
</Compile>
<Compile Include="$(BclSourcesRoot)\Interop\Unix\Interop.Libraries.cs" />
<Compile Include="$(BclSourcesRoot)\System\DateTime.Unix.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\GlobalizationMode.Unix.cs" />
Expand All @@ -403,11 +416,11 @@
</ItemGroup>
<!-- Include additional sources shared files in the compilation -->
<ItemGroup>
<!-- These files are shared with other framework components and don't live the same folder as the rest of them-->
<Compile Include="$(CommonPath)\NotImplemented.cs" />
<Compile Include="$(CommonPath)\System\SR.cs" />
<Compile Include="$(CommonPath)System\NotImplemented.cs">
<Link>Common\System\NotImplemented.cs</Link>
</Compile>
</ItemGroup>
<Import Project="$(CoreLibSharedDir)System.Private.CoreLib.Shared.projitems" Label="Shared" />
<Import Project="$(LibrariesProjectRoot)\System.Private.CoreLib\src\System.Private.CoreLib.Shared.projitems" Label="Shared" />
<PropertyGroup>
<CheckCDefines Condition="'$(CheckCDefines)'==''">true</CheckCDefines>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/Common/src/Interop/Unix/Interop.Libraries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal static partial class Libraries
{
// Shims
internal const string SystemNative = "System.Native";
internal const string HttpNative = "System.Net.Http.Native";
internal const string GlobalizationNative = "System.Globalization.Native";
internal const string NetSecurityNative = "System.Net.Security.Native";
internal const string CryptoNative = "System.Security.Cryptography.Native.OpenSsl";
internal const string CompressionNative = "System.IO.Compression.Native";
Expand Down
15 changes: 10 additions & 5 deletions src/libraries/Common/src/Interop/Windows/Interop.Errors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

internal partial class Interop
internal static partial class Interop
{
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382.aspx
internal partial class Errors
// As defined in winerror.h and https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes
internal static partial class Errors
{
internal const int ERROR_SUCCESS = 0x0;
internal const int ERROR_INVALID_FUNCTION = 0x1;
Expand All @@ -23,6 +23,7 @@ internal partial class Errors
internal const int ERROR_SHARING_VIOLATION = 0x20;
internal const int ERROR_LOCK_VIOLATION = 0x21;
internal const int ERROR_HANDLE_EOF = 0x26;
internal const int ERROR_NOT_SUPPORTED = 0x32;
internal const int ERROR_BAD_NETPATH = 0x35;
internal const int ERROR_NETWORK_ACCESS_DENIED = 0x41;
internal const int ERROR_BAD_NET_NAME = 0x43;
Expand All @@ -49,15 +50,19 @@ internal partial class Errors
internal const int ERROR_MORE_DATA = 0xEA;
internal const int ERROR_NO_MORE_ITEMS = 0x103;
internal const int ERROR_DIRECTORY = 0x10B;
internal const int ERROR_NOT_OWNER = 0x120;
internal const int ERROR_TOO_MANY_POSTS = 0x12A;
internal const int ERROR_PARTIAL_COPY = 0x12B;
internal const int ERROR_ARITHMETIC_OVERFLOW = 0x216;
internal const int ERROR_PIPE_CONNECTED = 0x217;
internal const int ERROR_PIPE_LISTENING = 0x218;
internal const int ERROR_MUTANT_LIMIT_EXCEEDED = 0x24B;
internal const int ERROR_OPERATION_ABORTED = 0x3E3;
internal const int ERROR_IO_INCOMPLETE = 0x3E4;
internal const int ERROR_IO_PENDING = 0x3E5;
internal const int ERROR_NO_TOKEN = 0x3f0;
internal const int ERROR_SERVICE_DOES_NOT_EXIST = 0x424;
internal const int ERROR_NO_UNICODE_TRANSLATION = 0x459;
internal const int ERROR_DLL_INIT_FAILED = 0x45A;
internal const int ERROR_COUNTER_TIMEOUT = 0x461;
internal const int ERROR_NO_ASSOCIATION = 0x483;
Expand All @@ -80,10 +85,10 @@ internal partial class Errors
internal const int ERROR_NO_SECURITY_ON_OBJECT = 0x546;
internal const int ERROR_CANNOT_IMPERSONATE = 0x558;
internal const int ERROR_CLASS_ALREADY_EXISTS = 0x582;
internal const int ERROR_NO_SYSTEM_RESOURCES = 0x5AA;
internal const int ERROR_TIMEOUT = 0x5B4;
internal const int ERROR_EVENTLOG_FILE_CHANGED = 0x5DF;
internal const int ERROR_TRUSTED_RELATIONSHIP_FAILURE = 0x6FD;
internal const int ERROR_RESOURCE_LANG_NOT_FOUND = 0x717;
internal const int EFail = unchecked((int)0x80004005);
internal const int E_FILENOTFOUND = unchecked((int)0x80070002);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

internal partial class Interop
internal static partial class Interop
{
internal partial class Kernel32
internal static partial class Kernel32
{
internal const int WAIT_TIMEOUT = 0x00000102;
internal const int WAIT_OBJECT_0 = 0x00000000;
internal const int WAIT_ABANDONED = 0x00000080;

internal const int MAXIMUM_ALLOWED = 0x02000000;
internal const int SYNCHRONIZE = 0x00100000;
internal const int MUTEX_MODIFY_STATE = 0x00000001;
internal const int SEMAPHORE_MODIFY_STATE = 0x00000002;
internal const int EVENT_MODIFY_STATE = 0x00000002;
}
}
1 change: 1 addition & 0 deletions src/libraries/Common/src/System/HResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ internal static class HResults
internal const int CTL_E_PERMISSIONDENIED = unchecked((int)0x800A0046);
internal const int E_ELEMENTNOTAVAILABLE = unchecked((int)0x802B001F);
internal const int E_ELEMENTNOTENABLED = unchecked((int)0x802B001E);
internal const int E_FILENOTFOUND = unchecked((int)0x80070002);
internal const int E_FAIL = unchecked((int)0x80004005);
internal const int E_HANDLE = unchecked((int)0x80070006);
internal const int E_ILLEGAL_DELEGATE_ASSIGNMENT = unchecked((int)0x80000018);
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/Common/tests/Common.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
<Link>Common\Interop\Windows\Interop.Libraries.cs</Link>
</Compile>
<Compile Include="Tests\System\IO\PathInternal.Windows.Tests.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Kernel32\Interop.FormatMessage.cs">
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.FormatMessage.cs">
<Link>Common\Interop\Windows\kernel32\Interop.FormatMessage.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Windows\Interop.Errors.cs">
Expand All @@ -173,7 +173,7 @@
<Compile Include="$(CoreLibSharedDir)System\IO\PathInternal.Unix.cs">
<Link>System\IO\PathInternal.Unix.cs</Link>
</Compile>
<Compile Include="$(CoreLibSharedDir)Interop\Unix\System.Native\Interop.PathConf.cs">
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.PathConf.cs">
<Link>Common\Interop\Unix\Interop.PathConf.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Unix\Interop.Libraries.cs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</ItemGroup>
<!-- Windows imports -->
<ItemGroup>
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Kernel32\Interop.GetCurrentProcess_IntPtr.cs">
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetCurrentProcess_IntPtr.cs">
<Link>Common\Interop\Windows\Kernel32\Interop.GetCurrentProcess_IntPtr.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Windows\NtDll\Interop.RTL_OSVERSIONINFOEX.cs">
Expand All @@ -47,8 +47,8 @@
<Compile Include="$(CommonPath)Interop\Windows\Interop.Libraries.cs">
<Link>Common\Interop\Windows\Interop.Libraries.cs</Link>
</Compile>
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Kernel32\Interop.CloseHandle.cs">
<Link>Interop\Windows\Kernel32\Interop.CloseHandle.cs</Link>
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.CloseHandle.cs">
<Link>Common\Interop\Windows\Kernel32\Interop.CloseHandle.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Windows\Advapi32\Interop.TOKEN_INFORMATION_CLASS.cs">
<Link>Common\Interop\Windows\Advapi32\Interop.TOKEN_INFORMATION_CLASS.cs</Link>
Expand All @@ -59,16 +59,16 @@
<Compile Include="$(CommonPath)Interop\Windows\Advapi32\Interop.TOKEN_ELEVATION.cs">
<Link>Common\Interop\Windows\Advapi32\Interop.TOKEN_ELEVATION.cs</Link>
</Compile>
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Interop.BOOL.cs">
<Link>Interop\Windows\Interop.BOOL.cs</Link>
<Compile Include="$(CommonPath)Interop\Windows\Interop.BOOL.cs">
<Link>Common\Interop\Windows\Interop.BOOL.cs</Link>
</Compile>
</ItemGroup>
<!-- Unix imports -->
<ItemGroup>
<Compile Include="$(CommonPath)Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSslVersion.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSslVersion.cs</Link>
</Compile>
<Compile Include="$(CoreLibSharedDir)Interop\Unix\System.Native\Interop.GetEUid.cs">
<Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.GetEUid.cs">
<Link>Common\Interop\Unix\Interop.GetEUid.cs</Link>
</Compile>
</ItemGroup>
Expand All @@ -78,4 +78,4 @@
<PackageReference Include="xunit.assert" Version="$(XUnitVersion)" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(MicrosoftDotNetPlatformAbstractionsVersion)" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
</PropertyGroup>
<!-- Default configurations to help VS understand the options -->
<ItemGroup>
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Interop.Errors.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Interop.Libraries.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Advapi32\Interop.ActivityControl.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Advapi32\Interop.EtwEnableCallback.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Advapi32\Interop.EVENT_INFO_CLASS.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Advapi32\Interop.EventActivityIdControl.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Advapi32\Interop.EventRegister.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Advapi32\Interop.EventSetInformation.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Advapi32\Interop.EventTraceGuidsEx.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Advapi32\Interop.EventUnregister.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Advapi32\Interop.EventWriteString.cs" />
<Compile Include="$(CoreLibSharedDir)Interop\Windows\Advapi32\Interop.EventWriteTransfer.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Interop.Errors.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Interop.Libraries.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Advapi32\Interop.ActivityControl.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Advapi32\Interop.EtwEnableCallback.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Advapi32\Interop.EVENT_INFO_CLASS.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Advapi32\Interop.EventActivityIdControl.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Advapi32\Interop.EventRegister.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Advapi32\Interop.EventSetInformation.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Advapi32\Interop.EventTraceGuidsEx.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Advapi32\Interop.EventUnregister.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Advapi32\Interop.EventWriteString.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Advapi32\Interop.EventWriteTransfer.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\Tracing\*.cs" />
<Compile Remove="$(CoreLibSharedDir)System\Diagnostics\Tracing\FrameworkEventSource.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\Tracing\TraceLogging\*.cs" />
Expand Down
Loading

0 comments on commit f1c7ed8

Please sign in to comment.