Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 72 lines (61 sloc) 2.935 kB
b33af5b add the tycho equinox product build for jetty-7
hmalphettes authored
1 #!/bin/sh -e
9d3e5c5 @jmcc0nn3ll add jetty products
jmcc0nn3ll authored
2 # replace in all files the OLD_VERSION by the NEW_VERSION
3 # run and tested on linux.
4 # no need for windows support here although any community
5 # is always welcome to contibute such thing
6
7 #Make sure the current dir is the one of the script.
8 thisdir=`dirname $0`;
9 cd $thisdir
10 thisdir=`pwd`
11
12
13 if [ -z "$NEW_VERSION" ]; then
14 #use the first argument as the new version
15 if [ -n "$1" ]; then
16 NEW_VERSION=$1
17 else
18 echo "No NEW_VERSION defined."
19 exit 2
20 fi
21 fi
22 if [ -z "$OLD_VERSION" ]; then
23 #read it in the pom.xml
b33af5b add the tycho equinox product build for jetty-7
hmalphettes authored
24 line=`sed '/<version>.*-SNAPSHOT<\/version>/!d' pom.xml | head -1`
25 OLD_VERSION=`echo $line | sed 's/ /\//g' | sed 's/^<version>//g' | sed 's/-SNAPSHOT<\/version>//g'`
9d3e5c5 @jmcc0nn3ll add jetty products
jmcc0nn3ll authored
26 fi
27
28 # reconstruct the version and buildNumber aka qualifier.
29 # make the assumption that the completeVersion matches a 4 seg numbers.
30 #if it does not then make the assumption that this buildNumber is just the forced context qualifier and use
31 #the pom.xml's version for the rest of the version.
32 var=$(echo $NEW_VERSION | awk -F"." '{print $1,$2,$3}')
33 set -- $var
34 if [ -n "$1" -a -n "$2" -a -n "$3" ]; then
35 NEW_VERSION=$1.$2.$3
36 completeVersion="$NEW_VERSION.qualifier"
37 else
38 echo "Expecting a valid OSGi version: major.minor.update.qualifier; $NEW_VERSION is incorrect"
39 exit 2
40 fi
41 echo "$completeVersion"
42
43 if [ "$2" != "quiet" ]; then
44 echo "Change the version from $OLD_VERSION to $NEW_VERSION and set the forceContextQualifier to $buildNumber ? (default yes)"
45 read quiet
e7d0d6c @jmcc0nn3ll update to latest master version
jmcc0nn3ll authored
46 # [ -n "$quiet" ] && exit 0
9d3e5c5 @jmcc0nn3ll add jetty products
jmcc0nn3ll authored
47 echo "Executing..."
48 else
49 echo "Changing the version from $OLD_VERSION to $NEW_VERSION and set the forceContextQualifier to $buildNumber."
50 fi
51
52 #update the numbers for the release
53 #sed -i "s/<forceContextQualifier>.*<\/forceContextQualifier>/<forceContextQualifier>$buildNumber<\/forceContextQualifier>/" pom.xml
54 #update the jetty-version too
55 #sed -i "s/<jetty-version>.*<\/jetty-version>/<jetty-version>$completeVersion<\/jetty-version>/" pom.xml
56
57
58 #replace in the pom.xml
59 find . -name pom.xml -type f -exec sed -i 's/'$OLD_VERSION'/'$NEW_VERSION'/g' {} \;
60
61 #replace in the other eclipse files where they end with a .qualifier
62 OLD_VERSION_QUALIFIER="$OLD_VERSION.qualifier"
63 NEW_VERSION_QUALIFIER="$NEW_VERSION.qualifier"
64 echo "$OLD_VERSION_QUALIFIER -> $NEW_VERSION_QUALIFIER"
65 find . -type f -name feature.xml -exec sed -i "s/$OLD_VERSION_QUALIFIER/$NEW_VERSION_QUALIFIER/g" {} \;
66 find . -type f -name categories.xml -exec sed -i "s/$OLD_VERSION_QUALIFIER/$NEW_VERSION_QUALIFIER/g" {} \;
67 find . -type f -name category.xml -exec sed -i "s/$OLD_VERSION_QUALIFIER/$NEW_VERSION_QUALIFIER/g" {} \;
68 find . -type f -name site.xml -exec sed -i "s/$OLD_VERSION_QUALIFIER/$NEW_VERSION_QUALIFIER/g" {} \;
69 find . -type f -name MANIFEST.MF -exec sed -i "s/$OLD_VERSION_QUALIFIER/$NEW_VERSION_QUALIFIER/g" {} \;
70 find . -type f -name *.product -exec sed -i "s/$OLD_VERSION_QUALIFIER/$NEW_VERSION_QUALIFIER/g" {} \;
71
Something went wrong with that request. Please try again.