Skip to content

Commit 4cc05e4

Browse files
authored
Add .NET 6 support to .NET bindings (#11298)
1 parent a23df91 commit 4cc05e4

File tree

13 files changed

+36
-17
lines changed

13 files changed

+36
-17
lines changed

WORKSPACE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ pinned_maven_install()
131131

132132
http_archive(
133133
name = "d2l_rules_csharp",
134-
sha256 = "7b2a83621049904b6e898ffdbe7893a5b410aedf599d63f127ef81eac839b6c1",
135-
strip_prefix = "rules_csharp-bf24e589bbadcc20f15a16e13f577a0abd42a1d1",
134+
sha256 = "c0152befb1fd0e08527b38e41ef00b6627f9f0c2be6f2d23a4950f41701fa48a",
135+
strip_prefix = "rules_csharp-50e2f6c79e7a53e50b4518239b5ebcc61279759e",
136136
urls = [
137-
"https://github.com/Brightspace/rules_csharp/archive/bf24e589bbadcc20f15a16e13f577a0abd42a1d1.tar.gz",
137+
"https://github.com/Brightspace/rules_csharp/archive/50e2f6c79e7a53e50b4518239b5ebcc61279759e.tar.gz",
138138
],
139139
)
140140

dotnet/private/executable_assembly.bzl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
load("@d2l_rules_csharp//csharp/private:providers.bzl", "AnyTargetFrameworkInfo")
22
load("@d2l_rules_csharp//csharp/private:actions/assembly.bzl", "AssemblyAction")
3-
load("@d2l_rules_csharp//csharp/private:actions/write_runtimeconfig.bzl", "write_runtimeconfig")
3+
load("@d2l_rules_csharp//csharp/private:actions/misc.bzl", "write_runtimeconfig")
44
load(
55
"@d2l_rules_csharp//csharp/private:common.bzl",
66
"fill_in_missing_frameworks",
@@ -18,7 +18,7 @@ def _generate_execution_script_file(ctx, target):
1818
if ctx.attr.is_windows:
1919
shell_file_extension = "bat"
2020
execution_line = "%~dp0" + assembly_file_name + " %*"
21-
if is_core_framework(tfm) or tfm == "net5.0":
21+
if is_core_framework(tfm) or tfm == "net5.0" or tfm == "net6.0":
2222
execution_line = "dotnet " + execution_line
2323
else:
2424
execution_line = "mono " + execution_line
@@ -66,23 +66,25 @@ def create_executable_assembly(ctx, extra_srcs, extra_deps):
6666

6767
providers[tfm] = AssemblyAction(
6868
ctx.actions,
69-
name = ctx.attr.name,
7069
additionalfiles = ctx.files.additionalfiles,
7170
analyzers = ctx.attr.analyzers,
7271
debug = is_debug(ctx),
7372
defines = ctx.attr.defines,
7473
deps = ctx.attr.deps + extra_deps + stdrefs,
7574
keyfile = ctx.file.keyfile,
75+
internals_visible_to = None,
76+
internals_visible_to_cs = None,
7677
langversion = ctx.attr.langversion,
7778
resources = ctx.files.resources,
7879
srcs = ctx.files.srcs + extra_srcs,
7980
out = ctx.attr.out,
8081
target = "exe",
82+
target_name = ctx.attr.name,
8183
target_framework = tfm,
8284
toolchain = ctx.toolchains["@d2l_rules_csharp//csharp/private:toolchain_type"],
8385
)
8486

85-
fill_in_missing_frameworks(providers)
87+
fill_in_missing_frameworks(ctx.attr.out, providers)
8688

8789
result = providers.values()
8890
dependency_files_list = _copy_dependency_files(ctx, result[0])
@@ -108,7 +110,7 @@ def create_executable_assembly(ctx, extra_srcs, extra_deps):
108110
files = direct_runfiles,
109111
transitive_files = depset(dependency_files_list, transitive = data_runfiles),
110112
),
111-
files = depset([result[0].out, result[0].refout, result[0].pdb, shell_file]),
113+
files = depset([result[0].out, result[0].prefout, result[0].pdb, shell_file]),
112114
))
113115

114116
return result

dotnet/private/merge_assemblies.bzl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _merged_assembly_impl(ctx):
3434

3535
args.append("-out={}".format(output_assembly.path))
3636
args.append(input_assembly.path)
37-
(refs, runfiles, native_dlls) = collect_transitive_info(deps, target_framework)
37+
(refs, runfiles, native_dlls) = collect_transitive_info(name, deps, target_framework)
3838
for ref in refs.to_list():
3939
args.append(ref.path)
4040

@@ -56,7 +56,9 @@ def _merged_assembly_impl(ctx):
5656

5757
providers[target_framework] = CSharpAssemblyInfo[target_framework](
5858
out = output_assembly,
59-
refout = None,
59+
prefout = None,
60+
irefout = None,
61+
internals_visible_to = [],
6062
pdb = output_pdb,
6163
native_dlls = native_dlls,
6264
deps = deps,
@@ -66,7 +68,7 @@ def _merged_assembly_impl(ctx):
6668
runtimeconfig = None,
6769
)
6870

