• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
2load("//build_defs:internal_shell.bzl", "inline_sh_binary")
3
4inline_sh_binary(
5    name = "build_conformance_test",
6    srcs = ["Google.Protobuf.Conformance.csproj"],
7    cmd = "dotnet build -c Release $(SRCS)",
8    visibility = ["//visibility:private"],
9)
10
11CONFORMANCE_DEPS = [
12    "Google.Protobuf.dll",
13    "Google.Protobuf.Conformance.deps.json",
14    "Google.Protobuf.Conformance.pdb",
15    "Google.Protobuf.Conformance.runtimeconfig.json",
16    "Google.Protobuf.Test.dll",
17    "Google.Protobuf.Test.TestProtos.dll",
18    "Microsoft.TestPlatform.CommunicationUtilities.dll",
19    "Microsoft.TestPlatform.CoreUtilities.dll",
20    "Microsoft.TestPlatform.CrossPlatEngine.dll",
21    "Microsoft.TestPlatform.PlatformAbstractions.dll",
22    "Microsoft.TestPlatform.Utilities.dll",
23    "Microsoft.VisualStudio.CodeCoverage.Shim.dll",
24    "Microsoft.VisualStudio.TestPlatform.Common.dll",
25    "Microsoft.VisualStudio.TestPlatform.ObjectModel.dll",
26    "NUnit3.TestAdapter.dll",
27    "Newtonsoft.Json.dll",
28    "NuGet.Frameworks.dll",
29    "nunit.engine.api.dll",
30    "nunit.engine.core.dll",
31    "nunit.engine.dll",
32    "nunit.framework.dll",
33    "testcentric.engine.metadata.dll",
34    "testhost.dll",
35]
36
37filegroup(
38    name = "srcs",
39    srcs = [
40        "Google.Protobuf.Conformance.csproj",
41        "Program.cs",
42    ],
43    visibility = [
44        "//csharp:__subpackages__",
45    ],
46)
47
48genrule(
49    name = "package_conformance_test",
50    srcs = [
51        "Program.cs",
52        "Google.Protobuf.Conformance.csproj",
53        "//conformance:conformance_csharp_proto",
54        "//csharp:srcs",
55    ],
56    outs = CONFORMANCE_DEPS + ["Google.Protobuf.Conformance.dll"],
57    cmd = """
58        SRCDIR=$$(dirname $(location :Program.cs))
59        cp $(location //conformance:conformance_csharp_proto) $$SRCDIR
60        DOTNET_CLI_HOME=/tmp ./$(location :build_conformance_test)
61        cp -r $$SRCDIR/bin/Release/net6.0/* $(RULEDIR)
62    """,
63    tools = [":build_conformance_test"],
64    visibility = ["//visibility:private"],
65)
66
67filegroup(
68    name = "conformance_dll",
69    srcs = ["Google.Protobuf.Conformance.dll"],
70    data = [":package_conformance_test"],
71    visibility = ["//conformance:__subpackages__"],
72)
73
74filegroup(
75    name = "conformance_runfiles",
76    srcs = CONFORMANCE_DEPS,
77    data = [":package_conformance_test"],
78    visibility = ["//conformance:__subpackages__"],
79)
80
81################################################################################
82# Distribution files
83################################################################################
84
85pkg_files(
86    name = "dist_files",
87    srcs = [
88        "BUILD.bazel",
89        "Google.Protobuf.Conformance.csproj",
90        "Program.cs",
91    ],
92    strip_prefix = strip_prefix.from_root(""),
93    visibility = ["//csharp:__pkg__"],
94)
95