master
John Lauer Every file the Rust build embeds from outside rust/ (pup-bridge#118): src/extension-nbe/**, src/extension-identity/iden… c7a8f33 1mo ago
#!/usr/bin/env python3
"""Every file the Rust build pulls in with include_bytes!/include_str!, as repo-relative paths.

tools/ship.sh pushes this list with the rust/ tree so a checkout of the page builds (pup-bridge#118,
Kyle: ext_assets.rs embeds src/extension-nbe/** and src/extension-identity/identity-worker.js, which no
hand-kept push list covered). Derived from the sources themselves, so a new embed can never be missed.
Exits non-zero if an embedded file is missing on disk."""
import os, re, sys
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
pat = re.compile(r'include_(?:bytes|str)!\(\s*"([^"]+)"\s*\)')
found, missing = set(), []
for base, dirs, files in os.walk(os.path.join(root, 'rust')):
    dirs[:] = [d for d in dirs if d != 'target']
    for f in files:
        if not f.endswith('.rs'): continue
        src = os.path.join(base, f)
        for m in pat.finditer(open(src, encoding='utf-8', errors='replace').read()):
            p = os.path.normpath(os.path.join(base, m.group(1)))
            rel = os.path.relpath(p, root).replace(os.sep, '/')
            (found.add(rel) if os.path.isfile(p) else missing.append(f"{rel} (from {os.path.relpath(src, root)})"))
if missing:
    print("embedded but missing on disk:\n  " + "\n  ".join(missing), file=sys.stderr); sys.exit(1)
print("\n".join(sorted(found)))