rules_dotnet icon indicating copy to clipboard operation
rules_dotnet copied to clipboard

Improve documentation regarding generated artifacts

Open igorgatis opened this issue 5 years ago • 0 comments

I put together a very simple example project:

hello/
├── BUILD.bazel
└── Program.cs

Where hello/BUILD.bazel:

load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "dotnet_binary")

dotnet_binary(
    name = "hello.exe",
    srcs = glob(["**/*.cs"]),
    deps = [
        "@io_bazel_rules_dotnet//dotnet/stdlib:system.linq.dll",
        "@io_bazel_rules_dotnet//dotnet/stdlib:system.dll",
    ],
)

When I run bazel build //hello:hello.exe, it produces:

bazel-bin/hello/hello.exe
├── System.Core.dll
├── System.Linq.dll
├── System.dll
├── hello.exe
├── hello.exe_0.exe
├── hello.exe_0.exe.runfiles
│   ├── MANIFEST
│   └── samplerepo
│       └── hello
│           └── hello.exe
│               ├── System.Core.dll -> /root/.cache/bazel/.../bazel-out/k8-fastbuild/bin/hello/hello.exe/System.Core.dll
│               ├── System.Linq.dll -> /root/.cache/bazel/.../bazel-out/k8-fastbuild/bin/hello/hello.exe/System.Linq.dll
│               ├── System.dll -> /root/.cache/bazel/.../bazel-out/k8-fastbuild/bin/hello/hello.exe/System.dll
│               ├── hello.exe -> /root/.cache/bazel/.../bazel-out/k8-fastbuild/bin/hello/hello.exe/hello.exe
│               ├── hello.exe_0.exe -> /root/.cache/bazel/.../bazel-out/k8-fastbuild/bin/hello/hello.exe/hello.exe_0.exe
│               ├── mono -> /root/.cache/bazel/.../bazel-out/k8-fastbuild/bin/hello/hello.exe/mono
│               └── mscorlib.dll -> /root/.cache/bazel/.../bazel-out/k8-fastbuild/bin/hello/hello.exe/mscorlib.dll
├── hello.exe_0.exe.runfiles_manifest
├── mono
└── mscorlib.dll

What is hello.exe_0.exe? Why does it get generated even if I don't explicitly ask for it? Is it needed by hello.exe (the binary)? If I want to pack minimal set of files required by my application, which files do I need? How do I use this rule with, say, container_image (rules_docker)?

igorgatis avatar Oct 08 '20 02:10 igorgatis