#!/usr/bin/env bash # Gera o vlads-disco.love do Vlad's Disco (Saviorium, sasha9843 e Jullyfish; codigo MIT, arte e musica # CC BY-SA 4.0) a partir do commit e6df7cb do repositorio, sem patch. Segue o makelove.toml do autor: nada de # arquivos ocultos, .aseprite (projetos do editor, incluindo as folhas "-refs" de referencia), .bat, .ps1, .toml # e .sh; tambem ficam de fora build/ (pagina do love.js), README.md e o GIF de apresentacao. O .love e um zip # deterministico (ordem alfabetica, data fixa, deflate). # # src/FredGames.Bundler/Builds/build-vlads-disco.sh # # Saida: artifacts/build/vlads-disco-e6df7cb/vlads-disco.love set -euo pipefail COMMIT=e6df7cbff6377cf5a945a159303fcc06edd199f5 SHA256=407883a500733df3f445ec266c24f5cde398ff2c5f0bb38d133b255e696d192c here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" root="$(git -C "$here" rev-parse --show-toplevel 2>/dev/null || pwd)" out="$root/artifacts/build/vlads-disco-e6df7cb" cache="$root/artifacts/build/cache" mkdir -p "$cache" tarball="$cache/vlads-disco-e6df7cb.tar.gz" [ -f "$tarball" ] || curl -fsSL "https://github.com/Saviorium/lowrezjam-2022/archive/$COMMIT.tar.gz" -o "$tarball" echo "$SHA256 $tarball" | shasum -a 256 -c - rm -rf "$out" mkdir -p "$out/tree" tar -xzf "$tarball" -C "$out/tree" --strip-components 1 python3 -I - "$out/tree" "$out/vlads-disco.love" <<'PY' import os, sys, zipfile src, dest = sys.argv[1:] top_ok = ('data', 'engine', 'game', 'lib') top_files = ('main.lua', 'conf.lua', 'settings.lua') names = [] for base, dirs, files in os.walk(src): for f in files: rel = os.path.relpath(os.path.join(base, f), src).replace(os.sep, '/') parts = rel.split('/') if any(p.startswith('.') for p in parts): continue if len(parts) == 1: if rel not in top_files: continue elif parts[0] not in top_ok: continue if rel.endswith(('.aseprite', '.bat', '.ps1', '.toml', '.sh')): continue if f.lower() == 'readme.md': continue names.append(rel) with zipfile.ZipFile(dest, 'w', zipfile.ZIP_DEFLATED, compresslevel=9) as z: for rel in sorted(names): info = zipfile.ZipInfo(rel, (1980, 1, 1, 0, 0, 0)) info.compress_type = zipfile.ZIP_DEFLATED info.external_attr = 0o644 << 16 info.create_system = 3 with open(os.path.join(src, rel), 'rb') as fh: z.writestr(info, fh.read(), compresslevel=9) PY shasum -a 256 "$out/vlads-disco.love"