<commit_before>#!/bin/bash -x
if (( $# != 2 )); then
    echo "Improper usage of this script. Please invoke with arguments <OLD_VERSION> <NEW_VERSION> "
    exit 1
fi

os=`uname`

function _sed {
    if [[ "$os" =~ "Linux" ]]; then
        sed -i -e "$1" ${@:2}
    else
        sed -i '' -e "$1" ${@:2}
    fi
}

oldVersion=$1
newVersion=$2
oldVersionWithoutSnapshot=`echo $oldVersion | sed -e "s/-SNAPSHOT//g"`
newVersionWithoutSnapshot=`echo $newVersion | sed -e "s/-SNAPSHOT//g"`
IFS='.' read -a version <<< "$newVersionWithoutSnapshot"

_sed 's/set(JOYNR_MAJOR_VERSION .*)/set(JOYNR_MAJOR_VERSION '${version[0]}')/g' cpp/CMakeLists.txt
_sed 's/set(JOYNR_MINOR_VERSION .*)/set(JOYNR_MINOR_VERSION '${version[1]}')/g' cpp/CMakeLists.txt
_sed 's/set(JOYNR_PATCH_VERSION .*)/set(JOYNR_PATCH_VERSION '${version[2]}')/g' cpp/CMakeLists.txt

_sed 's/find_package(Joynr .*/find_package(Joynr '${newVersionWithoutSnapshot}' REQUIRED)/g' \
examples/radio-app/CMakeLists.txt \
tests/inter-language-test/CMakeLists.txt \
tests/performance-test/CMakeLists.txt \
tests/robustness-test/CMakeLists.txt \
tests/system-integration-test/sit-cpp-app/CMakeLists.txt

mvn versions:set -P android,javascript -DnewVersion=$2
mvn versions:commit -P android,javascript

_sed 's/'$oldVersion'/'$newVersion'/g' \
cpp/CMakeLists.txt \
tests/inter-language-test/CMakeLists.txt \
tests/inter-language-test/package.json \
tests/performance-test/CMakeLists.txt \
tests/performance-test/package.json \
tests/robustness-test/CMakeLists.txt \
tests/robustness-test/package.json \
tests/system-integration-test/sit-cpp-app/CMakeLists.txt \
tests/system-integration-test/sit-node-app/package.json \
tests/test-base/src/main/js/package.json \
examples/radio-app/CMakeLists.txt \
android/robolectric-integration-tests/src/test/AndroidManifest.xml \
android/robolectric-unittests/src/main/AndroidManifest.xml \
examples/android-location-provider/AndroidManifest.xml \
examples/android-location-consumer/AndroidManifest.xml \
java/backend-services/discovery-directory-servlet/pom.xml \
java/backend-services/domain-access-controller-servlet/pom.xml \
examples/radio-node/pom.xml \
examples/radio-node/package.json \
javascript/libjoynr-js/src/main/resources/package.json

_sed 's/clustercontroller-standalone-'${oldVersion}'.jar/clustercontroller-standalone-'${newVersion}'.jar/g' \
java/core/clustercontroller-standalone/README

_sed 's/Version:        '${oldVersionWithoutSnapshot}'/Version:        '${newVersionWithoutSnapshot}'/g' \
cpp/distribution/joynr.spec \
tests/system-integration-test/docker/onboard/joynr-without-test.spec

echo "prepare git patch"

countFoundOldVersions=$(git grep ${oldVersion} * | grep -v ReleaseNotes | wc -l)
if (($countFoundOldVersions > 0)); then
    echo "WARNING: a grep over your workspace emphasised that the oldVersion is still present in some of your resources. Please check manually!"
    git grep ${oldVersion} * | grep -v ReleaseNotes
else
    git add -A && git commit -m "[Release] set version to $newVersion"
fi<commit_msg>[Tools] Fix grep command in setVersions.sh<commit_after>#!/bin/bash -x
if (( $# != 2 )); then
    echo "Improper usage of this script. Please invoke with arguments <OLD_VERSION> <NEW_VERSION> "
    exit 1
fi

os=`uname`

function _sed {
    if [[ "$os" =~ "Linux" ]]; then
        sed -i -e "$1" ${@:2}
    else
        sed -i '' -e "$1" ${@:2}
    fi
}

oldVersion=$1
newVersion=$2
oldVersionWithoutSnapshot=`echo $oldVersion | sed -e "s/-SNAPSHOT//g"`
newVersionWithoutSnapshot=`echo $newVersion | sed -e "s/-SNAPSHOT//g"`
IFS='.' read -a version <<< "$newVersionWithoutSnapshot"

_sed 's/set(JOYNR_MAJOR_VERSION .*)/set(JOYNR_MAJOR_VERSION '${version[0]}')/g' cpp/CMakeLists.txt
_sed 's/set(JOYNR_MINOR_VERSION .*)/set(JOYNR_MINOR_VERSION '${version[1]}')/g' cpp/CMakeLists.txt
_sed 's/set(JOYNR_PATCH_VERSION .*)/set(JOYNR_PATCH_VERSION '${version[2]}')/g' cpp/CMakeLists.txt

_sed 's/find_package(Joynr .*/find_package(Joynr '${newVersionWithoutSnapshot}' REQUIRED)/g' \
examples/radio-app/CMakeLists.txt \
tests/inter-language-test/CMakeLists.txt \
tests/performance-test/CMakeLists.txt \
tests/robustness-test/CMakeLists.txt \
tests/system-integration-test/sit-cpp-app/CMakeLists.txt

mvn versions:set -P android,javascript -DnewVersion=$2
mvn versions:commit -P android,javascript

_sed 's/'$oldVersion'/'$newVersion'/g' \
cpp/CMakeLists.txt \
tests/inter-language-test/CMakeLists.txt \
tests/inter-language-test/package.json \
tests/performance-test/CMakeLists.txt \
tests/performance-test/package.json \
tests/robustness-test/CMakeLists.txt \
tests/robustness-test/package.json \
tests/system-integration-test/sit-cpp-app/CMakeLists.txt \
tests/system-integration-test/sit-node-app/package.json \
tests/test-base/src/main/js/package.json \
examples/radio-app/CMakeLists.txt \
android/robolectric-integration-tests/src/test/AndroidManifest.xml \
android/robolectric-unittests/src/main/AndroidManifest.xml \
examples/android-location-provider/AndroidManifest.xml \
examples/android-location-consumer/AndroidManifest.xml \
java/backend-services/discovery-directory-servlet/pom.xml \
java/backend-services/domain-access-controller-servlet/pom.xml \
examples/radio-node/pom.xml \
examples/radio-node/package.json \
javascript/libjoynr-js/src/main/resources/package.json

_sed 's/clustercontroller-standalone-'${oldVersion}'.jar/clustercontroller-standalone-'${newVersion}'.jar/g' \
java/core/clustercontroller-standalone/README

_sed 's/Version:        '${oldVersionWithoutSnapshot}'/Version:        '${newVersionWithoutSnapshot}'/g' \
cpp/distribution/joynr.spec \
tests/system-integration-test/docker/onboard/joynr-without-test.spec

echo "prepare git patch"

countFoundOldVersions=$(git grep -F ${oldVersion} * | grep -v ReleaseNotes | wc -l)
if (($countFoundOldVersions > 0)); then
    echo "WARNING: a grep over your workspace emphasised that the oldVersion is still present in some of your resources. Please check manually!"
    git grep -F ${oldVersion} * | grep -v ReleaseNotes
else
    git add -A && git commit -m "[Release] set version to $newVersion"
fi
{'fraction_non_alphanumeric': 0.14927085040144192, 'fraction_numerical': 0.004260199901687694, 'mean_word_length': 4.574429223744292, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6246211', 'n_tokens_mistral': 2221, 'n_tokens_neox': 2104, 'n_words': 362}