Protocol Buffers - Google's data interchange format (grpc依赖) https://developers.google.com/protocol-buffers/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
3.4 KiB

# Protobuf C# runtime
#
# See also code generation logic under /src/google/protobuf/compiler/csharp.
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("//:protobuf.bzl", "internal_csharp_proto_library")
load("//build_defs:internal_shell.bzl", "inline_sh_test")
load("//conformance:defs.bzl", "conformance_test")
################################################################################
# Tests
################################################################################
conformance_test(
name = "conformance_test",
failure_list = "//conformance:failure_list_csharp.txt",
testee = "//conformance:conformance_csharp",
text_format_failure_list = "//conformance:text_format_failure_list_csharp.txt",
)
################################################################################
# CSharp Runtime
################################################################################
filegroup(
name = "srcs",
srcs = glob([
"keys/*",
"protos/*",
"src/**/*.cs*", # .cs and .csproj
], exclude = [
# Exclude generated files.
"src/*/obj/**/*"
]) + [
"src/Directory.Build.props",
"src/Google.Protobuf.Test/testprotos.pb",
"src/Google.Protobuf.sln",
],
visibility = [
"//csharp:__subpackages__",
"//conformance:__subpackages__"
],
)
filegroup(
name = "wkt_cs_srcs",
srcs = [
"src/Google.Protobuf/Reflection/Descriptor.cs",
"src/Google.Protobuf/WellKnownTypes/Any.cs",
"src/Google.Protobuf/WellKnownTypes/Api.cs",
"src/Google.Protobuf/WellKnownTypes/Duration.cs",
"src/Google.Protobuf/WellKnownTypes/Empty.cs",
"src/Google.Protobuf/WellKnownTypes/FieldMask.cs",
"src/Google.Protobuf/WellKnownTypes/SourceContext.cs",
"src/Google.Protobuf/WellKnownTypes/Struct.cs",
"src/Google.Protobuf/WellKnownTypes/Timestamp.cs",
"src/Google.Protobuf/WellKnownTypes/Type.cs",
"src/Google.Protobuf/WellKnownTypes/Wrappers.cs",
],
visibility = ["//src/google/protobuf/compiler/csharp:__pkg__"],
)
inline_sh_test(
name = "tests",
srcs = [
":srcs",
"src/Google.Protobuf.sln",
"//csharp/src/Google.Protobuf.Conformance:srcs",
],
cmd = """
pushd `dirname $(location src/Google.Protobuf.sln)`/..
dotnet restore src/Google.Protobuf.sln
dotnet build -c Release src/Google.Protobuf.sln
dotnet test -c Release -f netcoreapp3.1 src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
popd
""",
)
################################################################################
# Distribution files
################################################################################
pkg_files(
name = "dist_files",
srcs = [
":srcs",
".editorconfig",
".gitignore",
"BUILD.bazel",
"CHANGES.txt",
"Google.Protobuf.Tools.nuspec",
"Google.Protobuf.Tools.targets",
"NuGet.Config",
"README.md",
"build_packages.bat",
"build_release.sh",
"build_tools.sh",
"buildall.bat",
"buildall.sh",
"generate_protos.sh",
"install_dotnet_sdk.ps1",
"//csharp/src/Google.Protobuf.Conformance:dist_files",
],
strip_prefix = strip_prefix.from_root(""),
visibility = ["//pkg:__pkg__"],
)
sh_binary(
name = "release",
srcs = ["build_release.sh"],
args = ["$(location build_release.sh)"],
)