Brightspace / rules_csharp

Bazel rules for C#
Apache License 2.0
8 stars 5 forks source link

Add runfiles to binary outputs #35

Closed j3parker closed 5 years ago

j3parker commented 5 years ago

This goes towards #9, but doesn't fix it. We still need to deal with how these files aren't all collected into a single directory.

j3parker commented 5 years ago

I thought this was already in but found it in a local git stash.

Here's some debug output:

$ bazel aquery 'deps(//examples:hello)'
INFO: Analyzed target //examples:hello (3 packages loaded, 11 targets configured).
INFO: Found 1 target...
action 'Compiling hello'
  Mnemonic: CSharpCompile
  Target: //examples:hello
  Configuration: darwin-fastbuild
  ActionKey: a3e291c3fa1899948012c3fee1367ee8
  Inputs: [bazel-out/darwin-fastbuild/bin/examples/lib.ref.dll, examples/hello.cs, external/csharp-build-tools/tasks/netcoreapp2.1/bincore/csc.dll, external/net472/build/.NETFramework/v4.7.2/Facades/System.Linq.dll, external/net472/build/.NETFramework/v4.7.2/System.Core.dll, external/net472/build/.NETFramework/v4.7.2/mscorlib.dll, external/netcore-runtime-osx/dotnet]
  Outputs: [bazel-out/darwin-fastbuild/bin/examples/hello.exe, bazel-out/darwin-fastbuild/bin/examples/hello.pdb, bazel-out/darwin-fastbuild/bin/examples/hello.ref.exe]
  Command Line: (exec external/netcore-runtime-osx/dotnet \
    external/csharp-build-tools/tasks/netcoreapp2.1/bincore/csc.dll \
    /noconfig \
    /unsafe- \
    /checked- \
    /nostdlib+ \
    /utf8output \
    /deterministic+ \
    /filealign:512 \
    /nologo \
    /highentropyva \
    /warn:0 \
    /target:exe \
    /langversion:7.3 \
    /debug+ \
    /optimize- \
    /out:bazel-out/darwin-fastbuild/bin/examples/hello.exe \
    /refout:bazel-out/darwin-fastbuild/bin/examples/hello.ref.exe \
    /pdb:bazel-out/darwin-fastbuild/bin/examples/hello.pdb \
    /r:external/net472/build/.NETFramework/v4.7.2/mscorlib.dll \
    /r:external/net472/build/.NETFramework/v4.7.2/System.Core.dll \
    /r:external/net472/build/.NETFramework/v4.7.2/Facades/System.Linq.dll \
    /r:bazel-out/darwin-fastbuild/bin/examples/lib.ref.dll \
    examples/hello.cs \
    /d:NETFRAMEWORK \
    /d:NET472)

action 'Creating source manifest for //examples:hello'
  Mnemonic: SourceSymlinkManifest
  Target: //examples:hello
  Configuration: darwin-fastbuild
  ActionKey: 9d9c30bf5219638af8dc36bef30fe377
  Inputs: []
  Outputs: [bazel-out/darwin-fastbuild/bin/examples/hello.exe.runfiles_manifest]

action 'Creating runfiles tree bazel-out/darwin-fastbuild/bin/examples/hello.exe.runfiles'
  Mnemonic: SymlinkTree
  Target: //examples:hello
  Configuration: darwin-fastbuild
  ActionKey: 113f733aabdc3943a830671afa0bd694
  Inputs: [bazel-out/darwin-fastbuild/bin/examples/hello.exe.runfiles_manifest]
  Outputs: [bazel-out/darwin-fastbuild/bin/examples/hello.exe.runfiles/MANIFEST]

runfiles for //examples:hello
  Mnemonic: Middleman
  Target: //examples:hello
  Configuration: darwin-fastbuild
  ActionKey: 028d2b531c443d5d56af4ee0494b4d8b
  Inputs: [bazel-out/darwin-fastbuild/bin/examples/hello.exe, bazel-out/darwin-fastbuild/bin/examples/hello.exe.runfiles/MANIFEST, bazel-out/darwin-fastbuild/bin/examples/hello.pdb, bazel-out/darwin-fastbuild/bin/examples/lib.dll, bazel-out/darwin-fastbuild/bin/examples/lib.pdb]
  Outputs: [bazel-out/darwin-fastbuild/internal/_middlemen/examples_Shello.exe-runfiles]

