From c369e32c939d5770e6dc95e592c82b753088e598 Mon Sep 17 00:00:00 2001 From: Marc Villain Date: Sun, 22 Feb 2026 21:14:16 +0100 Subject: [PATCH] feat(tools,build): dynamically list files to build --- tools/build.sh | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/tools/build.sh b/tools/build.sh index 68d2ca7..a691445 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -16,34 +16,17 @@ fi rm -f "$OUTPUT" -BUILD_ORDER=( - "header.sql" - "types.sql" - "config.sql" - "organizations.sql" - "roles.sql" - "activities.sql" - "views.sql" - "contexts.sql" - "rules.sql" - "cross_org_rules.sql" - "admin_rules.sql" - "audit.sql" - "hierarchy_functions.sql" - "materialized_views.sql" - "validation.sql" - "auth_cache.sql" - "authorization.sql" - "policy_dsl.sql" - "rls.sql" - "obligations.sql" - "admin_helpers.sql" - "footer.sql" -) +BUILD_FILES=("header.sql") + +while IFS= read -r file; do + BUILD_FILES+=("$file") +done < <(find "$SRC_DIR" -maxdepth 1 -name "*.sql" -type f ! -name "header.sql" ! -name "footer.sql" -exec basename {} \; | sort) + +BUILD_FILES+=("footer.sql") file_count=0 -for filename in "${BUILD_ORDER[@]}"; do +for filename in "${BUILD_FILES[@]}"; do filepath="$SRC_DIR/$filename" if [ -f "$filepath" ]; then cat "$filepath" >> "$OUTPUT"