Skip to content

Commit

Permalink
Redirect disp to output
Browse files Browse the repository at this point in the history
  • Loading branch information
bakpaul committed Jan 8, 2025
1 parent 26aaceb commit 6eadb29
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
37 changes: 32 additions & 5 deletions scripts/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,23 @@ set -o errexit # Exit on error
### Checks

usage() {
echo "Usage: compile.sh <build-dir> <config> <build-options>"
echo "Usage: compile.sh <src-dir> <build-dir> <config> <build-options>"
}

if [ "$#" -ge 2 ]; then
if [ "$#" -ge 3 ]; then
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "$SCRIPT_DIR"/utils.sh

BUILD_DIR="$(cd "$1" && pwd)"
CONFIG="$2"
SRC_DIR="$(cd "$1" && pwd)"
if vm-is-windows; then
SRC_DIR="$(cd $1 && pwd -W)"
fi
BUILD_DIR="$(cd "$2" && pwd)"
CONFIG="$3"
PLATFORM="$(get-platform-from-config "$CONFIG")"
COMPILER="$(get-compiler-from-config "$CONFIG")"
ARCHITECTURE="$(get-architecture-from-config "$CONFIG")"
BUILD_OPTIONS="${*:3}"
BUILD_OPTIONS="${*:4}"
if [ -z "$BUILD_OPTIONS" ]; then
BUILD_OPTIONS="$(get-build-options)" # use env vars (Jenkins)
fi
Expand Down Expand Up @@ -54,6 +58,29 @@ rm -f "$BUILD_DIR/make-failed"
( call-make "$BUILD_DIR" "all" 2>&1 || touch "$BUILD_DIR/make-failed" ) | tee "$BUILD_DIR/make-output.txt"

if in-array "build-release-package" "$BUILD_OPTIONS"; then
echo "-------------- Start Stubfiles generation --------------" | tee -a "$BUILD_DIR/make-output.txt"
export SOFA_ROOT="$BUILD_DIR"
if vm-is-windows; then
# Avoid "libpython3X not found"
if [ -e "$VM_PYTHON3_EXECUTABLE" ]; then
pythonroot="$(dirname $VM_PYTHON3_EXECUTABLE)"
pythonroot="$(cd "$pythonroot" && pwd)"
export PATH="$pythonroot:$pythonroot/DLLs:$pythonroot/Lib:$PATH_RESET"
fi
PYTHON_SCRIPT_DIR=$(cd "$SRC_DIR/applications/plugins/SofaPython3/scripts" && pwd -W )
PYTHON_SITE_PACKAGE_DIR=$(cd "$BUILD_DIR/python3/site-packages" && pwd -W )
export PYTHONPATH="$PYTHON_SITE_PACKAGE_DIR:$PYTHONPATH"

else
export PYTHONPATH="$(cd "$BUILD_DIR/python3/site-packages" && pwd):$PYTHONPATH"
fi

python_exe="$(find-python)"
if [ -n "$python_exe" ]; then
echo "Launching the stub generation with '$python_exe ${PYTHON_SCRIPT_DIR}/generate_stubs.py -d $PYTHON_SITE_PACKAGE_DIR -m Sofa --use_pybind11'" | tee -a "$BUILD_DIR/make-output.txt"
$python_exe "${PYTHON_SCRIPT_DIR}/generate_stubs.py" -d "$PYTHON_SITE_PACKAGE_DIR" -m Sofa --use_pybind11 | tee -a "$BUILD_DIR/make-output.txt"
fi
echo "--------------- End Stubfiles generation ---------------" | tee -a "$BUILD_DIR/make-output.txt"
echo "-------------- Start packaging --------------" | tee -a "$BUILD_DIR/make-output.txt"
( call-make "$BUILD_DIR" "package" 2>&1 || touch "$BUILD_DIR/make-failed" ) | tee -a "$BUILD_DIR/make-output.txt"
echo "--------------- End packaging ---------------" | tee -a "$BUILD_DIR/make-output.txt"
Expand Down
2 changes: 1 addition & 1 deletion scripts/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ fi
# Compile
echo "[BEGIN] Build ($(time-date))"
time_millisec_build_begin="$(time-millisec)"
"$SCRIPT_DIR/compile.sh" "$BUILD_DIR" "$CONFIG"
"$SCRIPT_DIR/compile.sh" "$SRC_DIR" "$BUILD_DIR" "$CONFIG"
dashboard-notify "status=success"
github_status="success"
github_message="Build OK."
Expand Down

0 comments on commit 6eadb29

Please sign in to comment.