action 'Creating file sources list for //examples:hello'
  Mnemonic: PackagingSourcesManifest
  Target: //examples:hello
  Configuration: darwin-fastbuild
  ActionKey: 9d9c30bf5219638af8dc36bef30fe377
  Inputs: []
  Outputs: [bazel-out/darwin-fastbuild/bin/examples/hello.exe.runfiles.SOURCES]

action 'Compiling lib'
  Mnemonic: CSharpCompile
  Target: //examples:lib
  Configuration: darwin-fastbuild
  ActionKey: 02350ad59c6c87f8b8368ee9fa02ab85
  Inputs: [examples/lib.cs, external/csharp-build-tools/tasks/netcoreapp2.1/bincore/csc.dll, external/net472/build/.NETFramework/v4.7.2/Facades/System.Linq.dll, external/net472/build/.NETFramework/v4.7.2/System.Core.dll, external/net472/build/.NETFramework/v4.7.2/mscorlib.dll, external/netcore-runtime-osx/dotnet]
  Outputs: [bazel-out/darwin-fastbuild/bin/examples/lib.dll, bazel-out/darwin-fastbuild/bin/examples/lib.pdb, bazel-out/darwin-fastbuild/bin/examples/lib.ref.dll]
  Command Line: (exec external/netcore-runtime-osx/dotnet \
    external/csharp-build-tools/tasks/netcoreapp2.1/bincore/csc.dll \
    /noconfig \
    /unsafe- \
    /checked- \
    /nostdlib+ \
    /utf8output \
    /deterministic+ \
    /filealign:512 \
    /nologo \
    /highentropyva \
    /warn:0 \
    /target:library \
    /langversion:7.3 \
    /debug+ \
    /optimize- \
    /out:bazel-out/darwin-fastbuild/bin/examples/lib.dll \
    /refout:bazel-out/darwin-fastbuild/bin/examples/lib.ref.dll \
    /pdb:bazel-out/darwin-fastbuild/bin/examples/lib.pdb \
    /r:external/net472/build/.NETFramework/v4.7.2/mscorlib.dll \
    /r:external/net472/build/.NETFramework/v4.7.2/System.Core.dll \
    /r:external/net472/build/.NETFramework/v4.7.2/Facades/System.Linq.dll \
    examples/lib.cs \
    /d:NETFRAMEWORK \
    /d:NET472)

Looking at the contents of the runfiles manifest:

$ cat bazel-out/darwin-fastbuild/bin/examples/hello.exe.runfiles/MANIFEST
d2l_rules_csharp/examples/hello.exe /private/var/tmp/_bazel_jparker/15a4c5d8b43d43bc514ff6a3dd7ab929/execroot/d2l_rules_csharp/bazel-out/darwin-fastbuild/bin/examples/hello.exe
d2l_rules_csharp/examples/hello.pdb /private/var/tmp/_bazel_jparker/15a4c5d8b43d43bc514ff6a3dd7ab929/execroot/d2l_rules_csharp/bazel-out/darwin-fastbuild/bin/examples/hello.pdb
d2l_rules_csharp/examples/lib.dll /private/var/tmp/_bazel_jparker/15a4c5d8b43d43bc514ff6a3dd7ab929/execroot/d2l_rules_csharp/bazel-out/darwin-fastbuild/bin/examples/lib.dll
d2l_rules_csharp/examples/lib.pdb /private/var/tmp/_bazel_jparker/15a4c5d8b43d43bc514ff6a3dd7ab929/execroot/d2l_rules_csharp/bazel-out/darwin-fastbuild/bin/examples/lib.pdb
j3parker commented 5 years ago

No-op force push to trigger CI