Skip to content

Commit

Permalink
meta: Removes unneeded resolve tools from bazel rules
Browse files Browse the repository at this point in the history
Signed-off-by: Ethan Mahintorabi <[email protected]>
  • Loading branch information
QuantamHD committed Feb 29, 2024
1 parent f449483 commit 1d94dbd
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 25 deletions.
4 changes: 1 addition & 3 deletions dependency_support/org_theopenroadproject/tcl_encode.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ def _tcl_encode_impl(ctx):
outfile_name = ctx.attr.out if ctx.attr.out else ctx.attr.name + ".cc"
output_file = ctx.actions.declare_file(outfile_name)

(inputs, _) = ctx.resolve_tools(tools = [ctx.attr._tclsh, ctx.attr._encode_script])

args = ctx.actions.args()
args.add(ctx.file._encode_script)
args.add(output_file)
Expand All @@ -35,7 +33,7 @@ def _tcl_encode_impl(ctx):
outputs = [output_file],
inputs = ctx.files.srcs,
arguments = [args],
tools = inputs,
tools = [ctx.executable._tclsh, ctx.executable._encode_script],
executable = ([file for file in ctx.files._tclsh if file.basename == "tclsh"][0]),
)
return [DefaultInfo(files = depset([output_file]))]
Expand Down
7 changes: 2 additions & 5 deletions dependency_support/org_theopenroadproject/tcl_wrap_cc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ def _tcl_wrap_cc_impl(ctx):
outfile_name = ctx.attr.out if ctx.attr.out else ctx.attr.name + ".cc"
output_file = ctx.actions.declare_file(outfile_name)

(inputs, _) = ctx.resolve_tools(tools = [ctx.attr._swig])

include_root_directory = root_label.workspace_root + "/" + root_label.package

src_inputs = _get_transative_srcs(ctx.files.srcs + ctx.files.root_swig_src, ctx.attr.deps)
Expand Down Expand Up @@ -87,8 +85,7 @@ def _tcl_wrap_cc_impl(ctx):
outputs = [output_file],
inputs = src_inputs,
arguments = [args],
tools = inputs,
executable = ([file for file in ctx.files._swig if file.basename == "swig"][0]),
executable = ctx.executable._swig,
)
return [
DefaultInfo(files = depset([output_file])),
Expand Down Expand Up @@ -137,7 +134,7 @@ tcl_wrap_cc = rule(
),
"_swig": attr.label(
default = "@org_swig//:swig_stable",
allow_files = True,
executable = True,
cfg = "exec",
),
},
Expand Down
6 changes: 1 addition & 5 deletions flows/flows.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ flow_binary = rule(
)

def _run_step_with_inputs(ctx, step, inputs_dict, outputs_step_dict):
# inputs and output manifests are for the runfiles of the step executable.
(tool_inputs, input_manifests) = ctx.resolve_tools(tools = [step])

# The inputs_env and inputs handle the named inputs of the step.
inputs = []
inputs_env = {}
Expand Down Expand Up @@ -208,11 +205,10 @@ def _run_step_with_inputs(ctx, step, inputs_dict, outputs_step_dict):
outputs = outputs,
inputs = inputs,
command = step[DefaultInfo].files_to_run.executable.path,
tools = tool_inputs,
tools = [step.files_to_run],
arguments = step[FlowStepInfo].arguments,
mnemonic = step[FlowStepInfo].executable_type,
env = dicts.add(constants_env, inputs_env, outputs_env),
input_manifests = input_manifests,
toolchain = None,
)

Expand Down
3 changes: 0 additions & 3 deletions place_and_route/open_road.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ def openroad_command(ctx, commands, input_db = None, step_name = None, inputs =
command_file = ctx.actions.declare_file(file_name)
ctx.actions.write(command_file, content = "\n".join(real_commands))

(tool_inputs, input_manifests) = ctx.resolve_tools(tools = [ctx.attr._openroad])
openroad_runfiles_dir = ctx.executable._openroad.path + ".runfiles"

log_file = ctx.actions.declare_file(
Expand All @@ -252,8 +251,6 @@ def openroad_command(ctx, commands, input_db = None, step_name = None, inputs =
command_file.path,
],
executable = ctx.executable._openroad,
tools = tool_inputs,
input_manifests = input_manifests,
env = {
"TCL_LIBRARY": openroad_runfiles_dir + "/tk_tcl/library",
},
Expand Down
5 changes: 1 addition & 4 deletions static_timing/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def _run_opensta_impl(ctx):
netlist = synth_info.synthesized_netlist
liberty_file = synth_info.standard_cell_info.default_corner.liberty

(tool_inputs, input_manifests) = ctx.resolve_tools(tools = [ctx.attr._opensta])
opensta_runfiles_dir = ctx.executable._opensta.path + ".runfiles"

sta_tcl = ctx.file.sta_tcl
Expand All @@ -47,11 +46,9 @@ def _run_opensta_impl(ctx):

ctx.actions.run(
outputs = [sta_log],
inputs = tool_inputs.to_list() + [liberty_file, sta_tcl, netlist],
inputs = [liberty_file, sta_tcl, netlist],
arguments = ["-exit", sta_tcl.path],
executable = ctx.executable._opensta,
tools = tool_inputs,
input_manifests = input_manifests,
env = env,
mnemonic = "RunningSTA",
toolchain = None,
Expand Down
6 changes: 1 addition & 5 deletions synthesis/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ def _synthesize_design_impl(ctx):
inputs.append(abc_script)
inputs.append(default_liberty_file)

(tool_inputs, input_manifests) = ctx.resolve_tools(tools = [ctx.attr.yosys_tool])

yosys_runfiles_dir = ctx.executable.yosys_tool.path + ".runfiles"

log_file = ctx.actions.declare_file("{}_yosys_output.log".format(ctx.attr.name))
Expand Down Expand Up @@ -170,11 +168,9 @@ def _synthesize_design_impl(ctx):

ctx.actions.run(
outputs = [output_file, log_file],
inputs = inputs + tool_inputs.to_list(),
inputs = inputs,
arguments = [args],
executable = ctx.executable.yosys_tool,
tools = tool_inputs,
input_manifests = input_manifests,
env = env,
mnemonic = "SynthesizingRTL",
toolchain = None,
Expand Down

0 comments on commit 1d94dbd

Please sign in to comment.