Mercurial
diff gui_ze/gui_ze.bzl @ 260:1f9877b637e9
Add Copilot-powered cyberpunk JRPG chat
Integrate the production JRPG chat with Seobeo streaming, Deita persistence, and a Bazel-managed Copilot SDK and LiteLLM inference stack.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <mrjunejune@users.noreply.github.com> |
|---|---|
| date | Wed, 05 Aug 2026 09:19:41 -0700 |
| parents | 70f2a3dafc1c |
| children |
line wrap: on
line diff
--- a/gui_ze/gui_ze.bzl Wed Aug 05 09:19:41 2026 -0700 +++ b/gui_ze/gui_ze.bzl Wed Aug 05 09:19:41 2026 -0700 @@ -10,6 +10,9 @@ implementation = _foo_impl, ) +def _shell_quote(value): + return "'{}'".format(value.replace("'", "'\"'\"'")) + def _bundle_impl(ctx): """ bundle binary target into a folder which can later be used to make a post to github easily. @@ -20,25 +23,41 @@ # Name as output directory out_dir = ctx.actions.declare_directory(ctx.label.name) - - copy_cmd = [] - copy_cmd.append("mkdir -p {}".format(out_dir.path)) + manifest = ctx.actions.declare_file(ctx.label.name + ".runfiles_manifest") + manifest_lines = [] for f in runfiles_files: if f.path == binary.path: continue - paths = "/".join(f.short_path.split("/")[:-1]) + short_path = f.short_path + if f.short_path.startswith("../"): + short_path = short_path[3:] + paths = "/".join(short_path.split("/")[:-1]) full_path = "{}/{}".format(out_dir.path, paths) - copy_cmd.append("mkdir -p {}".format(full_path)) - copy_cmd.append("cp -rL {} {}".format(f.path, full_path)) + manifest_lines.append("{}\t{}\n".format(f.path, full_path)) - copy_cmd.append("cp {} {}".format(binary.path, out_dir.path)) + ctx.actions.write( + output = manifest, + content = "".join(manifest_lines), + ) ctx.actions.run_shell( - inputs = runfiles_files, + inputs = runfiles_files + [manifest], outputs = [out_dir], - command = " && ".join(copy_cmd), + command = """ +set -eu +mkdir -p {out_dir} +while IFS=$'\\t' read -r source destination; do + mkdir -p "$destination" + cp -rL "$source" "$destination" +done < {manifest} +cp {binary} {out_dir} +""".format( + binary = _shell_quote(binary.path), + manifest = _shell_quote(manifest.path), + out_dir = _shell_quote(out_dir.path), + ), progress_message = "Bundling {}".format(ctx.label.name), ) return [DefaultInfo(files = depset([out_dir]))]