2021-01-29 10:12:13 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
VIRTUAL_ENV=$TMPDIR/venv-sdk
|
|
|
|
export VIRTUAL_ENV
|
|
|
|
PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
|
|
export PATH
|
|
|
|
|
2021-02-03 09:53:02 +03:00
|
|
|
TEMP_FILE="$TMPDIR/venv-sdk/auto_temp.json"
|
|
|
|
# generate code
|
2022-10-18 09:05:46 +03:00
|
|
|
python -m packaging_tools.sdk_generator "$1" "$TEMP_FILE" 2>&1
|
2021-01-29 10:12:13 +03:00
|
|
|
echo "[Generate] codegen done!!!"
|
2021-02-03 09:53:02 +03:00
|
|
|
if [ ! -f "$TEMP_FILE" ]; then
|
|
|
|
echo "[Autorest]$TEMP_FILE does not exist!!!Error happened during codegen"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-01-29 10:12:13 +03:00
|
|
|
|
2024-08-27 10:26:45 +03:00
|
|
|
if [ -f "$2" ]; then
|
|
|
|
rm "$2"
|
|
|
|
fi
|
|
|
|
|
2021-02-03 09:53:02 +03:00
|
|
|
# package
|
2022-10-18 09:05:46 +03:00
|
|
|
python -m packaging_tools.sdk_package "$TEMP_FILE" "$2" 2>&1
|
2021-02-03 09:53:02 +03:00
|
|
|
echo "[Generate] generate done!!!"
|
2021-01-29 10:12:13 +03:00
|
|
|
if [ ! -f "$2" ]; then
|
2021-02-03 09:53:02 +03:00
|
|
|
echo "[Autorest]$2 does not exist!!!Error happened during package"
|
|
|
|
exit 1
|
2021-02-02 10:03:24 +03:00
|
|
|
fi
|