69-
fill_in_missing_frameworks(providers)
71+
fill_in_missing_frameworks(name, providers)
7072
returned_info = providers.values()
7173
returned_info.append(
7274
DefaultInfo(

dotnet/selenium-dotnet-version.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
SE_VERSION = "4.6.0"
44
ASSEMBLY_VERSION = "4.0.0.0"
55
SUPPORTED_NET_FRAMEWORKS = ["net45", "net46", "net47", "net48"]
6-
SUPPORTED_NET_STANDARD_VERSIONS = ["netstandard2.0", "netstandard2.1", "net5.0"]
6+
SUPPORTED_NET_STANDARD_VERSIONS = ["netstandard2.0", "netstandard2.1", "net5.0", "net6.0"]
77

88
SUPPORTED_DEVTOOLS_VERSIONS = [
99
"v85",

dotnet/src/support/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ nuget_package(
140140
":net47",
141141
":net48",
142142
":net5.0",
143+
":net6.0",
143144
":netstandard2.0",
144145
":netstandard2.1",
145146
],
@@ -161,6 +162,7 @@ nuget_package(
161162
":net47-strongnamed",
162163
":net48-strongnamed",
163164
":net5.0-strongnamed",
165+
":net6.0-strongnamed",
164166
":netstandard2.0-strongnamed",
165167
":netstandard2.1-strongnamed",
166168
],

dotnet/src/support/WebDriver.Support.nuspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
<group targetFramework="net5.0">
4848
<dependency id="Selenium.WebDriver" version="$version$" exclude="Build,Analyzers" />
4949
</group>
50+
<group targetFramework="net6.0">
51+
<dependency id="Selenium.WebDriver" version="$version$" exclude="Build,Analyzers" />
52+
</group>
5053
</dependencies>
5154
<frameworkAssemblies>
5255
<frameworkAssembly assemblyName="System.Drawing" />

dotnet/src/webdriver/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ nuget_package(
286286
":net47",
287287
":net48",
288288
":net5.0",
289+
":net6.0",
289290
":netstandard2.0",
290291
":netstandard2.1",
291292
],
@@ -307,6 +308,7 @@ nuget_package(
307308
":net47-strongnamed",
308309
":net48-strongnamed",
309310
":net5.0-strongnamed",
311+
":net6.0-strongnamed",
310312
":netstandard2.0-strongnamed",
311313
":netstandard2.1-strongnamed",
312314
],

dotnet/src/webdriver/Screenshot.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// </copyright>
1818

1919
using System;
20-
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP2_1 || NETSTANDARD2_1 || NET5_0
20+
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP2_1 || NETSTANDARD2_1 || NET5_0 || NET6_0
2121
#else
2222
using System.Drawing;
2323
using System.Drawing.Imaging;
@@ -100,7 +100,7 @@ public void SaveAsFile(string fileName, ScreenshotImageFormat format)
100100
{
101101
using (FileStream fileStream = new FileStream(fileName, FileMode.Create))
102102
{
103-
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP2_1 || NETSTANDARD2_1 || NET5_0
103+
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP2_1 || NETSTANDARD2_1 || NET5_0 || NET6_0
104104
imageStream.WriteTo(fileStream);
105105
#else
106106
using (Image screenshotImage = Image.FromStream(imageStream))
@@ -112,7 +112,7 @@ public void SaveAsFile(string fileName, ScreenshotImageFormat format)
112112
}
113113
}
114114

115-
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP2_1 || NETSTANDARD2_1 || NET5_0
115+
#if NETCOREAPP2_0 || NETSTANDARD2_0 || NETCOREAPP2_1 || NETSTANDARD2_1 || NET5_0 || NET6_0
116116
#else
117117
private static ImageFormat ConvertScreenshotImageFormat(ScreenshotImageFormat format)
118118
{

dotnet/src/webdriver/WebDriver.nuspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
<group targetFramework="net5.0">
4040
<dependency id="Newtonsoft.Json" version="13.0.1" exclude="Build,Analyzers" />
4141
</group>
42+
<group targetFramework="net6.0">
43+
<dependency id="Newtonsoft.Json" version="13.0.1" exclude="Build,Analyzers" />
44+
</group>
4245
</dependencies>
4346
<frameworkAssemblies>
4447
<frameworkAssembly assemblyName="System.Drawing" />

dotnet/src/webdriverbackedselenium/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ nuget_package(
197197
":net47",
198198
":net48",
199199
":net5.0",
200+
":net6.0",
200201
":netstandard2.0",
201202
":netstandard2.1",
202203
],
@@ -219,6 +220,7 @@ nuget_package(
219220
":net47-strongnamed",
220221
":net48-strongnamed",
221222
":net5.0-strongnamed",
223+
":net6.0-strongnamed",
222224
":netstandard2.0-strongnamed",
223225
":netstandard2.1-strongnamed",
224226
],

0 commit comments

Comments
 (0)