Skip to content

Commit

Permalink
Merge pull request #2103 from actonlang/acton-dep-build-args
Browse files Browse the repository at this point in the history
Filter args to dep builds
  • Loading branch information
plajjan authored Jan 20, 2025
2 parents c032eab + 3dbcc17 commit fdc01f4
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion cli/src/acton.act
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ actor BuildProject(process_cap, env, args, on_build_success: action(str) -> None
absolute_path = file.resolve_relative_path(fs.cwd(), parts[1])
new_dep_arg = parts[0] + "=" + absolute_path
dep_args.extend(["--dep", new_dep_arg])
cmd = ["build"] + build_cmd_args(args) + dep_args
cmd = ["build"] + dep_build_cmd_args(args) + dep_args
cr = CompilerRunner(
process_cap,
env,
Expand Down Expand Up @@ -698,13 +698,34 @@ actor CmdTest(env: Env, args, perf_mode: bool=False):
print("Building project tests...")
project_builder = BuildProject(process_cap, env, args, _on_build_success, _on_build_failure, build_tests=True)

def dep_build_cmd_args(args):
"""Compute command line arguments for building dependencies

A subset of the command line arguments are relevant for building dependencies
"""
cmdargs = []
for argname, arg in args.options.items():
if argname in {"always-build", "cpu", "dep", "dev", "target"}:
if arg.type == "bool":
if args.get_bool(argname):
cmdargs.append("--" + argname)
elif arg.type == "str":
if args.get_str(argname) != '':
cmdargs.append("--" + argname)
cmdargs.append(args.get_str(argname))
elif arg.type == "int":
if args.get_int(argname) != 0:
cmdargs.append("--" + argname)
cmdargs.append(str(args.get_int(argname)))
return cmdargs

def build_cmd_args(args):
cmdargs = []
for argname, arg in args.options.items():
# TODO: reverse this logic, we should only pass in a small set of options, not all
if argname in {"file", "record", "golden-update"}:
continue

if arg.type == "bool":
if args.get_bool(argname):
cmdargs.append("--" + argname)
Expand Down

0 comments on commit fdc01f4

Please sign in to comment.