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

View file

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