halkyon/tool/workspace_only.sh
Tizian 「ティツィアーン」 2ec58bfaee
fix(deploy): the images drop third_party/'s overrides instead of copying it
Two deploys failed building the images (4 Nov 2026): first the
dictionaries' image lacked third_party/ (pub refuses an override whose
path is missing, exit 66), then, with it copied, pub refused the
overrides themselves, as the three plugins depend on the Flutter SDK,
which the dart image doesn't have (exit 69); every image would have.
No image's package uses them, so tool/workspace_only.sh, which already
narrows the root pubspec for an image, drops the overrides naming
third_party/, and no Dockerfile copies it.

Each image's build stage replayed from this commit with a standalone
Dart 3.13.4, a fresh pub cache, dash and mawk: all four build, and the
commit deployed before fails as the deploy did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-11-04 13:43:46 +01:00

31 lines
1.4 KiB
Shell
Executable file

#!/bin/sh
# Narrows the workspace in ./pubspec.yaml to the members named, for an image that builds
# only those (the Dockerfiles of the servers and Learn's curator): pub then resolves
# without the other members, whose folders the image doesn't hold. Fails if one named
# isn't a member, so a renamed package fails the build loudly.
#
# It also drops the dependency overrides of third_party/'s patched Flutter plugins: an
# image has Dart without Flutter, and pub refuses an override depending on the Flutter
# SDK, used or not (exit 69, the deploys of 4 Nov 2026). No image's package uses them.
#
# sh tool/workspace_only.sh apps/learn/halkyon_learn_server packages/halkyon_base_server
set -eu
awk -v keep="$*" '
BEGIN { n = split(keep, k, " "); for (i = 1; i <= n; i++) wanted[" - " k[i]] = 1 }
# An override held back until its next line says whether its path is in third_party.
held != "" {
line = held; held = ""
if ($0 ~ /^ path: third_party\//) { next }
print line
}
/^[a-z_]+:/ { overrides = ($0 == "dependency_overrides:") }
overrides && /^ [a-z0-9_]+:$/ { held = $0; next }
/^workspace:/ { block = 1; print; next }
block && /^ - / { if ($0 in wanted) { print; found[$0] = 1 }; next }
{ block = 0; print }
END {
for (w in wanted) if (!(w in found)) { print "Not a workspace member:" substr(w, 4) > "/dev/stderr"; failed = 1 }
exit failed
}
' pubspec.yaml >pubspec.yaml.narrowed
mv pubspec.yaml.narrowed pubspec.yaml