halkyon/tool/workspace_only.sh
Tizian 「ティツィアーン」 af1dbee509
build: Melos, a Dart check and every path for the single repository
- Melos 8.9 as the root's dev dependency, with scripts across the
  workspace (analyze, test:dart, test:flutter, generate, check) and its
  filters (--diff, --include-dependents); cli_util overridden to 0.5.2
  for it, since Learn's flutter_launcher_icons asks for 0.4 and uses only
  its logger, unchanged in 0.5.
- tool/check.dart in place of tool/check.sh: packages, formatting of our
  own files, analysis, the tools' tests, then every package's tests
  through Melos (--changed-since=<commit> for only what changed and what
  depends on it). tool/pre-push is the hook: the signature check, then
  the checks. CI generates every server's code and runs the same check.
- The images build from the root with a workspace narrowed to what they
  need (tool/workspace_only.sh); compose, the deploy's migration test,
  the snap, the release script, the editor's launch files and Learn's
  asset tools (run from apps/learn) follow the new layout.
- The project's source is named as project-halkyon/halkyon (source link,
  snap, F-Droid listing, release uploads); the AGPL packages carry the
  licence's own text.

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

19 lines
894 B
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 Learn's server and 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.
#
# 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 }
/^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