Skip to content

Commit

Permalink
Add support for netcoreapp3.1 (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
j3parker committed Oct 27, 2020
1 parent c16ca81 commit 0e747ba
Show file tree
Hide file tree
Showing 9 changed files with 2,140 additions and 5 deletions.
1,962 changes: 1,962 additions & 0 deletions csharp/private/frameworks/netcoreapp31.BUILD

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion csharp/private/macros/setup_basic_nuget_package.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Rules for interfacing with NuGet packages.
Rules for interfacing with NuGet packages.
"""
load("//csharp/private:providers.bzl", "CSharpAssemblyInfo")
load("//csharp/private:rules/imports.bzl", "import_library", "import_multiframework_library")
Expand Down Expand Up @@ -103,4 +103,5 @@ def setup_basic_nuget_package():
netcoreapp2_1 = tfms.get("netcoreapp2.1"),
netcoreapp2_2 = tfms.get("netcoreapp2.2"),
netcoreapp3_0 = tfms.get("netcoreapp3.0"),
netcoreapp3_1 = tfms.get("netcoreapp3.1"),
)
152 changes: 152 additions & 0 deletions csharp/private/net/BUILD

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions csharp/private/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ CSharpAssemblyNetCoreApp20Info = _make_csharp_provider("netcoreapp2.0")
CSharpAssemblyNetCoreApp21Info = _make_csharp_provider("netcoreapp2.1")
CSharpAssemblyNetCoreApp22Info = _make_csharp_provider("netcoreapp2.2")
CSharpAssemblyNetCoreApp30Info = _make_csharp_provider("netcoreapp3.0")
CSharpAssemblyNetCoreApp31Info = _make_csharp_provider("netcoreapp3.1")

# A dict from TFM to provider. The order of keys is not used.
CSharpAssemblyInfo = {
Expand Down Expand Up @@ -91,6 +92,7 @@ CSharpAssemblyInfo = {
"netcoreapp2.1": CSharpAssemblyNetCoreApp21Info,
"netcoreapp2.2": CSharpAssemblyNetCoreApp22Info,
"netcoreapp3.0": CSharpAssemblyNetCoreApp30Info,
"netcoreapp3.1": CSharpAssemblyNetCoreApp31Info,
}

# A dict of target frameworks to the set of other framworks it can compile
Expand Down Expand Up @@ -135,6 +137,7 @@ FRAMEWORK_COMPATIBILITY = {
"netcoreapp2.1": ["netcoreapp2.0"],
"netcoreapp2.2": ["netcoreapp2.1"],
"netcoreapp3.0": ["netcoreapp2.2", "netstandard2.1"],
"netcoreapp3.1": ["netcoreapp3.0"],
}

_subsystem_version = {
Expand Down Expand Up @@ -170,6 +173,7 @@ _subsystem_version = {
"netcoreapp2.1": None,
"netcoreapp2.2": None,
"netcoreapp3.0": None,
"netcoreapp3.1": None,
}

_default_lang_version = {
Expand Down Expand Up @@ -205,6 +209,7 @@ _default_lang_version = {
"netcoreapp2.1": "7.3",
"netcoreapp2.2": "7.3",
"netcoreapp3.0": "8.0",
"netcoreapp3.1": "8.0",
}

def GetFrameworkVersionInfo(tfm):
Expand Down
8 changes: 8 additions & 0 deletions csharp/private/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ def _net_workspace():
build_file = "@d2l_rules_csharp//csharp/private:frameworks/netcoreapp30.BUILD",
)

nuget_package(
name = "netcoreapp3.1",
package = "Microsoft.NETCore.App.Ref",
version = "3.1.0",
sha256 = "9ee02f1f0989dacdce6f5a8d0c7d7eb95ddac0e65a5a5695dc57a74e63d45b23",
build_file = "@d2l_rules_csharp//csharp/private:frameworks/netcoreapp31.BUILD",
)

# .NET Standard (& .NET Core)
nuget_package(
name = "NetStandard.Library",
Expand Down
1 change: 1 addition & 0 deletions csharp/private/rules/imports.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def _import_multiframework_library_impl(ctx):
"netcoreapp2.1": ctx.attr.netcoreapp2_1,
"netcoreapp2.2": ctx.attr.netcoreapp2_2,
"netcoreapp3.0": ctx.attr.netcoreapp3_0,
"netcoreapp3.1": ctx.attr.netcoreapp3_1,
}

providers = {}
Expand Down
3 changes: 2 additions & 1 deletion docs/APIReference.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Creates a target for a static C# DLL for a specific target framework
import_multiframework_library(<a href="#import_multiframework_library-name">name</a>, <a href="#import_multiframework_library-net11">net11</a>, <a href="#import_multiframework_library-net20">net20</a>, <a href="#import_multiframework_library-net30">net30</a>, <a href="#import_multiframework_library-net35">net35</a>, <a href="#import_multiframework_library-net40">net40</a>, <a href="#import_multiframework_library-net403">net403</a>, <a href="#import_multiframework_library-net45">net45</a>, <a href="#import_multiframework_library-net451">net451</a>,
<a href="#import_multiframework_library-net452">net452</a>, <a href="#import_multiframework_library-net46">net46</a>, <a href="#import_multiframework_library-net461">net461</a>, <a href="#import_multiframework_library-net462">net462</a>, <a href="#import_multiframework_library-net47">net47</a>, <a href="#import_multiframework_library-net471">net471</a>, <a href="#import_multiframework_library-net472">net472</a>, <a href="#import_multiframework_library-net48">net48</a>,
<a href="#import_multiframework_library-netcoreapp1_0">netcoreapp1_0</a>, <a href="#import_multiframework_library-netcoreapp1_1">netcoreapp1_1</a>, <a href="#import_multiframework_library-netcoreapp2_0">netcoreapp2_0</a>, <a href="#import_multiframework_library-netcoreapp2_1">netcoreapp2_1</a>,
<a href="#import_multiframework_library-netcoreapp2_2">netcoreapp2_2</a>, <a href="#import_multiframework_library-netcoreapp3_0">netcoreapp3_0</a>, <a href="#import_multiframework_library-netstandard">netstandard</a>, <a href="#import_multiframework_library-netstandard1_0">netstandard1_0</a>,
<a href="#import_multiframework_library-netcoreapp2_2">netcoreapp2_2</a>, <a href="#import_multiframework_library-netcoreapp3_0">netcoreapp3_0</a>, <a href="#import_multiframework_library-netcoreapp3_1">netcoreapp3_1</a>, <a href="#import_multiframework_library-netstandard">netstandard</a>, <a href="#import_multiframework_library-netstandard1_0">netstandard1_0</a>,
<a href="#import_multiframework_library-netstandard1_1">netstandard1_1</a>, <a href="#import_multiframework_library-netstandard1_2">netstandard1_2</a>, <a href="#import_multiframework_library-netstandard1_3">netstandard1_3</a>, <a href="#import_multiframework_library-netstandard1_4">netstandard1_4</a>,
<a href="#import_multiframework_library-netstandard1_5">netstandard1_5</a>, <a href="#import_multiframework_library-netstandard1_6">netstandard1_6</a>, <a href="#import_multiframework_library-netstandard2_0">netstandard2_0</a>, <a href="#import_multiframework_library-netstandard2_1">netstandard2_1</a>)
</pre>
Expand Down Expand Up @@ -179,6 +179,7 @@ Aggregate import_library targets for specific target-frameworks into one target
| netcoreapp2_1 | The netcoreapp2.1 version of this library | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
| netcoreapp2_2 | The netcoreapp2.2 version of this library | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
| netcoreapp3_0 | The netcoreapp3.0 version of this library | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
| netcoreapp3_1 | The netcoreapp3.1 version of this library | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
| netstandard | The netstandard version of this library | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
| netstandard1_0 | The netstandard1.0 version of this library | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
| netstandard1_1 | The netstandard1.1 version of this library | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
Expand Down
6 changes: 3 additions & 3 deletions examples/basic/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ load(
csharp_binary(
name = "hello",
srcs = ["hello.cs"],
target_frameworks = ["netcoreapp3.0"],
target_frameworks = ["netcoreapp3.1"],
deps = [":lib"],
)

Expand All @@ -20,12 +20,12 @@ csharp_binary(
csharp_nunit_test(
name = "lib_test",
srcs = ["libtest.cs"],
target_frameworks = ["netcoreapp3.0"],
target_frameworks = ["netcoreapp3.1"],
deps = [":lib"],
)

csharp_library(
name = "lib",
srcs = ["lib.cs"],
target_frameworks = ["netcoreapp3.0"],
target_frameworks = ["netcoreapp3.1"],
)
5 changes: 5 additions & 0 deletions examples/every_framework_empty/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ csharp_library(
target_frameworks = ["netcoreapp3.0"],
)

csharp_library(
name = "netcoreapp3.1",
target_frameworks = ["netcoreapp3.1"],
)

csharp_library(
name = "netstandard2.0",
target_frameworks = ["netstandard2.0"],
Expand Down

0 comments on commit 0e747ba

Please sign in to comment.