@@ -3,7 +3,6 @@ Linking action for D rules.
33
44"""
55
6- load ("@bazel_lib//lib:expand_make_vars.bzl" , "expand_variables" )
76load ("@rules_cc//cc:defs.bzl" , "cc_common" )
87load ("@rules_cc//cc/common:cc_info.bzl" , "CcInfo" )
98load ("//d/private/rules:cc_toolchain.bzl" , "find_cc_toolchain_for_linking" )
@@ -15,9 +14,7 @@ def link_action(ctx, d_info):
1514 ctx: The rule context.
1615 d_info: The DInfo provider containing the linking context.
1716 Returns:
18- List of providers:
19- - DefaultInfo: The linked binary.
20- - RunEnvironmentInfo: The environment variables for the linked binary.
17+ A File for the linked binary.
2118 """
2219 toolchain = ctx .toolchains ["//d:toolchain_type" ].d_toolchain_info
2320 cc_linker_info = find_cc_toolchain_for_linking (ctx )
@@ -28,24 +25,12 @@ def link_action(ctx, d_info):
2825 compilation_outputs = cc_common .create_compilation_outputs (
2926 objects = depset (direct = [d_info .compilation_output ]),
3027 )
31- res = cc_common .link (
28+ return cc_common .link (
3229 name = ctx .label .name ,
3330 actions = ctx .actions ,
3431 feature_configuration = cc_linker_info .feature_configuration ,
3532 cc_toolchain = cc_linker_info .cc_toolchain ,
3633 compilation_outputs = compilation_outputs ,
3734 linking_contexts = linking_contexts ,
3835 user_link_flags = toolchain .linker_flags + ctx .attr .linkopts + d_info .linker_flags .to_list (),
39- )
40- output = res .executable
41- env_with_expansions = {
42- k : expand_variables (ctx , ctx .expand_location (v , ctx .files .data ), [output ], "env" )
43- for k , v in ctx .attr .env .items ()
44- }
45- return [
46- DefaultInfo (
47- executable = output ,
48- runfiles = ctx .runfiles (files = ctx .files .data ),
49- ),
50- RunEnvironmentInfo (environment = env_with_expansions ),
51- ]
36+ ).executable
0 commit comments