Skip to content

Commit 9bce6ad

Browse files
benrr101Ben Russell
andauthored
Merge | OS Flags (#3810)
* Add pre-processor constants for target OS * Add #if _WINDOWS to the Interop/Windows files * Split out the netfx methods and junk from AdapterUtil * Split netcore junk from AdapterUtil into a separate file. Oh wait, two methods that had separate implementations were identical... * Merge the unix and windows version of AdapterUtil back into the main partial. This file is too big to come up with a consistent way to split all this stuff up. * Consolidate windows/unix versions of SqlDataSourceEnumerator into one file * Merging DbConnectionPoolIdentity os-specific versions into the generic class. Cleaned up some code (removed redundant parentheses, split some long lines, removed always-false variables) * Add os #if wrappers to LocalDbApi * Apply #if wrappers to LocalDB files * Merge the SslOverTdsStream files together * Split PacketHandle.Windows into PacketHandle.netcore.windows and PacketHandle.netfx. * Wrap PacketHandle.netcore.unix in _UNIX * Split Sessionhandle.Windows into SessionHandle.netcore.Windows and SessionHandle.netfx. This really makes these classes easier to read. * Wrap SessionHandle.netcore.unix in _UNIX flag * Wrap SqlColumnEncryptionCngProvider in _UNIX and _WINDOWS * Wrap SqlColumnEncryptionCspProvider in _UNIX and _WINDOWS * Wrap TdsParserSafeHandles.windows in _WINDOWS * Add _UNIX wrapper to TdsParserStateObjectFactory.unix.cs * Wrap TdsParseStateObject[Managed.netcore|Native.windows] in their respective #if's * Wrap SqlFileStream files in appropriate #if * Remove ILLink.Substitutions.Unix.xml and embed it in LocalAppContextSwitches * Conditionally include ILLink.Substitutions.xml for windows *sigh* * Make CodeAnalysis be a netfx-only file, remove unused attributes, and add comment explaining why this file exists. * Rename SqlBatchCommand.Net8OrGreater.cs to SqlBatchCommand.netcore.cs * Wrap SqlDataSourceEnumeratorNativeHelper.cs in windows and rename to indicate that it only applies to Windows. * Bring in all files for the netcore project, re-sort them, make sure logical paths match the actual path * Netcore project embedded resources * Get rid of TargetsWindows/TargetsUnix * Bring in all files for the netcore project, re-sort them, make sure logical paths match the actual path * Resource files in netfx project * Sort a few of the netfx properties to match netcore 🤷 * First round of PR comments * Fix file inclusion * Fix "unreachable code detected" issue in unix build * Addressing comments from @paulmedynski * Add OS constants to test common project, wrap app context switches that are platform specific in Fix case-sensitivity issues in netfx project * Reinstate _WINDOWS check on windows-only netfx files, force _WINDOWS on netfx project, remove explicit NETFRAMEWORK definition in netfx b/c the sdk does it. --------- Co-authored-by: Ben Russell <ben@holycrapitsbenrussell>
1 parent 5e14b56 commit 9bce6ad

File tree

91 files changed

+1712
-1434
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1712
-1434
lines changed

build.proj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@
153153
<MSBuild Projects="@(NetCoreDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=Windows_NT;" RemoveProperties="TargetsWindows;TargetsUnix;" Condition="'$(IsEnabledWindows)' == 'true'" />
154154
<MSBuild Projects="@(NetCoreDriver)" Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=AnyOS;" RemoveProperties="TargetsWindows;TargetsUnix;" />
155155
</Target>
156+
157+
<Target Name="BuildNetCoreUnix" DependsOnTargets="RestoreNetCore">
158+
<MSBuild Projects="@(NetCoreDriver)"
159+
Properties="$(CI);$(ProjectProperties);Platform=AnyCPU;OSGroup=Unix;"
160+
RemoveProperties="TargetsWindows;TargetsUnix;" />
161+
</Target>
162+
156163
<!-- Build .NET Standard target DLLs for Lib folder from here.
157164
This target enables BuildForLib for the NetCore ref project. -->
158165
<Target Name="BuildNetStandard">

src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj

Lines changed: 302 additions & 316 deletions
Large diffs are not rendered by default.

src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj

Lines changed: 239 additions & 223 deletions
Large diffs are not rendered by default.

src/Microsoft.Data.SqlClient/src/Interop/Windows/Handles/SafeLibraryHandle.netcore.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using Microsoft.Win32.SafeHandles;
5+
#if NET && _WINDOWS
66

7-
#if NET
7+
using Microsoft.Win32.SafeHandles;
88

99
namespace Interop.Windows.Handles
1010
{

src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/FileTypes.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#if _WINDOWS
6+
57
namespace Interop.Windows.Kernel32
68
{
79
internal class FileTypes
@@ -12,3 +14,5 @@ internal class FileTypes
1214
internal const int FILE_TYPE_PIPE = 0x0003;
1315
}
1416
}
17+
18+
#endif

src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/IoControlCodeAccess.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#if _WINDOWS
6+
57
using System;
68

79
namespace Interop.Windows.Kernel32
@@ -31,3 +33,5 @@ public enum IoControlCodeAccess
3133
FILE_WRITE_DATA = 0x02
3234
}
3335
}
36+
37+
#endif

src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/IoControlTransferType.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#if _WINDOWS
6+
57
namespace Interop.Windows.Kernel32
68
{
79
/// <summary>
@@ -35,3 +37,5 @@ public enum IoControlTransferType
3537
METHOD_NEITHER
3638
}
3739
}
40+
41+
#endif

src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#if _WINDOWS
6+
57
using System;
68
using System.Runtime.InteropServices;
79
using System.Runtime.Versioning;
@@ -92,3 +94,5 @@ internal static extern int GetFullPathName(
9294
internal static extern bool SetThreadErrorMode(uint dwNewMode, out uint lpOldMode);
9395
}
9496
}
97+
98+
#endif

src/Microsoft.Data.SqlClient/src/Interop/Windows/Kernel32/Kernel32Safe.netfx.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
#if NETFRAMEWORK
5+
#if NETFRAMEWORK && _WINDOWS
66

77
using System;
88
using System.Runtime.InteropServices;
99
using System.Runtime.Versioning;
1010
using System.Security;
11-
using System.Text;
1211

1312
namespace Interop.Windows.Kernel32
1413
{

src/Microsoft.Data.SqlClient/src/Interop/Windows/NtDll/CreateDisposition.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#if _WINDOWS
6+
57
namespace Interop.Windows.NtDll
68
{
79
/// <summary>
@@ -54,3 +56,5 @@ internal enum CreateDisposition : uint
5456
FILE_OVERWRITE_IF = 5
5557
}
5658
}
59+
60+
#endif

0 commit comments

Comments
 (0)