2 # Copyright (C) 2009, Google Inc.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Eclipse Public License v1.0
6 # which accompanies this distribution, and is available at
7 # http://www.eclipse.org/legal/epl-v10.html
9 # Update all pom.xml with new build number
11 # TODO(spearce) This should be converted to some sort of
12 # Java based Maven plugin so its fully portable.
22 V
=$
(echo "$1" | perl
-pe 's/^--snapshot=//')
25 echo >&2 "usage: $0 --snapshot=0.n.0"
36 V
=$
(git describe HEAD
) ||
exit
46 echo >&2 "usage: $0 {--snapshot=0.n.0 | --release} [--jgit=0.n.0]"
52 v
*) V
=$
(echo "$V" | perl
-pe s
/^v
//) ;;
54 echo >&2 "usage: $0 {--snapshot=0.n.0 | --release}"
61 OSGI_V
="${V%%-SNAPSHOT}.qualifier"
64 POM_V
=$
(echo "$V" | perl
-pe 's/-(\d+-g.*)$/.$1/')
66 $ARGV[0] =~ /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?-(\d+)-g(.*)$/;
67 my ($a, $b, $c, $p, $r) = ($1, $2, $3, $4, $5);
68 $b = '0' unless defined $b;
69 $c = '0' unless defined $c;
71 printf "%s.%s.%s.%6.6i_g%s\n", $a, $b, $c, $p, $r;
82 $ARGV[0] =~ /^(\d+(?:\.\d+(?:\.\d+)?)?)/;
89 $ARGV[0] =~ /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?/;
90 my ($a, $b) = ($1, $2);
91 $b = 0 unless defined $b;
97 EGIT_V
=$
(to_version
"$V")
98 EGIT_N
=$
(next_version
"$EGIT_V")
101 JGIT_V
=$
(to_version
"$J")
102 JGIT_N
=$
(next_version
"$JGIT_V")
105 s/^(Bundle-Version:\s*).*$/${1}'"$OSGI_V"'/;
106 s/(org.eclipse.egit.*;version=")[^"[(]*(")/${1}'"$EGIT_V"'${2}/;
107 s/(org.eclipse.egit.*;version="\[)[^"]*(\)")/${1}'"$EGIT_V,$EGIT_N"'${2}/;
108 s/(org.eclipse.jgit.*;version="\[)[^"]*(\)")/${1}'"$JGIT_V,$JGIT_N"'${2}/;
109 ' $
(git ls-files |
grep META-INF
/MANIFEST.MF
)
112 if ($ARGV ne $old_argv) {
116 if ($seen_version < 2) {
117 $seen_version++ if (!/<\?xml/ &&
118 s/(version=")[^"]*(")/${1}'"$OSGI_V"'${2}/);
120 s/(feature="org.eclipse.egit" version=")[^"]*(")/${1}'"$EGIT_V"'${2}/;
121 ' org.eclipse.egit.mylyn-feature
/feature.xml
124 if ($ARGV ne $old_argv) {
128 if (!$seen_version) {
129 $seen_version = 1 if (!/<\?xml/ &&
130 s/(version=")[^"]*(")/${1}'"$OSGI_V"'${2}/);
132 s/(feature="org.eclipse.jgit" version=")[^"]*(")/${1}'"$JGIT_V"'${2}/;
133 ' $
(git ls-files |
grep feature.xml
)
136 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
137 ' org.eclipse.egit-feature
/pom.xml
140 if ($ARGV ne $old_argv) {
144 if (!$seen_version) {
146 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
148 s{<(egit-version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
152 if ($ARGV ne $old_argv) {
156 if ($seen_version < 2) {
158 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
160 ' org.eclipse.egit.repository
/pom.xml
163 if ($ARGV ne $old_argv) {
168 if (!$seen_version) {
170 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
172 if ($seen_version2 < 2) {
174 s|(<version\>)([\.\d]*)(\</version\>)|${1}'$EGIT_V'${3}|;
176 ' org.eclipse.egit.ui.test
/pom.xml
179 if ($ARGV ne $old_argv) {
184 if (!$seen_version) {
186 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
188 if ($seen_version2 < 3) {
190 s|(<version\>)([\.\d]*)(\</version\>)|${1}'$EGIT_V'${3}|;
192 ' org.eclipse.egit.mylyn.ui.test
/pom.xml
195 if ($ARGV ne $old_argv) {
199 if (!$seen_version) {
201 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
203 s{<(jgit-version)>[^<]*</\1>}{<${1}>'"$J"'</${1}>};
204 ' $
(git ls-files |
grep pom.xml
)
206 find .
-name '*~' |
xargs rm -f