Move S.Buffers and S.IO sources shared with corert into shared folder (dotnet/coreclr...
authorAlex Perovich <alperovi@microsoft.com>
Sat, 25 Feb 2017 06:46:59 +0000 (00:46 -0600)
committerJan Kotas <jkotas@microsoft.com>
Sat, 25 Feb 2017 06:46:59 +0000 (22:46 -0800)
Commit migrated from https://github.com/dotnet/coreclr/commit/532c45a27aa2f804ed43448ef1666beeef6c96ae

27 files changed:
src/coreclr/src/mscorlib/System.Private.CoreLib.csproj
src/coreclr/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeThreadPoolIOHandle.cs [deleted file]
src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs [moved from src/coreclr/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs [moved from src/coreclr/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.sources [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/System/Buffers/ArrayPool.cs [moved from src/coreclr/src/mscorlib/corefx/System/Buffers/ArrayPool.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/Buffers/ArrayPoolEventSource.cs [moved from src/coreclr/src/mscorlib/corefx/System/Buffers/ArrayPoolEventSource.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/Buffers/ConfigurableArrayPool.cs [moved from src/coreclr/src/mscorlib/corefx/System/Buffers/ConfigurableArrayPool.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/Buffers/TlsOverPerCoreLockedStacksArrayPool.cs [moved from src/coreclr/src/mscorlib/corefx/System/Buffers/TlsOverPerCoreLockedStacksArrayPool.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/Buffers/Utilities.cs [moved from src/coreclr/src/mscorlib/corefx/System/Buffers/Utilities.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/Error.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/Error.cs with 88% similarity]
src/coreclr/src/mscorlib/shared/System/IO/FileStream.Linux.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/FileStream.Linux.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/FileStream.OSX.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/FileStream.OSX.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/FileStream.Unix.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/FileStream.Unix.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/FileStream.Win32.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/FileStream.Win32.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/FileStream.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/FileStream.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/FileStreamCompletionSource.Win32.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/Path.Unix.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/Path.Unix.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/Path.Win32.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/Path.Win32.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/Path.Windows.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/Path.Windows.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/Path.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/Path.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/PathHelper.Windows.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/PathHelper.Windows.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/PathInternal.Unix.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/PathInternal.Unix.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/PathInternal.Windows.StringBuffer.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/PathInternal.Windows.StringBuffer.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/PathInternal.Windows.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/PathInternal.Windows.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/PathInternal.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/PathInternal.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/IO/Win32Marshal.cs [moved from src/coreclr/src/mscorlib/corefx/System/IO/Win32Marshal.cs with 100% similarity]

index d2b443f..f5d9817 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <!-- Always use latest Roslyn compiler -->
   <Import Project="..\..\Tools\net45\roslyn\build\Microsoft.Net.Compilers.props" Condition="'$(OS)'=='Windows_NT'" />
     <MscorlibSources Condition="'$(FeatureCominterop)' == 'true'" Include="$(BclSourcesRoot)\System\Threading\Tasks\IAsyncCausalityTracerStatics.cs" />
   </ItemGroup>
   <ItemGroup>
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\FileStream.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\Error.cs" />
-  </ItemGroup>
-  <ItemGroup Condition="'$(TargetsUnix)' == 'true'">
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\Microsoft\Win32\SafeHandles\SafeFileHandle.Unix.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\FileStream.Unix.cs" />
-  </ItemGroup>
-  <ItemGroup Condition="'$(TargetsUnix)' == 'true' and '$(TargetsOSX)' == 'true'">
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\FileStream.OSX.cs" />
-  </ItemGroup>
-  <ItemGroup Condition="'$(TargetsUnix)' == 'true' and '$(TargetsOSX)' != 'true'">
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\FileStream.Linux.cs" />
-  </ItemGroup>
-  <ItemGroup Condition="'$(TargetsUnix)' != 'true'">
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\Microsoft\Win32\SafeHandles\SafeFileHandle.Windows.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\FileStream.Win32.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\FileStreamCompletionSource.Win32.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\Win32Marshal.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\Path.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\PathInternal.cs" />
-  </ItemGroup>
-  <ItemGroup Condition="'$(TargetsUnix)' == 'true'">
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\Path.Unix.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\PathInternal.Unix.cs" />
-  </ItemGroup>
-  <ItemGroup Condition="'$(TargetsUnix)' != 'true'">
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\Path.Win32.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\Path.Windows.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\PathHelper.Windows.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\PathInternal.Windows.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\IO\PathInternal.Windows.StringBuffer.cs" />
-  </ItemGroup>
-  <ItemGroup>
     <MscorlibSources Include="$(CoreFxSourcesRoot)\System\Threading\DeferredDisposableLifetime.cs" />
     <MscorlibSources Include="$(CoreFxSourcesRoot)\System\Threading\ClrThreadPoolBoundHandle.cs" />
     <MscorlibSources Include="$(CoreFxSourcesRoot)\System\Threading\ClrThreadPoolBoundHandleOverlapped.cs" />
     <MscorlibSources Include="$(BclSourcesRoot)\System\Numerics\Hashing\HashHelpers.cs" />
   </ItemGroup>
   <ItemGroup>
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\Buffers\ArrayPool.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\Buffers\ArrayPoolEventSource.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\Buffers\ConfigurableArrayPool.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\Buffers\TlsOverPerCoreLockedStacksArrayPool.cs" />
-    <MscorlibSources Include="$(CoreFxSourcesRoot)\System\Buffers\Utilities.cs" />
     <MscorlibSources Include="$(CoreFxSourcesRoot)\System\Security\CryptographicException.cs" />
   </ItemGroup>
   <ItemGroup Condition="'$(TargetsUnix)' != 'true'">
     <!-- TODO list of types to be cleaned up from CoreLib -->
     <MscorlibSources Include="$(BclSourcesRoot)\CleanupToDoList.cs" />
   </ItemGroup>
+
+  <Import Project="$(MSBuildThisFileDirectory)\shared\System.Private.CoreLib.Shared.sources"/>
+
   <ItemGroup>
     <!-- We want the sources to show up nicely in VS-->
     <Compile Include="@(MscorlibSources)">
   </PropertyGroup>
   <Import Project="GenerateSplitStringResources.targets" />
   <Import Project="GenerateCompilerResponseFile.targets" />
-</Project>
\ No newline at end of file
+</Project>
diff --git a/src/coreclr/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeThreadPoolIOHandle.cs b/src/coreclr/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeThreadPoolIOHandle.cs
deleted file mode 100644 (file)
index 3dbc2bb..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Microsoft.Win32.SafeHandles
-{
-    internal class SafeThreadPoolIOHandle : SafeHandle
-    {
-        private SafeThreadPoolIOHandle() 
-            : base(IntPtr.Zero, true)
-        {
-        }
-
-        public override bool IsInvalid
-        {
-            get { return handle == IntPtr.Zero; }
-        }
-
-        protected override bool ReleaseHandle()
-        {
-            Interop.mincore.CloseThreadpoolIo(handle);
-            return true;
-        }
-    }
-}
diff --git a/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.sources b/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.sources
new file mode 100644 (file)
index 0000000..211b25e
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <TargetsWindows Condition="'$(TargetsWindows)' != 'true'">false</TargetsWindows>
+    <TargetsUnix Condition="'$(TargetsUnix)' != 'true'">false</TargetsUnix>
+    <TargetsOSX Condition="'$(TargetsOSX)' != 'true'">false</TargetsOSX>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Buffers\ArrayPool.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Buffers\ArrayPoolEventSource.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Buffers\ConfigurableArrayPool.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Buffers\TlsOverPerCoreLockedStacksArrayPool.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\Buffers\Utilities.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\Error.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\FileStream.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\Path.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\PathInternal.cs"/>
+  </ItemGroup>
+  <ItemGroup Condition="$(TargetsWindows)">
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\FileStream.Win32.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\FileStreamCompletionSource.Win32.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\Path.Win32.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\Path.Windows.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\PathHelper.Windows.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\PathInternal.Windows.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\PathInternal.Windows.StringBuffer.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\Win32Marshal.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\Microsoft\Win32\SafeHandles\SafeFileHandle.Windows.cs"/>
+  </ItemGroup>
+  <ItemGroup Condition="$(TargetsUnix)">
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\FileStream.Unix.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\Path.Unix.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\PathInternal.Unix.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)\Microsoft\Win32\SafeHandles\SafeFileHandle.Unix.cs"/>
+  </ItemGroup>
+  <ItemGroup Condition="$(TargetsUnix) and $(TargetsOSX)">
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\FileStream.OSX.cs"/>
+  </ItemGroup>
+  <ItemGroup Condition="$(TargetsUnix) and !$(TargetsOSX)">
+    <Compile Include="$(MSBuildThisFileDirectory)\System\IO\FileStream.Linux.cs"/>
+  </ItemGroup>
+</Project>
@@ -16,6 +16,11 @@ namespace System.IO
     [Pure]
     internal static class Error
     {
+        internal static Exception GetStreamIsClosed()
+        {
+            return new ObjectDisposedException(null, SR.ObjectDisposed_StreamIsClosed);
+        }
+
         internal static Exception GetEndOfFile()
         {
             return new EndOfStreamException(SR.IO_EOF_ReadBeyondEOF);