mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Add flat buffers generation script
This commit is contained in:
parent
f0c6e55da1
commit
02dc0aff2d
61
submodules/TelegramCore/FlatSerialization/macOS/generate.sh
Normal file
61
submodules/TelegramCore/FlatSerialization/macOS/generate.sh
Normal file
@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Default directories
|
||||
OUTPUT_DIR=""
|
||||
INPUT_DIR=""
|
||||
|
||||
# Parse command line arguments
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--output)
|
||||
OUTPUT_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
--input)
|
||||
INPUT_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "Unknown parameter: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Validate output directory
|
||||
if [ -z "$OUTPUT_DIR" ]; then
|
||||
echo "Error: --output argument is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$OUTPUT_DIR" ]; then
|
||||
echo "Error: Output directory does not exist: $OUTPUT_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate input directory
|
||||
if [ -z "$INPUT_DIR" ]; then
|
||||
echo "Error: --input argument is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$INPUT_DIR" ]; then
|
||||
echo "Error: Input directory does not exist: $INPUT_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove existing Swift files from output directory
|
||||
rm -f "$OUTPUT_DIR"/*.swift
|
||||
|
||||
# Get all .fbs files in Models directory
|
||||
models=$(ls "$INPUT_DIR"/*.fbs)
|
||||
|
||||
# Initialize empty flatc_input
|
||||
flatc_input=""
|
||||
|
||||
# Build space-separated list of model paths
|
||||
for model in $models; do
|
||||
flatc_input="$flatc_input $model"
|
||||
done
|
||||
|
||||
flatc --require-explicit-ids --swift -o "$OUTPUT_DIR" ${flatc_input}
|
Loading…
x
Reference in New Issue
Block a user