#!/usr/bin/env bash set -e cdir=$(cd "$(dirname "$0")" && pwd) cd "$cdir" echo "=== Pipeline App Build ===" # 1. Create venv if [ ! -d py3 ]; then python3 -m venv py3 fi source py3/bin/activate # 2. Install foundation packages mkdir -p pkgs for m in apppublic sqlor ahserver bricks-for-python xls2ddl rbac appbase; do echo "install $m ..." cd "$cdir/pkgs" if [ ! -d "$m" ]; then git clone https://git.opencomputing.cn/yumoqing/$m || echo "SKIP: $m clone failed" fi if [ -d "$m" ]; then cd "$m" "$cdir/py3/bin/pip" install . 2>&1 | tail -1 fi cd "$cdir" done # 3. Build bricks frontend cd "$cdir/pkgs" if [ ! -d bricks ]; then git clone https://git.opencomputing.cn/yumoqing/bricks || true fi if [ -d bricks/bricks ]; then cd bricks/bricks && bash build.sh 2>&1 | tail -3 ln -sf "$cdir/pkgs/bricks/dist" "$cdir/bricks" fi cd "$cdir" # 4. Install business modules for mod in pipeline_core pipeline_ops pipeline_dist; do echo "install $mod ..." cd "$cdir/$mod" "$cdir/py3/bin/pip" install . 2>&1 | tail -1 # Generate DDL from models if [ -d models ] && ls models/*.json >/dev/null 2>&1; then "$cdir/py3/bin/json2ddl" mysql models/ > "$cdir/$mod/mysql.ddl.sql" 2>/dev/null || echo " DDL generation skipped (json2ddl not available)" fi # Generate CRUD UI from json definitions if [ -d json ] && ls json/*.json >/dev/null 2>&1; then cd json for f in *.json; do "$cdir/py3/bin/xls2ui" -m ../models -o ../wwwroot "$mod" "$f" 2>/dev/null || echo " CRUD generation skipped for $f" done cd .. fi cd "$cdir" done # 5. Create runtime dirs mkdir -p "$cdir/logs" "$cdir/files" chmod +x "$cdir/start.sh" "$cdir/stop.sh" echo "=== Build complete ==="