Mercurial
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 259:667156fcd3e3 | 260:1f9877b637e9 |
|---|---|
| 7 return [DefaultInfo(files = depset([out]))] | 7 return [DefaultInfo(files = depset([out]))] |
| 8 | 8 |
| 9 foo_binary = rule( | 9 foo_binary = rule( |
| 10 implementation = _foo_impl, | 10 implementation = _foo_impl, |
| 11 ) | 11 ) |
| 12 | |
| 13 def _shell_quote(value): | |
| 14 return "'{}'".format(value.replace("'", "'\"'\"'")) | |
| 12 | 15 |
| 13 def _bundle_impl(ctx): | 16 def _bundle_impl(ctx): |
| 14 """ | 17 """ |
| 15 bundle binary target into a folder which can later be used to make a post to github easily. | 18 bundle binary target into a folder which can later be used to make a post to github easily. |
| 16 """ | 19 """ |
| 18 binary = binary_target[DefaultInfo].files.to_list()[0] # First files are binary | 21 binary = binary_target[DefaultInfo].files.to_list()[0] # First files are binary |
| 19 runfiles_files = binary_target[DefaultInfo].default_runfiles.files.to_list() | 22 runfiles_files = binary_target[DefaultInfo].default_runfiles.files.to_list() |
| 20 | 23 |
| 21 # Name as output directory | 24 # Name as output directory |
| 22 out_dir = ctx.actions.declare_directory(ctx.label.name) | 25 out_dir = ctx.actions.declare_directory(ctx.label.name) |
| 23 | 26 manifest = ctx.actions.declare_file(ctx.label.name + ".runfiles_manifest") |
| 24 copy_cmd = [] | 27 manifest_lines = [] |
| 25 copy_cmd.append("mkdir -p {}".format(out_dir.path)) | |
| 26 | 28 |
| 27 for f in runfiles_files: | 29 for f in runfiles_files: |
| 28 if f.path == binary.path: | 30 if f.path == binary.path: |
| 29 continue | 31 continue |
| 30 | 32 |
| 31 paths = "/".join(f.short_path.split("/")[:-1]) | 33 short_path = f.short_path |
| 34 if f.short_path.startswith("../"): | |
| 35 short_path = short_path[3:] | |
| 36 paths = "/".join(short_path.split("/")[:-1]) | |
| 32 full_path = "{}/{}".format(out_dir.path, paths) | 37 full_path = "{}/{}".format(out_dir.path, paths) |
| 33 copy_cmd.append("mkdir -p {}".format(full_path)) | 38 manifest_lines.append("{}\t{}\n".format(f.path, full_path)) |
| 34 copy_cmd.append("cp -rL {} {}".format(f.path, full_path)) | 39 |
| 35 | 40 ctx.actions.write( |
| 36 copy_cmd.append("cp {} {}".format(binary.path, out_dir.path)) | 41 output = manifest, |
| 42 content = "".join(manifest_lines), | |
| 43 ) | |
| 37 | 44 |
| 38 ctx.actions.run_shell( | 45 ctx.actions.run_shell( |
| 39 inputs = runfiles_files, | 46 inputs = runfiles_files + [manifest], |
| 40 outputs = [out_dir], | 47 outputs = [out_dir], |
| 41 command = " && ".join(copy_cmd), | 48 command = """ |
| 49 set -eu | |
| 50 mkdir -p {out_dir} | |
| 51 while IFS=$'\\t' read -r source destination; do | |
| 52 mkdir -p "$destination" | |
| 53 cp -rL "$source" "$destination" | |
| 54 done < {manifest} | |
| 55 cp {binary} {out_dir} | |
| 56 """.format( | |
| 57 binary = _shell_quote(binary.path), | |
| 58 manifest = _shell_quote(manifest.path), | |
| 59 out_dir = _shell_quote(out_dir.path), | |
| 60 ), | |
| 42 progress_message = "Bundling {}".format(ctx.label.name), | 61 progress_message = "Bundling {}".format(ctx.label.name), |
| 43 ) | 62 ) |
| 44 return [DefaultInfo(files = depset([out_dir]))] | 63 return [DefaultInfo(files = depset([out_dir]))] |
| 45 | 64 |
| 46 bundle = rule( | 65 bundle = rule( |