ci: eliminate duplicate build_runner run in CheckGenerated #514

Merged
guettlibot merged 4 commits from issue-492-eliminate-duplicate-build-runner into main 2026-06-07 03:30:44 +00:00
Showing only changes of commit 80059b67e6 - Show all commits
+5 -4
View File
@@ -511,10 +511,11 @@ func (m *Ci) CheckGenerated(ctx context.Context) (string, error) {
WithDirectory("/committed", m.checkSrc(), dagger.ContainerWithDirectoryOpts{Owner: "ci"}).
WithDirectory("/generated", fresh, dagger.ContainerWithDirectoryOpts{Owner: "ci"}).
WithExec([]string{"/bin/bash", "-c",
`if diff -rq --include='*.g.dart' --include='*.mocks.dart' /committed /generated; then ` +
`echo "Generated files are up to date."; ` +
`else echo "ERROR: Generated files are out of date — run: dart run build_runner build"; exit 1; ` +
`fi`}).
`stale=$(find /committed -name '*.g.dart' -o -name '*.mocks.dart' | ` +
`while IFS= read -r f; do rel="${f#/committed/}"; diff -q "$f" "/generated/$rel" >/dev/null 2>&1 || echo "$rel"; done); ` +
`if [ -n "$stale" ]; then ` +
`echo "ERROR: Generated files are out of date — run: dart run build_runner build"; echo "$stale"; exit 1; ` +
`else echo "Generated files are up to date."; fi`}).
Stdout(ctx)
}