1#!/bin/bash 2 3if [ "$#" -ne 2 ] 4 then 5 echo "Use: ./bump-version old_version new_version" 6 exit 7fi 8 9old_version=$1 10new_version=$2 11 12update_version() { 13 echo "Updating version from '$old_version' to '$new_version' in $1" 14 sed -i.bak s/$old_version/$new_version/g $1 15 rm $1.bak 16} 17 18update_version "README.md" 19update_version "kotlinx-coroutines-core/README.md" 20update_version "kotlinx-coroutines-debug/README.md" 21update_version "kotlinx-coroutines-test/README.md" 22update_version "ui/coroutines-guide-ui.md" 23update_version "ui/kotlinx-coroutines-android/example-app/gradle.properties" 24update_version "ui/kotlinx-coroutines-android/animation-app/gradle.properties" 25update_version "gradle.properties" 26 27# Escape dots, e.g. 1.0.0 -> 1\.0\.0 28escaped_old_version=$(echo $old_version | sed s/[.]/\\\\./g) 29result=$(find ./ -type f \( -iname \*.properties -o -iname \*.md \) | grep -v "\.gradle" | grep -v "build" | xargs -I{} grep -H "$escaped_old_version" {} | grep -v CHANGES.md | grep -v COMPATIBILITY.md) 30if [ -z "$result" ]; 31then 32 echo "Done" 33else 34 echo "ERROR: Previous version is present in the project: $result" 35 exit -1 36fi 37