Move output to stderr, pass debug through as an attr

This commit is contained in:
Reid 'arrdem' McKenzie 2023-07-05 14:23:37 -06:00
parent b76b2437b9
commit 961be891e5
2 changed files with 7 additions and 5 deletions

View file

@ -223,8 +223,8 @@ def rezip_wheels(opts, manifest):
wf = str(wf)
else:
if opts.debug and False:
print("\n---")
json.dump({"$type": "whl", **w}, sys.stdout, indent=2)
print("\n---", file=sys.stderr)
json.dump({"$type": "whl", **w}, sys.stderr, indent=2)
wf = zip_wheel(opts.tmpdir, w)
@ -336,7 +336,7 @@ def main():
manifest = insert_manifest_json(opts, manifest)
if opts.debug:
print("\n---")
print("\n---", file=sys.stderr)
json.dump(
{
"$type": "zapp",
@ -345,7 +345,7 @@ def main():
},
"manifest": manifest,
},
sys.stdout,
sys.stderr,
indent=2,
)

View file

@ -142,12 +142,13 @@ def _zapp_impl(ctx):
)
args = [
"--debug",
"-o", ctx.outputs.executable.path,
manifest_file.path
]
if ctx.attr.use_wheels:
args = ["--use-wheels"] + args
if ctx.attr.debug:
args = ["--debug"] + args
# Run compiler
ctx.actions.run(
@ -183,6 +184,7 @@ _zapp_attrs = {
"prelude_points": attr.string_list(),
"zip_safe": attr.bool(default = True),
"use_wheels": attr.bool(default = False),
"debug": attr.bool(default = False),
# FIXME: These are really toolchain parameters, probably.
"compiler": attr.label(
default = Label(DEFAULT_COMPILER),