3535
3636# Find the version files in this directory or its descendants, but don't recurse too deep.
3737# This line must be kept in sync with "bump-version.get.sh".
38- VERSFILES=$( find . -maxdepth 3 ! -path ./.git/\* | grep -v /node_modules/ | grep -E ' .*/(version|Cargo.toml|package.json|pom.xml|version.sbt)$' )
38+ VERSFILES=$( find . -maxdepth 3 ! -path ./.git/\* | grep -v /node_modules/ | grep -E ' .*/(version|Cargo.toml|version.go| package.json|pom.xml|version.sbt)$' )
3939
4040# Edit the version files.
4141for FILE in ${VERSFILES} ; do
@@ -55,12 +55,18 @@ for FILE in ${VERSFILES} ; do
5555 fi
5656 ;;
5757
58+ version.go)
59+ sed ' s/const Version = ".*"/const Version = "' " ${NEWVERS} " ' "/' " ${FILE} " > " ${FILE} .tmp"
60+ mv " ${FILE} .tmp" " ${FILE} "
61+ ;;
62+
5863 package.json)
59- if [ " $( dirname " ${FILE} " ) " = " ." ] ; then
64+ if [ " ${DIR} " = " ." ] ; then
6065 # This is the root package.json, so we want .version.
6166 jq --indent 4 " .version=\" ${NEWVERS} \" " " ${FILE} " > " ${FILE} .new"
6267 else
63- # We already know the root package name from above, so reuse that here.
68+ # Get the root package's name.
69+ ROOTJSNAME=" $( jq -re ' .name' < package.json) "
6470 jq --indent 4 " .dependencies[\" ${ROOTJSNAME} \" ]=\" ^${NEWVERS} \" " " ${FILE} " > " ${FILE} .new"
6571 fi
6672 mv " ${FILE} .new" " ${FILE} "
@@ -70,7 +76,7 @@ for FILE in ${VERSFILES} ; do
7076 # Replace -foo with -SNAPSHOT to be compatible with Java conventions.
7177 JAVAVERS=" ${NEWVERS/ -*/ -SNAPSHOT} "
7278
73- if [ " $( dirname " ${FILE} " ) " = " ." ] ; then
79+ if [ " ${DIR} " = " ." ] ; then
7480 # This is the root pom.xml, so we want /m:project/m:version.
7581 xmlstarlet ed -L -P -N m=" http://maven.apache.org/POM/4.0.0" -u " /m:project/m:version" -v " ${JAVAVERS} " " ${FILE} "
7682 else
0 commit comments