From 85e29fc680ce8ae24438b0a9a9098ae6e3db8cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Purkh=C3=BAs?= Date: Thu, 15 Sep 2022 15:27:18 +0000 Subject: [PATCH] Allow multiple runtime packs * Adds support for declaring multiple runtime packs in `publish_binary` * Add AspNetCore example To be able to do a self contained publish of an AspNetCore application you need to be able to declare both the `microsoft.netcore.app.runtime.` and `microsoft.aspnetcore.app.runtime.` runtime packs --- dotnet/defs.bzl | 4 +- dotnet/private/common.bzl | 6 +- dotnet/private/providers.bzl | 2 +- .../rules/publish_binary/publish_binary.bzl | 58 +++--- .../tests/publish/self_contained/BUILD.bazel | 8 +- examples/BUILD.bazel | 0 examples/WORKSPACE | 195 +----------------- examples/aspnetcore/AspNetCore.csproj | 8 + examples/aspnetcore/BUILD.bazel | 43 ++++ .../Controllers/WeatherForecastController.cs | 36 ++++ examples/aspnetcore/Program.cs | 16 ++ examples/aspnetcore/WeatherForecast.cs | 14 ++ examples/example_deps.bzl | 22 ++ examples/paket.dependencies | 15 ++ examples/paket.lock | 19 ++ examples/publish_self_contained/BUILD.bazel | 8 +- examples/update-deps.sh | 8 + 17 files changed, 229 insertions(+), 233 deletions(-) create mode 100644 examples/BUILD.bazel create mode 100644 examples/aspnetcore/AspNetCore.csproj create mode 100644 examples/aspnetcore/BUILD.bazel create mode 100644 examples/aspnetcore/Controllers/WeatherForecastController.cs create mode 100644 examples/aspnetcore/Program.cs create mode 100644 examples/aspnetcore/WeatherForecast.cs create mode 100644 examples/example_deps.bzl create mode 100644 examples/paket.dependencies create mode 100644 examples/paket.lock create mode 100755 examples/update-deps.sh diff --git a/dotnet/defs.bzl b/dotnet/defs.bzl index f361b5d6..d8d4af50 100644 --- a/dotnet/defs.bzl +++ b/dotnet/defs.bzl @@ -265,7 +265,7 @@ def fsharp_nunit_test( **kwargs ) -def publish_binary(name, binary, target_framework, self_contained = False, runtime_pack = None, runtime_identifier = None, **kwargs): +def publish_binary(name, binary, target_framework, self_contained = False, runtime_packs = [], runtime_identifier = None, **kwargs): runtime_identifier = _get_runtime_runtime_identifier(runtime_identifier) _publish_binary( @@ -273,7 +273,7 @@ def publish_binary(name, binary, target_framework, self_contained = False, runti binary = binary, target_framework = target_framework, self_contained = self_contained, - runtime_pack = runtime_pack, + runtime_packs = runtime_packs, tags = ["manual"], ) diff --git a/dotnet/private/common.bzl b/dotnet/private/common.bzl index b2c6990d..dd5e762d 100644 --- a/dotnet/private/common.bzl +++ b/dotnet/private/common.bzl @@ -434,7 +434,7 @@ def generate_depsjson( runtime_deps, transitive_runtime_deps, runtime_identifier, - runtime_pack_info = None): + runtime_pack_infos = []): """Generates a deps.json file. Args: @@ -443,7 +443,7 @@ def generate_depsjson( runtime_deps: The runtime dependencies of the target. transitive_runtime_deps: The transitive runtime dependencies of the target. runtime_identifier: The runtime identifier of the target. - runtime_pack_info: The DotnetAssemblyInfo of the runtime pack that is used for a self contained publish. + runtime_pack_infos: The DotnetAssemblyInfo of the runtime packs that are used for a self contained publish. Returns: The deps.json file as a struct. """ @@ -465,7 +465,7 @@ def generate_depsjson( base["targets"][runtime_target] = {} base["libraries"] = {} - if runtime_pack_info: + for runtime_pack_info in runtime_pack_infos: runtime_pack_name = "runtimepack.{}/{}".format(runtime_pack_info.name, runtime_pack_info.version) base["libraries"][runtime_pack_name] = { "type": "runtimepack", diff --git a/dotnet/private/providers.bzl b/dotnet/private/providers.bzl index 56fea117..b3e671d7 100644 --- a/dotnet/private/providers.bzl +++ b/dotnet/private/providers.bzl @@ -53,7 +53,7 @@ DotnetBinaryInfo = provider( DotnetPublishBinaryInfo = provider( doc = "Information about a published .Net binary", fields = { - "runtime_pack": "AssemblyInfo: Optional information about the used runtime pack. Used by self-contained publishing", + "runtime_packs": "list[AssemblyInfo]: Optional information about the used runtime packs. Used by self-contained publishing", "target_framework": "string: The target framework of the published binary", "self_contained": "bool: True if the binary is self-contained", }, diff --git a/dotnet/private/rules/publish_binary/publish_binary.bzl b/dotnet/private/rules/publish_binary/publish_binary.bzl index cfac4981..6e9c3602 100644 --- a/dotnet/private/rules/publish_binary/publish_binary.bzl +++ b/dotnet/private/rules/publish_binary/publish_binary.bzl @@ -8,18 +8,21 @@ load("//dotnet/private/transitions:tfm_transition.bzl", "tfm_transition") load("//dotnet/private:common.bzl", "generate_depsjson", "generate_runtimeconfig") def _publish_binary_impl(ctx): - runtime_pack_info = None + runtime_pack_infos = [] if ctx.attr.self_contained == True: - if ctx.attr.runtime_pack == None or len(ctx.attr.runtime_pack) == 0: + if len(ctx.attr.runtime_packs) == 0: fail("Can not publish self-contained binaries without a runtime pack") - runtime_pack_info = ctx.attr.runtime_pack[0][DotnetAssemblyInfo] + for runtime_pack in ctx.attr.runtime_packs: + runtime_pack_infos.append(runtime_pack[DotnetAssemblyInfo]) + elif len(ctx.attr.runtime_packs) > 0: + fail("Can not do a framework dependent publish with a runtime pack") return [ ctx.attr.binary[0][DotnetAssemblyInfo], ctx.attr.binary[0][DotnetBinaryInfo], DotnetPublishBinaryInfo( - runtime_pack = runtime_pack_info, + runtime_packs = runtime_pack_infos, target_framework = ctx.attr.target_framework, self_contained = ctx.attr.self_contained, ), @@ -44,7 +47,7 @@ publish_binary = rule( Whether the binary should be self-contained. If true, the binary will be published as a self-contained but you need to provide - a runtime pack in the `runtime_pack` attribute. At some point the rules might + a runtime pack in the `runtime_packs` attribute. At some point the rules might resolve the runtime pack automatically. If false, the binary will be published as a non-self-contained. That means that to be @@ -52,18 +55,20 @@ publish_binary = rule( """, default = False, ), - "runtime_pack": attr.label( + "runtime_packs": attr.label_list( doc = """ - The runtime pack that should be used to publish the binary. + The runtime packs that should be used to publish the binary. Should only be declared if `self_contained` is true. - The runtime pack is a NuGet package that contains the runtime that should be - used to run the binary. + A runtime pack is a NuGet package that contains the runtime that should be + used to run the binary. There can be multiple runtime packs for a given + publish e.g. when a AspNetCore application is published you need the base + runtime pack and the AspNetCore runtime pack. Example runtime pack: https://www.nuget.org/packages/Microsoft.NETCore.App.Runtime.linux-x64/6.0.8 """, providers = [DotnetAssemblyInfo], - default = None, + default = [], cfg = tfm_transition, ), # TODO: @@ -155,18 +160,19 @@ def _copy_to_publish(ctx, runtime_identifier, publish_binary_info, binary_info, # In case the publish is self-contained there needs to be a runtime pack available # with the runtime dependencies that are required for the targeted runtime. # The runtime pack contents should always be copied to the root of the publish folder - if publish_binary_info.runtime_pack: - runtime_pack_files = depset( - publish_binary_info.runtime_pack.libs + - publish_binary_info.runtime_pack.native + - publish_binary_info.runtime_pack.data, - transitive = [publish_binary_info.runtime_pack.transitive_libs, publish_binary_info.runtime_pack.transitive_native, publish_binary_info.runtime_pack.transitive_data], - ) - for file in runtime_pack_files.to_list(): - output = ctx.actions.declare_file(file.basename, sibling = app_host_copy) - outputs.append(output) - inputs.append(file) - _copy_file(script_body, file, output, is_windows = is_windows) + if len(publish_binary_info.runtime_packs) > 0: + for runtime_pack in publish_binary_info.runtime_packs: + runtime_pack_files = depset( + runtime_pack.libs + + runtime_pack.native + + runtime_pack.data, + transitive = [runtime_pack.transitive_libs, runtime_pack.transitive_native, runtime_pack.transitive_data], + ) + for file in runtime_pack_files.to_list(): + output = ctx.actions.declare_file(file.basename, sibling = app_host_copy) + outputs.append(output) + inputs.append(file) + _copy_file(script_body, file, output, is_windows = is_windows) copy_script = ctx.actions.declare_file(ctx.label.name + ".copy.bat" if is_windows else ctx.label.name + ".copy.sh") ctx.actions.write( @@ -204,8 +210,8 @@ def _generate_depsjson( runtime_deps, transitive_runtime_deps, runtime_identifier, - runtime_pack_info): - depsjson_struct = generate_depsjson(target_framework, is_self_contained, runtime_deps, transitive_runtime_deps, runtime_identifier, runtime_pack_info) + runtime_pack_infos): + depsjson_struct = generate_depsjson(target_framework, is_self_contained, runtime_deps, transitive_runtime_deps, runtime_identifier, runtime_pack_infos) ctx.actions.write( output = output, @@ -251,7 +257,7 @@ def _publish_binary_wrapper_impl(ctx): assembly_info.runtime_deps, assembly_info.transitive_runtime_deps, runtime_identifier, - publish_binary_info.runtime_pack, + publish_binary_info.runtime_packs, ) return [ @@ -264,7 +270,7 @@ def _publish_binary_wrapper_impl(ctx): # This wrapper is only needed so that we can turn the incoming transition in `publish_binary` # into an outgoing transition in the wrapper. This allows us to select on the runtime_identifier -# and runtime_pack attributes. We also need to have all the file copying in the wrapper rule +# and runtime_packs attributes. We also need to have all the file copying in the wrapper rule # because Bazel does not allow forwarding executable files as they have to be created by the wrapper rule. publish_binary_wrapper = rule( _publish_binary_wrapper_impl, diff --git a/dotnet/private/tests/publish/self_contained/BUILD.bazel b/dotnet/private/tests/publish/self_contained/BUILD.bazel index 8ee206e2..a0846f3a 100644 --- a/dotnet/private/tests/publish/self_contained/BUILD.bazel +++ b/dotnet/private/tests/publish/self_contained/BUILD.bazel @@ -7,10 +7,10 @@ load("@rules_pkg//pkg:tar.bzl", "pkg_tar") publish_binary( name = "self_contained", binary = "//dotnet/private/tests/publish/app_to_publish", - runtime_pack = select({ - "@rules_dotnet//dotnet:rid_linux-x64": "@rules_dotnet_dev_nuget_packages//microsoft.netcore.app.runtime.linux-x64", - "@rules_dotnet//dotnet:rid_osx-x64": "@rules_dotnet_dev_nuget_packages//microsoft.netcore.app.runtime.osx-x64", - "@rules_dotnet//dotnet:rid_win-x64": "@rules_dotnet_dev_nuget_packages//microsoft.netcore.app.runtime.win-x64", + runtime_packs = select({ + "@rules_dotnet//dotnet:rid_linux-x64": ["@rules_dotnet_dev_nuget_packages//microsoft.netcore.app.runtime.linux-x64"], + "@rules_dotnet//dotnet:rid_osx-x64": ["@rules_dotnet_dev_nuget_packages//microsoft.netcore.app.runtime.osx-x64"], + "@rules_dotnet//dotnet:rid_win-x64": ["@rules_dotnet_dev_nuget_packages//microsoft.netcore.app.runtime.win-x64"], }), self_contained = True, target_framework = "net6.0", diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel new file mode 100644 index 00000000..e69de29b diff --git a/examples/WORKSPACE b/examples/WORKSPACE index 8081b5e5..05f72a8c 100644 --- a/examples/WORKSPACE +++ b/examples/WORKSPACE @@ -36,200 +36,9 @@ load("@rules_dotnet//dotnet:paket2bazel_dependencies.bzl", "paket2bazel_dependen paket2bazel_dependencies() -load("@rules_dotnet//dotnet:defs.bzl", "nuget_repo") +load("//:example_deps.bzl", "example_deps") -nuget_repo( - name = "example_deps", - packages = [ - ( - "Microsoft.NETCore.App.Ref", - "6.0.8", - "sha512-TcZWOpmw+hWGQANrK0YWS3oHvtxdkn5A5JB284IdgXNvQ4rGABOPK8u52qB2bATbpSy3DbiMdobRxgAB2/mcJQ==", - [], - [ - "Microsoft.CSharp|4.4.0", - "Microsoft.Win32.Primitives|4.3.0", - "Microsoft.Win32.Registry|4.4.0", - "runtime.debian.8-x64.runtime.native.System|4.3.0", - "runtime.debian.8-x64.runtime.native.System.IO.Compression|4.3.0", - "runtime.debian.8-x64.runtime.native.System.Net.Http|4.3.0", - "runtime.debian.8-x64.runtime.native.System.Net.Security|4.3.0", - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography|4.3.0", - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", - "runtime.fedora.23-x64.runtime.native.System|4.3.0", - "runtime.fedora.23-x64.runtime.native.System.IO.Compression|4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Net.Http|4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Net.Security|4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography|4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", - "runtime.fedora.24-x64.runtime.native.System|4.3.0", - "runtime.fedora.24-x64.runtime.native.System.IO.Compression|4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Net.Http|4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Net.Security|4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography|4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System|4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.IO.Compression|4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Net.Http|4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Net.Security|4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography|4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System|4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.IO.Compression|4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Net.Http|4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Net.Security|4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography|4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", - "runtime.osx.10.10-x64.runtime.native.System|4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.IO.Compression|4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Net.Http|4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Net.Security|4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography|4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple|4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", - "runtime.rhel.7-x64.runtime.native.System|4.3.0", - "runtime.rhel.7-x64.runtime.native.System.IO.Compression|4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Net.Http|4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Net.Security|4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography|4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System|4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.IO.Compression|4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Net.Http|4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Net.Security|4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography|4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System|4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.IO.Compression|4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Net.Http|4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Net.Security|4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography|4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System|4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.IO.Compression|4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Net.Http|4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Net.Security|4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography|4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", - "System.AppContext|4.3.0", - "System.Buffers|4.4.0", - "System.Collections|4.3.0", - "System.Collections.Concurrent|4.3.0", - "System.Collections.Immutable|1.4.0", - "System.Collections.NonGeneric|4.3.0", - "System.Collections.Specialized|4.3.0", - "System.ComponentModel|4.3.0", - "System.ComponentModel.EventBasedAsync|4.3.0", - "System.ComponentModel.Primitives|4.3.0", - "System.ComponentModel.TypeConverter|4.3.0", - "System.Console|4.3.0", - "System.Data.Common|4.3.0", - "System.Diagnostics.Contracts|4.3.0", - "System.Diagnostics.Debug|4.3.0", - "System.Diagnostics.DiagnosticSource|4.4.0", - "System.Diagnostics.FileVersionInfo|4.3.0", - "System.Diagnostics.Process|4.3.0", - "System.Diagnostics.StackTrace|4.3.0", - "System.Diagnostics.TextWriterTraceListener|4.3.0", - "System.Diagnostics.Tools|4.3.0", - "System.Diagnostics.TraceSource|4.3.0", - "System.Diagnostics.Tracing|4.3.0", - "System.Dynamic.Runtime|4.3.0", - "System.Globalization|4.3.0", - "System.Globalization.Calendars|4.3.0", - "System.Globalization.Extensions|4.3.0", - "System.IO|4.3.0", - "System.IO.Compression|4.3.0", - "System.IO.Compression.ZipFile|4.3.0", - "System.IO.FileSystem|4.3.0", - "System.IO.FileSystem.AccessControl|4.4.0", - "System.IO.FileSystem.DriveInfo|4.3.0", - "System.IO.FileSystem.Primitives|4.3.0", - "System.IO.FileSystem.Watcher|4.3.0", - "System.IO.IsolatedStorage|4.3.0", - "System.IO.MemoryMappedFiles|4.3.0", - "System.IO.Pipes|4.3.0", - "System.IO.UnmanagedMemoryStream|4.3.0", - "System.Linq|4.3.0", - "System.Linq.Expressions|4.3.0", - "System.Linq.Queryable|4.3.0", - "System.Net.Http|4.3.0", - "System.Net.NameResolution|4.3.0", - "System.Net.Primitives|4.3.0", - "System.Net.Requests|4.3.0", - "System.Net.Security|4.3.0", - "System.Net.Sockets|4.3.0", - "System.Net.WebHeaderCollection|4.3.0", - "System.ObjectModel|4.3.0", - "System.Private.DataContractSerialization|4.3.0", - "System.Reflection|4.3.0", - "System.Reflection.Emit|4.3.0", - "System.Reflection.Emit.ILGeneration|4.3.0", - "System.Reflection.Emit.Lightweight|4.3.0", - "System.Reflection.Extensions|4.3.0", - "System.Reflection.Metadata|1.5.0", - "System.Reflection.Primitives|4.3.0", - "System.Reflection.TypeExtensions|4.3.0", - "System.Resources.ResourceManager|4.3.0", - "System.Runtime|4.3.0", - "System.Runtime.Extensions|4.3.0", - "System.Runtime.Handles|4.3.0", - "System.Runtime.InteropServices|4.3.0", - "System.Runtime.InteropServices.RuntimeInformation|4.3.0", - "System.Runtime.Loader|4.3.0", - "System.Runtime.Numerics|4.3.0", - "System.Runtime.Serialization.Formatters|4.3.0", - "System.Runtime.Serialization.Json|4.3.0", - "System.Runtime.Serialization.Primitives|4.3.0", - "System.Security.AccessControl|4.4.0", - "System.Security.Claims|4.3.0", - "System.Security.Cryptography.Algorithms|4.3.0", - "System.Security.Cryptography.Cng|4.4.0", - "System.Security.Cryptography.Csp|4.3.0", - "System.Security.Cryptography.Encoding|4.3.0", - "System.Security.Cryptography.OpenSsl|4.4.0", - "System.Security.Cryptography.Primitives|4.3.0", - "System.Security.Cryptography.X509Certificates|4.3.0", - "System.Security.Cryptography.Xml|4.4.0", - "System.Security.Principal|4.3.0", - "System.Security.Principal.Windows|4.4.0", - "System.Text.Encoding|4.3.0", - "System.Text.Encoding.Extensions|4.3.0", - "System.Text.RegularExpressions|4.3.0", - "System.Threading|4.3.0", - "System.Threading.Overlapped|4.3.0", - "System.Threading.Tasks|4.3.0", - "System.Threading.Tasks.Extensions|4.3.0", - "System.Threading.Tasks.Parallel|4.3.0", - "System.Threading.Thread|4.3.0", - "System.Threading.ThreadPool|4.3.0", - "System.Threading.Timer|4.3.0", - "System.ValueTuple|4.3.0", - "System.Xml.ReaderWriter|4.3.0", - "System.Xml.XDocument|4.3.0", - "System.Xml.XmlDocument|4.3.0", - "System.Xml.XmlSerializer|4.3.0", - "System.Xml.XPath|4.3.0", - "System.Xml.XPath.XDocument|4.3.0", - ], - ), - ("FSharp.Core", "6.0.3", "sha512-aDyKHiVFMwXWJrfW90iAeKyvw/lN+x98DPfx4oXke9Qnl4dz1sOi8KT2iczGeunqyWXh7nm+XUJ18i/0P3pZYw==", [], []), - ( - "Expecto", - "9.0.4", - "sha512-k0TT6pNIyzDaJD0ZxHDhNU0UmmWZlum2XFfHTGrkApQ+JUdjcoBqKOACXrSkfiLVYsD8Ww768eeAiKPP3QYetw==", - [ - "FSharp.Core", - "Mono.Cecil", - ], - [], - ), - ("Mono.Cecil", "0.11.4", "sha512-CnjwUMmFHnScNG8e/4DRZQQX67H5ajekRDudmZ6Fy1jCLhyH1jjzbQCOEFhBLa2NjPWQpMF+RHdBJY8a7GgmlA==", [], []), - ("Microsoft.NETCore.App.Runtime.win-x64", "6.0.8", "sha512-pgpxzvQPZzBPD1lWulgRO/aafBhSBLhqH+SrBD+sYSIu7eswlxE5icW/r8o60fNFKYVg0CFvrnmCut5YpTT27Q==", [], []), - ("Microsoft.NETCore.App.Runtime.linux-x64", "6.0.8", "sha512-cjVzAUiYxPv949mXl0IbwzSRq0xBTGcW3N619CUcCwe35Ma1C1Tg1nh75Xc+OEn5+eAMW/S66dy+kQhdc277tA==", [], []), - ("Microsoft.NETCore.App.Runtime.osx-x64", "6.0.8", "sha512-RDOy3pzl0sutv5U3JAx23JWiw2UCoHAPNsCo35TA8MU2DM+LMDXN/lxi2cslot6GfFsxe0cYhclkEocHa2xMPQ==", [], []), - ], -) +example_deps() load("//paket/deps:paket.bzl", "paket") diff --git a/examples/aspnetcore/AspNetCore.csproj b/examples/aspnetcore/AspNetCore.csproj new file mode 100644 index 00000000..0bb17642 --- /dev/null +++ b/examples/aspnetcore/AspNetCore.csproj @@ -0,0 +1,8 @@ + + + + net6.0 + enable + + + diff --git a/examples/aspnetcore/BUILD.bazel b/examples/aspnetcore/BUILD.bazel new file mode 100644 index 00000000..9fe50fac --- /dev/null +++ b/examples/aspnetcore/BUILD.bazel @@ -0,0 +1,43 @@ +load( + "@rules_dotnet//dotnet:defs.bzl", + "csharp_binary", + "publish_binary", +) + +# bazel run //examples:hello +csharp_binary( + name = "aspnetcore", + srcs = [ + "Controllers/WeatherForecastController.cs", + "Program.cs", + "WeatherForecast.cs", + ], + private_deps = [ + "@example_deps//microsoft.netcore.app.ref", + "@example_deps//microsoft.aspnetcore.app.ref", + ], + target_frameworks = ["net6.0"], + deps = [ + ], +) + +publish_binary( + name = "publish", + binary = ":aspnetcore", + runtime_packs = select({ + "@rules_dotnet//dotnet:rid_linux-x64": [ + "@example_deps//microsoft.netcore.app.runtime.linux-x64", + "@example_deps//microsoft.aspnetcore.app.runtime.linux-x64", + ], + "@rules_dotnet//dotnet:rid_osx-x64": [ + "@example_deps//microsoft.netcore.app.runtime.osx-x64", + "@example_deps//microsoft.aspnetcore.app.runtime.osx-x64", + ], + "@rules_dotnet//dotnet:rid_win-x64": [ + "@example_deps//microsoft.netcore.app.runtime.win-x64", + "@example_deps//microsoft.aspnetcore.app.runtime.win-x64", + ], + }), + self_contained = True, + target_framework = "net6.0", +) diff --git a/examples/aspnetcore/Controllers/WeatherForecastController.cs b/examples/aspnetcore/Controllers/WeatherForecastController.cs new file mode 100644 index 00000000..0fef4f60 --- /dev/null +++ b/examples/aspnetcore/Controllers/WeatherForecastController.cs @@ -0,0 +1,36 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Linq; +using System.Collections.Generic; +using Microsoft.Extensions.Logging; + +namespace AspNetCore.Controllers; + +[ApiController] +[Route("[controller]")] +public class WeatherForecastController : ControllerBase +{ + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateTime.Now.AddDays(index), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } +} diff --git a/examples/aspnetcore/Program.cs b/examples/aspnetcore/Program.cs new file mode 100644 index 00000000..270adfc3 --- /dev/null +++ b/examples/aspnetcore/Program.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); + +var app = builder.Build(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run("http://localhost:8000"); diff --git a/examples/aspnetcore/WeatherForecast.cs b/examples/aspnetcore/WeatherForecast.cs new file mode 100644 index 00000000..9118272c --- /dev/null +++ b/examples/aspnetcore/WeatherForecast.cs @@ -0,0 +1,14 @@ +using System; + +namespace AspNetCore; + +public class WeatherForecast +{ + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } +} diff --git a/examples/example_deps.bzl b/examples/example_deps.bzl new file mode 100644 index 00000000..02be8d80 --- /dev/null +++ b/examples/example_deps.bzl @@ -0,0 +1,22 @@ +"Generated by paket2bazel" + +load("@rules_dotnet//dotnet:defs.bzl", "nuget_repo") + +def example_deps(): + "example_deps" + nuget_repo( + name = "example_deps", + packages = [ + ("Expecto", "9.0.4", "sha512-k0TT6pNIyzDaJD0ZxHDhNU0UmmWZlum2XFfHTGrkApQ+JUdjcoBqKOACXrSkfiLVYsD8Ww768eeAiKPP3QYetw==", ["FSharp.Core", "Mono.Cecil"], []), + ("FSharp.Core", "6.0.3", "sha512-aDyKHiVFMwXWJrfW90iAeKyvw/lN+x98DPfx4oXke9Qnl4dz1sOi8KT2iczGeunqyWXh7nm+XUJ18i/0P3pZYw==", [], []), + ("Microsoft.AspNetCore.App.Ref", "6.0.8", "sha512-yLy7tFshfGLJRCFdlmOv8YOlJ4J5IfE88bnqiulxsJzhgEQNfbPQLpxbvmjCO3Zg0tdBLAS4B8QYWoojkOkWLg==", [], ["Microsoft.Extensions.Caching.Abstractions|6.0.0", "Microsoft.Extensions.Caching.Memory|6.0.0", "Microsoft.Extensions.Configuration.Abstractions|6.0.0", "Microsoft.Extensions.Configuration.Binder|6.0.0", "Microsoft.Extensions.Configuration.CommandLine|6.0.0", "Microsoft.Extensions.Configuration|6.0.0", "Microsoft.Extensions.Configuration.EnvironmentVariables|6.0.0", "Microsoft.Extensions.Configuration.FileExtensions|6.0.0", "Microsoft.Extensions.Configuration.Ini|6.0.0", "Microsoft.Extensions.Configuration.Json|6.0.0", "Microsoft.Extensions.Configuration.UserSecrets|6.0.0", "Microsoft.Extensions.Configuration.Xml|6.0.0", "Microsoft.Extensions.DependencyInjection.Abstractions|6.0.0", "Microsoft.Extensions.DependencyInjection|6.0.0", "Microsoft.Extensions.FileProviders.Abstractions|6.0.0", "Microsoft.Extensions.FileProviders.Composite|6.0.0", "Microsoft.Extensions.FileProviders.Physical|6.0.0", "Microsoft.Extensions.FileSystemGlobbing|6.0.0", "Microsoft.Extensions.Hosting.Abstractions|6.0.0", "Microsoft.Extensions.Hosting|6.0.0", "Microsoft.Extensions.Http|6.0.0", "Microsoft.Extensions.Logging.Abstractions|6.0.0", "Microsoft.Extensions.Logging.Configuration|6.0.0", "Microsoft.Extensions.Logging.Console|6.0.0", "Microsoft.Extensions.Logging.Debug|6.0.0", "Microsoft.Extensions.Logging|6.0.0", "Microsoft.Extensions.Logging.EventLog|6.0.0", "Microsoft.Extensions.Logging.EventSource|6.0.0", "Microsoft.Extensions.Logging.TraceSource|6.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions|6.0.0", "Microsoft.Extensions.Options.DataAnnotations|6.0.0", "Microsoft.Extensions.Options|6.0.0", "Microsoft.Extensions.Primitives|6.0.0", "System.Diagnostics.EventLog|6.0.0", "System.IO.Pipelines|6.0.0", "System.Security.Cryptography.Xml|6.0.0", "Microsoft.AspNetCore.Antiforgery|6.0.0", "Microsoft.AspNetCore.Authentication.Abstractions|6.0.0", "Microsoft.AspNetCore.Authentication.Cookies|6.0.0", "Microsoft.AspNetCore.Authentication.Core|6.0.0", "Microsoft.AspNetCore.Authentication|6.0.0", "Microsoft.AspNetCore.Authentication.OAuth|6.0.0", "Microsoft.AspNetCore.Authorization|6.0.0", "Microsoft.AspNetCore.Authorization.Policy|6.0.0", "Microsoft.AspNetCore.Components.Authorization|6.0.0", "Microsoft.AspNetCore.Components|6.0.0", "Microsoft.AspNetCore.Components.Forms|6.0.0", "Microsoft.AspNetCore.Components.Server|6.0.0", "Microsoft.AspNetCore.Components.Web|6.0.0", "Microsoft.AspNetCore.Connections.Abstractions|6.0.0", "Microsoft.AspNetCore.CookiePolicy|6.0.0", "Microsoft.AspNetCore.Cors|6.0.0", "Microsoft.AspNetCore.Cryptography.Internal|6.0.0", "Microsoft.AspNetCore.Cryptography.KeyDerivation|6.0.0", "Microsoft.AspNetCore.DataProtection.Abstractions|6.0.0", "Microsoft.AspNetCore.DataProtection|6.0.0", "Microsoft.AspNetCore.DataProtection.Extensions|6.0.0", "Microsoft.AspNetCore.Diagnostics.Abstractions|6.0.0", "Microsoft.AspNetCore.Diagnostics|6.0.0", "Microsoft.AspNetCore.Diagnostics.HealthChecks|6.0.0", "Microsoft.AspNetCore|6.0.0", "Microsoft.AspNetCore.HostFiltering|6.0.0", "Microsoft.AspNetCore.Hosting.Abstractions|6.0.0", "Microsoft.AspNetCore.Hosting|6.0.0", "Microsoft.AspNetCore.Hosting.Server.Abstractions|6.0.0", "Microsoft.AspNetCore.Html.Abstractions|6.0.0", "Microsoft.AspNetCore.Http.Abstractions|6.0.0", "Microsoft.AspNetCore.Http.Connections.Common|6.0.0", "Microsoft.AspNetCore.Http.Connections|6.0.0", "Microsoft.AspNetCore.Http|6.0.0", "Microsoft.AspNetCore.Http.Extensions|6.0.0", "Microsoft.AspNetCore.Http.Features|6.0.0", "Microsoft.AspNetCore.Http.Results|6.0.0", "Microsoft.AspNetCore.HttpLogging|6.0.0", "Microsoft.AspNetCore.HttpOverrides|6.0.0", "Microsoft.AspNetCore.HttpsPolicy|6.0.0", "Microsoft.AspNetCore.Identity|6.0.0", "Microsoft.AspNetCore.Localization|6.0.0", "Microsoft.AspNetCore.Localization.Routing|6.0.0", "Microsoft.AspNetCore.Metadata|6.0.0", "Microsoft.AspNetCore.Mvc.Abstractions|6.0.0", "Microsoft.AspNetCore.Mvc.ApiExplorer|6.0.0", "Microsoft.AspNetCore.Mvc.Core|6.0.0", "Microsoft.AspNetCore.Mvc.Cors|6.0.0", "Microsoft.AspNetCore.Mvc.DataAnnotations|6.0.0", "Microsoft.AspNetCore.Mvc|6.0.0", "Microsoft.AspNetCore.Mvc.Formatters.Json|6.0.0", "Microsoft.AspNetCore.Mvc.Formatters.Xml|6.0.0", "Microsoft.AspNetCore.Mvc.Localization|6.0.0", "Microsoft.AspNetCore.Mvc.Razor|6.0.0", "Microsoft.AspNetCore.Mvc.RazorPages|6.0.0", "Microsoft.AspNetCore.Mvc.TagHelpers|6.0.0", "Microsoft.AspNetCore.Mvc.ViewFeatures|6.0.0", "Microsoft.AspNetCore.Razor|6.0.0", "Microsoft.AspNetCore.Razor.Runtime|6.0.0", "Microsoft.AspNetCore.ResponseCaching.Abstractions|6.0.0", "Microsoft.AspNetCore.ResponseCaching|6.0.0", "Microsoft.AspNetCore.ResponseCompression|6.0.0", "Microsoft.AspNetCore.Rewrite|6.0.0", "Microsoft.AspNetCore.Routing.Abstractions|6.0.0", "Microsoft.AspNetCore.Routing|6.0.0", "Microsoft.AspNetCore.Server.HttpSys|6.0.0", "Microsoft.AspNetCore.Server.IIS|6.0.0", "Microsoft.AspNetCore.Server.IISIntegration|6.0.0", "Microsoft.AspNetCore.Server.Kestrel.Core|6.0.0", "Microsoft.AspNetCore.Server.Kestrel|6.0.0", "Microsoft.AspNetCore.Server.Kestrel.Transport.Quic|6.0.0", "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets|6.0.0", "Microsoft.AspNetCore.Session|6.0.0", "Microsoft.AspNetCore.SignalR.Common|6.0.0", "Microsoft.AspNetCore.SignalR.Core|6.0.0", "Microsoft.AspNetCore.SignalR|6.0.0", "Microsoft.AspNetCore.SignalR.Protocols.Json|6.0.0", "Microsoft.AspNetCore.StaticFiles|6.0.0", "Microsoft.AspNetCore.WebSockets|6.0.0", "Microsoft.AspNetCore.WebUtilities|6.0.0", "Microsoft.Extensions.Configuration.KeyPerFile|6.0.0", "Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions|6.0.0", "Microsoft.Extensions.Diagnostics.HealthChecks|6.0.0", "Microsoft.Extensions.Features|6.0.0", "Microsoft.Extensions.FileProviders.Embedded|6.0.0", "Microsoft.Extensions.Identity.Core|6.0.0", "Microsoft.Extensions.Identity.Stores|6.0.0", "Microsoft.Extensions.Localization.Abstractions|6.0.0", "Microsoft.Extensions.Localization|6.0.0", "Microsoft.Extensions.ObjectPool|6.0.0", "Microsoft.Extensions.WebEncoders|6.0.0", "Microsoft.JSInterop|6.0.0", "Microsoft.Net.Http.Headers|6.0.0"]), + ("Microsoft.AspNetCore.App.Runtime.linux-x64", "6.0.8", "sha512-3Hig5sP4ALm0aaB3cYCdhmW0a6SgT23ReaP5oYOZ9p1fQoQy4fHeLlU2LXQTXgJDopd3sQZCaWg639rJCYppiQ==", [], []), + ("Microsoft.AspNetCore.App.Runtime.osx-x64", "6.0.8", "sha512-AQHu61cati6QzemklVlevQgChYJ3+msUUnXVDh51cEHhFEO/HBLKFWTiS1A49jnLBFpNUY98jPJMauyKIrh4jQ==", [], []), + ("Microsoft.AspNetCore.App.Runtime.win-x64", "6.0.8", "sha512-fSuPkgA89T57pmGx2g6pcMSizT49ABL43d6s8Vp0PCzPjrme7UBISHATM9zP45Sq6GUhTZe2892wj7NmPa0wBA==", [], []), + ("Microsoft.NETCore.App.Ref", "6.0.8", "sha512-TcZWOpmw+hWGQANrK0YWS3oHvtxdkn5A5JB284IdgXNvQ4rGABOPK8u52qB2bATbpSy3DbiMdobRxgAB2/mcJQ==", [], ["Microsoft.CSharp|4.4.0", "Microsoft.Win32.Primitives|4.3.0", "Microsoft.Win32.Registry|4.4.0", "runtime.debian.8-x64.runtime.native.System|4.3.0", "runtime.debian.8-x64.runtime.native.System.IO.Compression|4.3.0", "runtime.debian.8-x64.runtime.native.System.Net.Http|4.3.0", "runtime.debian.8-x64.runtime.native.System.Net.Security|4.3.0", "runtime.debian.8-x64.runtime.native.System.Security.Cryptography|4.3.0", "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", "runtime.fedora.23-x64.runtime.native.System|4.3.0", "runtime.fedora.23-x64.runtime.native.System.IO.Compression|4.3.0", "runtime.fedora.23-x64.runtime.native.System.Net.Http|4.3.0", "runtime.fedora.23-x64.runtime.native.System.Net.Security|4.3.0", "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography|4.3.0", "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", "runtime.fedora.24-x64.runtime.native.System|4.3.0", "runtime.fedora.24-x64.runtime.native.System.IO.Compression|4.3.0", "runtime.fedora.24-x64.runtime.native.System.Net.Http|4.3.0", "runtime.fedora.24-x64.runtime.native.System.Net.Security|4.3.0", "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography|4.3.0", "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", "runtime.opensuse.13.2-x64.runtime.native.System|4.3.0", "runtime.opensuse.13.2-x64.runtime.native.System.IO.Compression|4.3.0", "runtime.opensuse.13.2-x64.runtime.native.System.Net.Http|4.3.0", "runtime.opensuse.13.2-x64.runtime.native.System.Net.Security|4.3.0", "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography|4.3.0", "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", "runtime.opensuse.42.1-x64.runtime.native.System|4.3.0", "runtime.opensuse.42.1-x64.runtime.native.System.IO.Compression|4.3.0", "runtime.opensuse.42.1-x64.runtime.native.System.Net.Http|4.3.0", "runtime.opensuse.42.1-x64.runtime.native.System.Net.Security|4.3.0", "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography|4.3.0", "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", "runtime.osx.10.10-x64.runtime.native.System|4.3.0", "runtime.osx.10.10-x64.runtime.native.System.IO.Compression|4.3.0", "runtime.osx.10.10-x64.runtime.native.System.Net.Http|4.3.0", "runtime.osx.10.10-x64.runtime.native.System.Net.Security|4.3.0", "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography|4.3.0", "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple|4.3.0", "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", "runtime.rhel.7-x64.runtime.native.System|4.3.0", "runtime.rhel.7-x64.runtime.native.System.IO.Compression|4.3.0", "runtime.rhel.7-x64.runtime.native.System.Net.Http|4.3.0", "runtime.rhel.7-x64.runtime.native.System.Net.Security|4.3.0", "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography|4.3.0", "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", "runtime.ubuntu.14.04-x64.runtime.native.System|4.3.0", "runtime.ubuntu.14.04-x64.runtime.native.System.IO.Compression|4.3.0", "runtime.ubuntu.14.04-x64.runtime.native.System.Net.Http|4.3.0", "runtime.ubuntu.14.04-x64.runtime.native.System.Net.Security|4.3.0", "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography|4.3.0", "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", "runtime.ubuntu.16.04-x64.runtime.native.System|4.3.0", "runtime.ubuntu.16.04-x64.runtime.native.System.IO.Compression|4.3.0", "runtime.ubuntu.16.04-x64.runtime.native.System.Net.Http|4.3.0", "runtime.ubuntu.16.04-x64.runtime.native.System.Net.Security|4.3.0", "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography|4.3.0", "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", "runtime.ubuntu.16.10-x64.runtime.native.System|4.3.0", "runtime.ubuntu.16.10-x64.runtime.native.System.IO.Compression|4.3.0", "runtime.ubuntu.16.10-x64.runtime.native.System.Net.Http|4.3.0", "runtime.ubuntu.16.10-x64.runtime.native.System.Net.Security|4.3.0", "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography|4.3.0", "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl|4.3.0", "System.AppContext|4.3.0", "System.Buffers|4.4.0", "System.Collections|4.3.0", "System.Collections.Concurrent|4.3.0", "System.Collections.Immutable|1.4.0", "System.Collections.NonGeneric|4.3.0", "System.Collections.Specialized|4.3.0", "System.ComponentModel|4.3.0", "System.ComponentModel.EventBasedAsync|4.3.0", "System.ComponentModel.Primitives|4.3.0", "System.ComponentModel.TypeConverter|4.3.0", "System.Console|4.3.0", "System.Data.Common|4.3.0", "System.Diagnostics.Contracts|4.3.0", "System.Diagnostics.Debug|4.3.0", "System.Diagnostics.DiagnosticSource|4.4.0", "System.Diagnostics.FileVersionInfo|4.3.0", "System.Diagnostics.Process|4.3.0", "System.Diagnostics.StackTrace|4.3.0", "System.Diagnostics.TextWriterTraceListener|4.3.0", "System.Diagnostics.Tools|4.3.0", "System.Diagnostics.TraceSource|4.3.0", "System.Diagnostics.Tracing|4.3.0", "System.Dynamic.Runtime|4.3.0", "System.Globalization|4.3.0", "System.Globalization.Calendars|4.3.0", "System.Globalization.Extensions|4.3.0", "System.IO|4.3.0", "System.IO.Compression|4.3.0", "System.IO.Compression.ZipFile|4.3.0", "System.IO.FileSystem|4.3.0", "System.IO.FileSystem.AccessControl|4.4.0", "System.IO.FileSystem.DriveInfo|4.3.0", "System.IO.FileSystem.Primitives|4.3.0", "System.IO.FileSystem.Watcher|4.3.0", "System.IO.IsolatedStorage|4.3.0", "System.IO.MemoryMappedFiles|4.3.0", "System.IO.Pipes|4.3.0", "System.IO.UnmanagedMemoryStream|4.3.0", "System.Linq|4.3.0", "System.Linq.Expressions|4.3.0", "System.Linq.Queryable|4.3.0", "System.Net.Http|4.3.0", "System.Net.NameResolution|4.3.0", "System.Net.Primitives|4.3.0", "System.Net.Requests|4.3.0", "System.Net.Security|4.3.0", "System.Net.Sockets|4.3.0", "System.Net.WebHeaderCollection|4.3.0", "System.ObjectModel|4.3.0", "System.Private.DataContractSerialization|4.3.0", "System.Reflection|4.3.0", "System.Reflection.Emit|4.3.0", "System.Reflection.Emit.ILGeneration|4.3.0", "System.Reflection.Emit.Lightweight|4.3.0", "System.Reflection.Extensions|4.3.0", "System.Reflection.Metadata|1.5.0", "System.Reflection.Primitives|4.3.0", "System.Reflection.TypeExtensions|4.3.0", "System.Resources.ResourceManager|4.3.0", "System.Runtime|4.3.0", "System.Runtime.Extensions|4.3.0", "System.Runtime.Handles|4.3.0", "System.Runtime.InteropServices|4.3.0", "System.Runtime.InteropServices.RuntimeInformation|4.3.0", "System.Runtime.Loader|4.3.0", "System.Runtime.Numerics|4.3.0", "System.Runtime.Serialization.Formatters|4.3.0", "System.Runtime.Serialization.Json|4.3.0", "System.Runtime.Serialization.Primitives|4.3.0", "System.Security.AccessControl|4.4.0", "System.Security.Claims|4.3.0", "System.Security.Cryptography.Algorithms|4.3.0", "System.Security.Cryptography.Cng|4.4.0", "System.Security.Cryptography.Csp|4.3.0", "System.Security.Cryptography.Encoding|4.3.0", "System.Security.Cryptography.OpenSsl|4.4.0", "System.Security.Cryptography.Primitives|4.3.0", "System.Security.Cryptography.X509Certificates|4.3.0", "System.Security.Cryptography.Xml|4.4.0", "System.Security.Principal|4.3.0", "System.Security.Principal.Windows|4.4.0", "System.Text.Encoding|4.3.0", "System.Text.Encoding.Extensions|4.3.0", "System.Text.RegularExpressions|4.3.0", "System.Threading|4.3.0", "System.Threading.Overlapped|4.3.0", "System.Threading.Tasks|4.3.0", "System.Threading.Tasks.Extensions|4.3.0", "System.Threading.Tasks.Parallel|4.3.0", "System.Threading.Thread|4.3.0", "System.Threading.ThreadPool|4.3.0", "System.Threading.Timer|4.3.0", "System.ValueTuple|4.3.0", "System.Xml.ReaderWriter|4.3.0", "System.Xml.XDocument|4.3.0", "System.Xml.XmlDocument|4.3.0", "System.Xml.XmlSerializer|4.3.0", "System.Xml.XPath|4.3.0", "System.Xml.XPath.XDocument|4.3.0"]), + ("Microsoft.NETCore.App.Runtime.linux-x64", "6.0.8", "sha512-cjVzAUiYxPv949mXl0IbwzSRq0xBTGcW3N619CUcCwe35Ma1C1Tg1nh75Xc+OEn5+eAMW/S66dy+kQhdc277tA==", [], []), + ("Microsoft.NETCore.App.Runtime.osx-x64", "6.0.8", "sha512-RDOy3pzl0sutv5U3JAx23JWiw2UCoHAPNsCo35TA8MU2DM+LMDXN/lxi2cslot6GfFsxe0cYhclkEocHa2xMPQ==", [], []), + ("Microsoft.NETCore.App.Runtime.win-x64", "6.0.8", "sha512-pgpxzvQPZzBPD1lWulgRO/aafBhSBLhqH+SrBD+sYSIu7eswlxE5icW/r8o60fNFKYVg0CFvrnmCut5YpTT27Q==", [], []), + ("Mono.Cecil", "0.11.4", "sha512-CnjwUMmFHnScNG8e/4DRZQQX67H5ajekRDudmZ6Fy1jCLhyH1jjzbQCOEFhBLa2NjPWQpMF+RHdBJY8a7GgmlA==", [], []), + ], + ) diff --git a/examples/paket.dependencies b/examples/paket.dependencies new file mode 100644 index 00000000..c3a7392c --- /dev/null +++ b/examples/paket.dependencies @@ -0,0 +1,15 @@ +group example_deps + framework: net6.0 + storage: none + source https://api.nuget.org/v3/index.json + + nuget Expecto 9.0.4 + nuget FSharp.Core 6.0.3 + nuget Microsoft.NETCore.App.Ref 6.0.8 + nuget Microsoft.NETCore.App.Runtime.win-x64 6.0.8 + nuget Microsoft.NETCore.App.Runtime.linux-x64 6.0.8 + nuget Microsoft.NETCore.App.Runtime.osx-x64 6.0.8 + nuget Microsoft.AspNetCore.App.Ref 6.0.8 + nuget Microsoft.AspNetCore.App.Runtime.win-x64 6.0.8 + nuget Microsoft.AspNetCore.App.Runtime.linux-x64 6.0.8 + nuget Microsoft.AspNetCore.App.Runtime.osx-x64 6.0.8 diff --git a/examples/paket.lock b/examples/paket.lock new file mode 100644 index 00000000..9fdba1af --- /dev/null +++ b/examples/paket.lock @@ -0,0 +1,19 @@ + + +GROUP example_deps +RESTRICTION: == net6.0 +NUGET + remote: https://api.nuget.org/v3/index.json + Expecto (9.0.4) + FSharp.Core (>= 4.6) + Mono.Cecil (>= 0.11.3) + FSharp.Core (6.0.3) + Microsoft.AspNetCore.App.Ref (6.0.8) + Microsoft.AspNetCore.App.Runtime.linux-x64 (6.0.8) + Microsoft.AspNetCore.App.Runtime.osx-x64 (6.0.8) + Microsoft.AspNetCore.App.Runtime.win-x64 (6.0.8) + Microsoft.NETCore.App.Ref (6.0.8) + Microsoft.NETCore.App.Runtime.linux-x64 (6.0.8) + Microsoft.NETCore.App.Runtime.osx-x64 (6.0.8) + Microsoft.NETCore.App.Runtime.win-x64 (6.0.8) + Mono.Cecil (0.11.4) diff --git a/examples/publish_self_contained/BUILD.bazel b/examples/publish_self_contained/BUILD.bazel index 3ea22624..b15e9f0f 100644 --- a/examples/publish_self_contained/BUILD.bazel +++ b/examples/publish_self_contained/BUILD.bazel @@ -18,10 +18,10 @@ csharp_binary( publish_binary( name = "publish_self_contained", binary = ":hello", - runtime_pack = select({ - "@rules_dotnet//dotnet:rid_linux-x64": "@example_deps//microsoft.netcore.app.runtime.linux-x64", - "@rules_dotnet//dotnet:rid_osx-x64": "@example_deps//microsoft.netcore.app.runtime.osx-x64", - "@rules_dotnet//dotnet:rid_win-x64": "@example_deps//microsoft.netcore.app.runtime.win-x64", + runtime_packs = select({ + "@rules_dotnet//dotnet:rid_linux-x64": ["@example_deps//microsoft.netcore.app.runtime.linux-x64"], + "@rules_dotnet//dotnet:rid_osx-x64": ["@example_deps//microsoft.netcore.app.runtime.osx-x64"], + "@rules_dotnet//dotnet:rid_win-x64": ["@example_deps//microsoft.netcore.app.runtime.win-x64"], }), self_contained = True, target_framework = "net6.0", diff --git a/examples/update-deps.sh b/examples/update-deps.sh new file mode 100755 index 00000000..5b394cbb --- /dev/null +++ b/examples/update-deps.sh @@ -0,0 +1,8 @@ +#! /usr/bin/env bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +( + cd "$SCRIPT_DIR" || exit 1 + bazel run @rules_dotnet//tools/paket2bazel:paket2bazel.exe -- --dependencies-file "$(pwd)"/paket.dependencies --output-folder "$(pwd)" --put-groups-into-separate-files +)