forked from zkoss/zkthemes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upVer
82 lines (77 loc) · 2.13 KB
/
upVer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
# release
#
#{{IS_NOTE
# Purpose:
#
# Description:
#
# History:
# Tue Mar 3 11:11:09 2011, Created by Jimmy
#}}IS_NOTE
#
#Copyright (C) 2011 Potix Corporation. All Rights Reserved.
#
#{{IS_RIGHT
#}}IS_RIGHT
#
maindir="$(pwd)"
maindir="${maindir%/cmldoc}"
cd $maindir
echo "Working directory $maindir"
stamp=$(date +%Y%m%d)
target=$1
oldVersion=$2
newVersion=$3
isFL=$4
if [ "$3" == "" ] || [ "$3" == "FL" ] ; then
target=""
oldVersion=$1
newVersion=$2
isFL=$3
fi
if [ "$oldVersion" == "" ] || [ "$newVersion" == "" ] ; then
echo "Usage: upVer [ sapphire | etc..] [ oldVersion ] [ newVersion ] [ FL ]"
exit 1
fi
function upVer {
if [ "$1" != "zkthemedemo" ] ; then
sed -i "s/$oldVersion/$newVersion/g" $maindir/$1/version
fi
if [ "$isFL" == "FL" ] ; then
sed -i "1,/description/s/version>.*<\/version/version>$newVersion-SNAPSHOT<\/version/" $maindir/$1/pom.xml
else
sed -i "1,/description/s/version>.*<\/version/version>$newVersion<\/version/" $maindir/$1/pom.xml
fi
find $maindir/$1/src -name config.xml -exec sed -i "s/version-uid>.*<\/version-uid/version-uid>$newVersion<\/version-uid/" {} \;
find $maindir/$1/src -name lang-addon.xml -exec sed -i "s/version-uid>.*<\/version-uid/version-uid>$newVersion<\/version-uid/" {} \;
find $maindir/$1/src -name Version.java -exec sed -i "s/UID.*;/UID = \"$newVersion\";/g" {} \;
echo "Update $1 version to $newVersion"
}
#parent project
sed -i "s/$oldVersion/$newVersion/g" version
if [ "$isFL" == "FL" ] ; then
sed -i "1,/version>.*<\/version/s/version>.*<\/version/version>$newVersion-SNAPSHOT<\/version/" pom.xml
else
sed -i "1,/version>.*<\/version/s/version>.*<\/version/version>$newVersion<\/version/" pom.xml
fi
if [ "$target" != "" ] ; then
upVer $target
else
targetListOld="$(cat build.projects | tr '\n' ' ')"
# TODO: add zkthemedemo
targetListOld="${targetListOld% }"
targetList=
for target in $targetListOld ; do
targetList="$targetList $target"
done
targetList="$targetList zkthemedemo breeze"
echo "targets: ${targetList}"
for target in $targetList ; do
if [ -d $target ] ; then
upVer $target
else
echo "Ignore: $target doesn't exist"
fi
done
fi