From d55d6ecd14bdbf854f85d955d389ef6bd744640a Mon Sep 17 00:00:00 2001 From: Tarek Mahmoud Sayed Date: Wed, 9 Mar 2016 13:13:37 -0800 Subject: [PATCH] Compile and pack System.Runtime.Extensions as netstandard13aot The purpose of the change is to have aot flavor which not depending on WinRT and to be consumed by corert. Note that as System.Runtime.Extensions depends on System.Private.Uri, we also did the change to have System.Private.Uri support netstandard13aot too --- .../Windows/BCrypt/Interop.NTSTATUS.cs | 1 - .../src/System/OperationCanceledException.cs | 15 ++++++ .../Runtime/InteropServices/Marshal.Unix.cs | 49 +++++++++++++++++++ .../{Marshal.cs => Marshal.Win32.cs} | 0 .../src/System.Private.Uri.builds | 8 +++ .../src/System.Private.Uri.csproj | 29 +++++++---- src/System.Private.Uri/src/project.json | 6 +++ .../src/System.Runtime.Extensions.builds | 8 +++ .../src/System.Runtime.Extensions.csproj | 28 +++++++---- .../src/project.json | 6 +++ 10 files changed, 131 insertions(+), 19 deletions(-) create mode 100644 src/Common/src/System/OperationCanceledException.cs create mode 100644 src/Common/src/System/Runtime/InteropServices/Marshal.Unix.cs rename src/Common/src/System/Runtime/InteropServices/{Marshal.cs => Marshal.Win32.cs} (100%) diff --git a/src/Common/src/Interop/Windows/BCrypt/Interop.NTSTATUS.cs b/src/Common/src/Interop/Windows/BCrypt/Interop.NTSTATUS.cs index ec78838be805..49d674f3993b 100644 --- a/src/Common/src/Interop/Windows/BCrypt/Interop.NTSTATUS.cs +++ b/src/Common/src/Interop/Windows/BCrypt/Interop.NTSTATUS.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Security.Cryptography; internal partial class Interop { diff --git a/src/Common/src/System/OperationCanceledException.cs b/src/Common/src/System/OperationCanceledException.cs new file mode 100644 index 000000000000..92d486129ca8 --- /dev/null +++ b/src/Common/src/System/OperationCanceledException.cs @@ -0,0 +1,15 @@ +// 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; + +namespace System +{ + internal class OperationCanceledException : Exception + { + public OperationCanceledException() + { + } + } +} diff --git a/src/Common/src/System/Runtime/InteropServices/Marshal.Unix.cs b/src/Common/src/System/Runtime/InteropServices/Marshal.Unix.cs new file mode 100644 index 000000000000..cd2294e37570 --- /dev/null +++ b/src/Common/src/System/Runtime/InteropServices/Marshal.Unix.cs @@ -0,0 +1,49 @@ +// 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. + +namespace System.Runtime.InteropServices +{ + // Stand-in type for low-level assemblies to obtain Win32 errors + internal static class Marshal + { + public static int GetLastWin32Error() + { + // issue: https://github.com/dotnet/corefx/issues/6778 + // Need to define and implement this for Linux + return 0; + } + + unsafe public static String PtrToStringAnsi(IntPtr ptr) + { + if (IntPtr.Zero == ptr) + { + return null; + } + + byte *pBytes = (byte *) ptr; + int length = 0; + + while (*pBytes != 0) + { + pBytes++; + length++; + } + + if (length == 0) + { + return String.Empty; + } + + char [] chars = new char[length]; + pBytes = (byte *) ptr; + + for (int i=0; iWindows_NT netcore50aot + + Windows_NT + netstandard13aot + + + Linux + netstandard13aot + diff --git a/src/System.Private.Uri/src/System.Private.Uri.csproj b/src/System.Private.Uri/src/System.Private.Uri.csproj index 7cbc640feb9e..3c5746607d9a 100644 --- a/src/System.Private.Uri/src/System.Private.Uri.csproj +++ b/src/System.Private.Uri/src/System.Private.Uri.csproj @@ -13,7 +13,7 @@ 0436 netstandard1.0 - true + true .NETStandard,Version=v1.0 @@ -27,8 +27,10 @@ + + - + Common\System\Diagnostics\Debug.cs @@ -77,7 +79,7 @@ Common\System\Globalization\IdnMapping.Windows.cs - + Common\System\Diagnostics\Debug.Windows.cs @@ -97,7 +99,7 @@ Common\System\Globalization\IdnMapping.Unix.cs - + Common\System\Diagnostics\Debug.Unix.cs @@ -146,19 +148,28 @@ Common\Microsoft\Win32\SafeHandles\SafeFileHandle.Unix.cs - + - + Common\System\SR.Core.cs + + Common\System\SR.CoreRT.cs + Common\System\Resources\NeutralResourcesLanguageAttribute.cs - - Common\System\Runtime\InteropServices\Marshal.cs + + Common\System\Runtime\InteropServices\Marshal.Win32.cs + + + Common\System\Runtime\InteropServices\Marshal.Unix.cs + + + Common\System\System\OperationCanceledException.cs - + Common\Interop\Windows\mincore\Interop.GetLastError.cs diff --git a/src/System.Private.Uri/src/project.json b/src/System.Private.Uri/src/project.json index 5a5fdd2cb6d0..98bae6a026f2 100644 --- a/src/System.Private.Uri/src/project.json +++ b/src/System.Private.Uri/src/project.json @@ -12,6 +12,12 @@ "dependencies": { "Microsoft.TargetingPack.Private.NETNative": "1.0.0-rc3-23908" } + }, + "netstandard1.3": { + "imports": [ "netcore50" ], + "dependencies": { + "Microsoft.TargetingPack.Private.NETNative": "1.0.0-rc3-23908" + } } } } diff --git a/src/System.Runtime.Extensions/src/System.Runtime.Extensions.builds b/src/System.Runtime.Extensions/src/System.Runtime.Extensions.builds index 864ad172df27..e326e34db98b 100644 --- a/src/System.Runtime.Extensions/src/System.Runtime.Extensions.builds +++ b/src/System.Runtime.Extensions/src/System.Runtime.Extensions.builds @@ -21,6 +21,14 @@ Windows_NT netcore50aot + + Windows_NT + netstandard13aot + + + Linux + netstandard13aot + diff --git a/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj b/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj index 21b5ef138858..7406046c9036 100644 --- a/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj +++ b/src/System.Runtime.Extensions/src/System.Runtime.Extensions.csproj @@ -17,6 +17,9 @@ netstandard1.3 win7 unix + win-aot + unix-aot + true @@ -32,8 +35,10 @@ + + - + true true @@ -112,7 +117,7 @@ - + Common\Interop\Windows\BCrypt\Interop.BCryptGenRandom.cs @@ -162,15 +167,16 @@ - + - - - + + + + @@ -183,14 +189,18 @@ - + - - + + + netcore50aot + + + diff --git a/src/System.Runtime.Extensions/src/project.json b/src/System.Runtime.Extensions/src/project.json index 0a487a76d1c4..0427ac355806 100644 --- a/src/System.Runtime.Extensions/src/project.json +++ b/src/System.Runtime.Extensions/src/project.json @@ -15,6 +15,12 @@ "Microsoft.TargetingPack.Private.NETNative": "1.0.0-rc3-23908", "Microsoft.TargetingPack.Private.WinRT": "1.0.1" } + }, + "netstandard1.3": { + "imports": [ "netcore50" ], + "dependencies": { + "Microsoft.TargetingPack.Private.NETNative": "1.0.0-rc3-23908" + } } } }