Skip to content

Commit

Permalink
[dotnet] Make sure we can repin deps
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Oct 9, 2023
1 parent c8d121e commit e7babc9
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions dotnet/0005-Ensure-csharp_library-files-are-unique.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
diff --git a/dotnet/private/rules/common/binary.bzl b/dotnet/private/rules/common/binary.bzl
index 1c48385..fc63f69 100644
index 4063d24..9845f49 100644
--- a/dotnet/private/rules/common/binary.bzl
+++ b/dotnet/private/rules/common/binary.bzl
@@ -98,7 +98,7 @@ def build_binary(ctx, compile_action):
@@ -14,11 +14,12 @@ load(
)
load("//dotnet/private:providers.bzl", "DotnetBinaryInfo")

-def _create_shim_exe(ctx, dll):
+def _create_shim_exe(ctx, tfm, dll):
windows_constraint = ctx.attr._windows_constraint[platform_common.ConstraintValueInfo]

apphost = ctx.toolchains["@rules_dotnet//dotnet:toolchain_type"].apphost
- output = ctx.actions.declare_file(paths.replace_extension(dll.basename, ".exe" if ctx.target_platform_has_constraint(windows_constraint) else ""), sibling = dll)
+
+ output = ctx.actions.declare_file("bazelout/%s/%s/%s" % (tfm, ctx.attr.name, paths.replace_extension(dll.basename, ".exe" if ctx.target_platform_has_constraint(windows_constraint) else "")))

ctx.actions.run(
executable = ctx.attr.apphost_shimmer.files_to_run,
@@ -88,7 +89,7 @@ def build_binary(ctx, compile_action):

app_host = None
if ctx.attr.apphost_shimmer:
- app_host = _create_shim_exe(ctx, dll)
+ app_host = _create_shim_exe(ctx, tfm, dll)
direct_runfiles.append(app_host)
default_info_files = default_info_files.append(app_host)

@@ -98,7 +99,7 @@ def build_binary(ctx, compile_action):
depsjson = None
if is_core_framework(tfm):
# Create the runtimeconfig.json for the binary
Expand All @@ -11,7 +35,7 @@ index 1c48385..fc63f69 100644
runtimeconfig_struct = generate_runtimeconfig(
target_framework = tfm,
project_sdk = ctx.attr.project_sdk,
@@ -114,6 +114,8 @@ def build_binary(ctx, compile_action):
@@ -114,6 +115,8 @@ def build_binary(ctx, compile_action):
"./external",
"../",
"../external",
Expand All @@ -20,7 +44,7 @@ index 1c48385..fc63f69 100644
# This one is for when the binary target is used as an tool in e.g. a custom rule
"{}.runfiles".format(launcher.path),
]
@@ -122,7 +124,7 @@ def build_binary(ctx, compile_action):
@@ -122,7 +125,7 @@ def build_binary(ctx, compile_action):
content = json.encode_indent(runtimeconfig_struct),
)

Expand Down

0 comments on commit e7babc9

Please sign in to comment.