3131 # 1. CMakeLists.txt
3232 if [ -f CMakeLists.txt ]; then
3333 echo "updating cmakelists.txt"
34- # match VERSION only within the project block
3534 sed -i "/project[[:space:]]*([[:space:]]*jsoncpp/,/)/ s/VERSION [0-9.]*/VERSION $VER/" CMakeLists.txt
3635 if [ -n "$SOVER" ]; then
3736 sed -i "s/set(PROJECT_SOVERSION [0-9]*/set(PROJECT_SOVERSION $SOVER/" CMakeLists.txt
@@ -41,31 +40,36 @@ jobs:
4140 # 2. meson.build
4241 if [ -f meson.build ]; then
4342 echo "updating meson.build"
44- # match version : 'x.y.z' with flexible quotes and spacing
4543 sed -i "s/version[[:space:]]*:[[:space:]]*['\"][0-9.]*['\"]/version : '$VER'/" meson.build
4644 if [ -n "$SOVER" ]; then
47- # matches soversion : '26'
4845 sed -i "s/soversion[[:space:]]*:[[:space:]]*['\"][0-9]*['\"]/soversion : '$SOVER'/" meson.build
4946 fi
5047 fi
5148
52- # 3. vcpkg.json
49+ # 3. MODULE.bazel
50+ if [ -f MODULE.bazel ]; then
51+ echo "updating MODULE.bazel"
52+ # matches: version = "1.9.6"
53+ sed -i "s/version[[:space:]]*=[[:space:]]*['\"][0-9.]*['\"]/version = \"$VER\"/" MODULE.bazel
54+ fi
55+
56+ # 4. vcpkg.json
5357 if [ -f vcpkg.json ]; then
5458 echo "updating vcpkg.json"
5559 jq ".version = \"$VER\"" vcpkg.json > vcpkg.json.tmp && mv vcpkg.json.tmp vcpkg.json
5660 fi
5761
58- # 4 . include/json/version.h
62+ # 5 . include/json/version.h
5963 if [ -f include/json/version.h ]; then
6064 echo "updating version.h"
61- # 1.9.7.12 -> MAJOR=1, MINOR=9, PATCH=7, QUALIFIER=12
6265 IFS='.' read -r MAJOR MINOR PATCH QUALIFIER <<< "$VER"
6366
6467 sed -i "s|#define JSONCPP_VERSION_STRING \"[^\"]*\"|#define JSONCPP_VERSION_STRING \"$VER\"|" include/json/version.h
6568 sed -i "s|#define JSONCPP_VERSION_MAJOR [0-9]*|#define JSONCPP_VERSION_MAJOR $MAJOR|" include/json/version.h
6669 sed -i "s|#define JSONCPP_VERSION_MINOR [0-9]*|#define JSONCPP_VERSION_MINOR $MINOR|" include/json/version.h
6770 sed -i "s|#define JSONCPP_VERSION_PATCH [0-9]*|#define JSONCPP_VERSION_PATCH $PATCH|" include/json/version.h
6871
72+ # set qualifier to the number if 4th part exists, otherwise leave blank
6973 if [ -n "$QUALIFIER" ]; then
7074 sed -i "s|#define JSONCPP_VERSION_QUALIFIER.*|#define JSONCPP_VERSION_QUALIFIER $QUALIFIER|" include/json/version.h
7175 else
0 commit comments