-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add a script to update version number
- Loading branch information
1 parent
35b1477
commit d400049
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
# Usage | ||
if [[ $# -ne 1 ]]; then | ||
echo "This script will update LCSF Generator version number." | ||
echo "Script usage: $0 <version_number>" | ||
exit -1 | ||
fi | ||
|
||
VER_NB=$1 | ||
CMAKELISTS_PATH=./CMakeLists.txt | ||
TESTS_DATA=./tests/test_data.cpp | ||
DATA_DIR=./tests/data | ||
BRIDGE_H_PATH=$DATA_DIR/model_bridge.h | ||
BRIDGE_AC_PATH=$DATA_DIR/model_bridge_a.c | ||
BRIDGE_BC_PATH=$DATA_DIR/model_bridge_b.c | ||
DESC_PATH=$DATA_DIR/model_desc.h | ||
MAIN_H_PATH=$DATA_DIR/model_main.h | ||
MAIN_AC_PATH=$DATA_DIR/model_main_a.c | ||
MAIN_BC_PATH=$DATA_DIR/model_main_b.c | ||
RAWMAIN_H_PATH=$DATA_DIR/model_raw_main.h | ||
RAWMAIN_AC_PATH=$DATA_DIR/model_raw_main_a.c | ||
RAWMAIN_BC_PATH=$DATA_DIR/model_raw_main_b.c | ||
FILE_LIST=($TESTS_DATA $BRIDGE_H_PATH $BRIDGE_AC_PATH $BRIDGE_BC_PATH $DESC_PATH $MAIN_H_PATH $MAIN_AC_PATH $MAIN_BC_PATH $RAWMAIN_H_PATH $RAWMAIN_AC_PATH $RAWMAIN_BC_PATH) | ||
|
||
# Modify CMakeFiles | ||
sed -i -e "s/\(LCSF_Generator LANGUAGES CXX VERSION \).*)/\1$VER_NB)/" $CMAKELISTS_PATH | ||
|
||
# Parse model files | ||
for FILE in ${FILE_LIST[@]}; do | ||
if [[ ! -f "$FILE" ]]; then | ||
echo "$FILE doesn't exist." | ||
exit -1 | ||
fi | ||
sed -i -e "s/\(LCSF Generator v\).*/\1${VER_NB}/" ${FILE} | ||
done | ||
echo "Version change done." |