1
This commit is contained in:
@@ -8,10 +8,19 @@ if [ ! -x "$PYTHON" ]; then
|
||||
fi
|
||||
export PYINSTALLER_CONFIG_DIR="$ROOT/.build-tools/pyinstaller-cache"
|
||||
cd "$ROOT/native-engine"
|
||||
SOURCE_HASH="$(bash "$ROOT/native-engine/engine-fingerprint.sh")"
|
||||
"$PYTHON" -m PyInstaller --noconfirm --clean --onedir --windowed --name receipt-engine-helper \
|
||||
--osx-bundle-identifier test.reimburse.engine \
|
||||
--distpath "$ROOT/native-engine/dist" --workpath "$ROOT/native-engine/build" \
|
||||
--collect-all rapidocr_onnxruntime --collect-all onnxruntime \
|
||||
--collect-all pypdfium2 --collect-all pypdfium2_raw \
|
||||
--add-data "personal-expense-template.xlsx:." engine.py
|
||||
BINARY="$ROOT/native-engine/dist/receipt-engine-helper.app/Contents/MacOS/receipt-engine-helper"
|
||||
RECEIPT_ENGINE_BINARY="$BINARY" "$PYTHON" -m unittest discover -s tests -p test_exports.py -k engine_process -v
|
||||
if [ "$SOURCE_HASH" != "$(bash "$ROOT/native-engine/engine-fingerprint.sh")" ]; then
|
||||
echo "error: 打包期间引擎源码发生变化,请重新构建。" >&2
|
||||
exit 1
|
||||
fi
|
||||
BINARY_HASH="$(shasum -a 256 "$BINARY" | cut -d ' ' -f 1)"
|
||||
printf '%s\n%s\n' "$SOURCE_HASH" "$BINARY_HASH" > "$ROOT/native-engine/dist/receipt-engine-helper.source.sha256"
|
||||
echo "本地处理引擎已打包,可以在 Xcode 中运行 reimburse。"
|
||||
|
||||
Reference in New Issue
Block a user