Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions dotnet/private/rules/binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,25 @@ load("@bazel_skylib//lib:paths.bzl", "paths")

# DotnetContext, DotnetLibrary
def create_launcher(dotnet, library, shim = None):
launch_target = shim if shim else library.result
launcher = dotnet.declare_file(dotnet, path = "launcher.bat", sibling = launch_target)
dotnet.actions.write(
output = launcher,
content = r"""@echo off
%~dp0{launch_target} %*
""".format(
launch_target = launch_target.basename))

# DllName.runtimeconfig.json
runtimeconfig = write_runtimeconfig(dotnet._ctx, launch_target)
runtimeconfig = write_runtimeconfig(dotnet._ctx, shim)
# DllName.deps.json
depsjson = write_depsjson(dotnet, library)
# ManifestLoader
loader = dotnet.actions.declare_file("ManifestLoader.dll", sibling = library.result)
dotnet.actions.symlink(output = loader, target_file = dotnet._ctx.attr.loader[DotnetLibrary].result)

runfiles = dotnet._ctx.runfiles(
files = [launch_target, dotnet.runner, launcher, runtimeconfig, depsjson, loader],
files = [shim, dotnet.runner, runtimeconfig, depsjson, loader],
transitive_files = depset(
transitive = [library.runfiles, dotnet.host]
)
)

return DefaultInfo(
files = depset([launch_target, library.result, launcher, runtimeconfig, depsjson, loader]),
files = depset([shim, library.result, runtimeconfig, depsjson, loader]),
runfiles = runfiles,
executable = launcher,
executable = shim,
)

# copies apphost.exe and embeds target dll path to dllname.exe
Expand Down