35
35
36
36
# Find the version files in this directory or its descendants, but don't recurse too deep.
37
37
# 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)$' )
39
39
40
40
# Edit the version files.
41
41
for FILE in ${VERSFILES} ; do
@@ -55,12 +55,18 @@ for FILE in ${VERSFILES} ; do
55
55
fi
56
56
;;
57
57
58
+ version.go)
59
+ sed ' s/const Version = ".*"/const Version = "' " ${NEWVERS} " ' "/' " ${FILE} " > " ${FILE} .tmp"
60
+ mv " ${FILE} .tmp" " ${FILE} "
61
+ ;;
62
+
58
63
package.json)
59
- if [ " $( dirname " ${FILE} " ) " = " ." ] ; then
64
+ if [ " ${DIR} " = " ." ] ; then
60
65
# This is the root package.json, so we want .version.
61
66
jq --indent 4 " .version=\" ${NEWVERS} \" " " ${FILE} " > " ${FILE} .new"
62
67
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) "
64
70
jq --indent 4 " .dependencies[\" ${ROOTJSNAME} \" ]=\" ^${NEWVERS} \" " " ${FILE} " > " ${FILE} .new"
65
71
fi
66
72
mv " ${FILE} .new" " ${FILE} "
@@ -70,7 +76,7 @@ for FILE in ${VERSFILES} ; do
70
76
# Replace -foo with -SNAPSHOT to be compatible with Java conventions.
71
77
JAVAVERS=" ${NEWVERS/ -*/ -SNAPSHOT} "
72
78
73
- if [ " $( dirname " ${FILE} " ) " = " ." ] ; then
79
+ if [ " ${DIR} " = " ." ] ; then
74
80
# This is the root pom.xml, so we want /m:project/m:version.
75
81
xmlstarlet ed -L -P -N m=" http://maven.apache.org/POM/4.0.0" -u " /m:project/m:version" -v " ${JAVAVERS} " " ${FILE} "
76
82
else
0 commit comments