Skip to content

Latest commit

 

History

History
321 lines (280 loc) · 20.5 KB

workspace.rst

File metadata and controls

321 lines (280 loc) · 20.5 KB

Dotnet workspace rules

Workspace rules are either repository rules, or macros that are intended to be used from the WORKSPACE file.

See also the toolchains rules, which contains the dotnet_register_toolchains workspace rule.


Fetches remote repositories required by dotnet rules.

A simple repository rule to download and extract nuget package. Using dotnet_nuget_new is usually a better idea.

Attributes

Name Type Default value
name string mandatory value
A unique name for this rule.
source string https://www.nuget.org/api/v2/package
The nuget base url for downloading the package. The final url is in the format {source}/{package}/{version}.
package string mandatory value
The nuget package name
version string mandatory value
The nuget package version.
sha256 string None
The nuget package sha256 digest.

Repository rule to download and extract nuget package. Usually used with dotnet_import_library.

Attributes

Name Type Default value
name string mandatory value
A unique name for this rule.
source string https://www.nuget.org/api/v2/package
The nuget base url for downloading the package. The final url is in the format {source}/{package}/{version}.
package string mandatory value
The nuget package name
version string mandatory value
The nuget package version.
sha256 string None
The nuget package sha256 digest.
build_file label None
The build file to link into downloaded nnuget package.
build_file_content string ""
The build file content to put into downloaded nnuget package.

Example

dotnet_nuget_new(
    name = "npgsql",
    package="Npgsql",
    version="3.2.7",
    sha256="fa3e0cfbb2caa9946d2ce3d8174031a06320aad2c9e69a60f7739b9ddf19f172",
    build_file_content = """
package(default_visibility = [ "//visibility:public" ])
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "dotnet_import_library")

dotnet_import_library(
    name = "npgsqllib",
    src = "lib/net451/Npgsql.dll"
)

net_gac2(
    name = "Microsoft.VisualStudio.QualityTools.UnitTestFramework",
    version = "10.1.0.0",
    token = "b03f5f7f11d50a3a"
)

net_gac4(
    name = "System.ComponentModel.DataAnnotations",
    version = "4.0.0.0",
    token = "31bf3856ad364e35"
)

vs2017_ref_net(name = "vs_ref_2017")
    """
)

Repository rule to download and extract nuget package. The rule is usually generated by nuget2bazel tool.

Attributes

Name name Type string Default value mandatory value
A unique name for this rule.
source string https://www.nuget.org/api/v2/package
The nuget base url for downloading the package. The final url is in the format {source}/{package}/{version}.
package string mandatory value
The nuget package name
version string mandatory value
The nuget package version.
sha256 string None
The nuget package sha256 digest.
core_lib string mandatory value
The path to .net core assembly within the nuget package
net_lib string mandatory value
The path to .net assembly within the nuget package
mono_lib string mandatory value
The path to mono assembly within the nuget package
core_tool string mandatory value
The path to .net core assembly within the nuget package (tools subdirectory)
net_tool string mandatory value
The path to .net assembly within the nuget package (tools subdirectory)
mono_tool string mandatory value
The path to mono assembly within the nuget package (tools subdirectory)
core_deps list of DotnetLibrary None
The list of the dependencies of the package (core)
net_deps list of DotnetLibrary None
The list of the dependencies of the package (net)
mono_deps list of DotnetLibrary None
The list of the dependencies of the package (mono)
core_files list of string None
The list of additional files within the package to be used as runfiles (necessary to run) (core)
net_files list of string None
The list of additional files within the package to be used as runfiles (necessary to run) (net)
mono_files list of string None
The list of additional files within the package to be used as runfiles (necessary to run) (mono)

Example

nuget_package(
    name = "commandlineparser",
    package = "commandlineparser",
    sha256 = "09e60ff23e6953b4fe7d267ef552d8ece76404acf44842012f84430e8b877b13",
    core_lib = "lib/netstandard1.5/CommandLine.dll",
    net_lib = "lib/net45/CommandLine.dll",
    mono_lib = "lib/net45/CommandLine.dll",
    core_deps = [
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.collections.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.console.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.diagnostics.debug.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.globalization.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.io.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.linq.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.linq.expressions.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.reflection.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.reflection.extensions.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.reflection.typeextensions.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.resources.resourcemanager.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.runtime.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.runtime.extensions.dll",
    ],
    net_deps = [
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.collections.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.console.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.diagnostics.debug.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.globalization.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.io.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.linq.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.linq.expressions.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.reflection.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.reflection.extensions.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.reflection.typeextensions.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.resources.resourcemanager.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.runtime.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.runtime.extensions.dll",
    ],
    mono_deps = [
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.collections.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.console.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.diagnostics.debug.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.globalization.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.io.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.linq.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.linq.expressions.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.reflection.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.reflection.extensions.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.reflection.typeextensions.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.resources.resourcemanager.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.runtime.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib.core:system.runtime.extensions.dll",
    ],
    core_files = [
        "lib/netstandard1.5/CommandLine.dll",
        "lib/netstandard1.5/CommandLine.xml",
    ],
    net_files = [
        "lib/net45/CommandLine.dll",
        "lib/net45/CommandLine.XML",
    ],
    mono_files = [
        "lib/net45/CommandLine.dll",
        "lib/net45/CommandLine.XML",
    ],
    )

    dotnet_import_library(
        name = "npgsqllib",
        src = "lib/net451/Npgsql.dll"
    )

    net_gac2(
        name = "Microsoft.VisualStudio.QualityTools.UnitTestFramework",
        version = "10.1.0.0",
        token = "b03f5f7f11d50a3a"
)

net_gac4(
    name = "System.ComponentModel.DataAnnotations",
    version = "4.0.0.0",
    token = "31bf3856ad364e35"
)

vs2017_ref_net(name = "vs_ref_2017")
    """
)