Skip to content

Commit

Permalink
Adding return value to .NET merge_assembly bazel build rule
Browse files Browse the repository at this point in the history
  • Loading branch information
jimevans committed Jul 1, 2019
1 parent 283a2b8 commit fefd4e0
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion dotnet/merge-assemblies.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
load("@io_bazel_rules_dotnet//dotnet/private:context.bzl", "dotnet_context")
load(
"@io_bazel_rules_dotnet//dotnet/private:context.bzl",
"dotnet_context"
)
load(
"@io_bazel_rules_dotnet//dotnet/private:providers.bzl",
"DotnetLibrary",
)

def _merged_assembly_impl(ctx):
dotnet = dotnet_context(ctx)
name = ctx.label.name

deps = ctx.attr.deps
result = ctx.outputs.out

args = [
"-v4",
"-xmldocs",
Expand All @@ -23,13 +36,36 @@ def _merged_assembly_impl(ctx):
outputs = [ctx.outputs.out]
)

data = depset()

runfiles = depset(direct = [result], transitive = [d[DotnetLibrary].runfiles for d in deps] + [data])
transitive = depset(direct = deps, transitive = [a[DotnetLibrary].transitive for a in deps])

merged_lib = dotnet.new_library(
dotnet = dotnet,
name = name,
deps = deps,
transitive = transitive,
runfiles = runfiles,
result = result,
)

return [
merged_lib,
DefaultInfo(
files = depset([merged_lib.result]),
runfiles = ctx.runfiles(files = [], transitive_files = merged_lib.runfiles),
),
]

merged_assembly = rule(
implementation = _merged_assembly_impl,
attrs = {
"src_assembly": attr.label(),
"deps": attr.label_list(),
"out": attr.output(mandatory = True),
"keyfile": attr.label(allow_single_file = True),
"dotnet_context_data": attr.label(default = Label("@io_bazel_rules_dotnet//:dotnet_context_data")),
"merge_tool": attr.label(
executable = True,
cfg = "host",
Expand Down

0 comments on commit fefd4e0

Please sign in to comment.