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 2.0
6 # which accompanies this distribution, and is available at
7 # https://www.eclipse.org/legal/epl-2.0/
9 # SPDX-License-Identifier: EPL-2.0
11 # Update all pom.xml with new build number
13 # TODO(spearce) This should be converted to some sort of
14 # Java based Maven plugin so its fully portable.
24 V
=$
(echo "$1" | perl
-pe 's/^--snapshot=//')
27 echo >&2 "usage: $0 --snapshot=0.n.0"
38 V
=$
(git describe HEAD
) ||
exit
48 echo >&2 "usage: $0 {--snapshot=0.n.0 | --release} [--jgit=0.n.0]"
54 v
*) V
=$
(echo "$V" | perl
-pe s
/^v
//) ;;
56 echo >&2 "usage: $0 {--snapshot=0.n.0 | --release}"
63 OSGI_V
="${V%%-SNAPSHOT}.qualifier"
66 POM_V
=$
(echo "$V" | perl
-pe 's/-(\d+-g.*)$/.$1/')
68 $ARGV[0] =~ /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?-(\d+)-g(.*)$/;
69 my ($a, $b, $c, $p, $r) = ($1, $2, $3, $4, $5);
70 $b = '0' unless defined $b;
71 $c = '0' unless defined $c;
73 printf "%s.%s.%s.%6.6i_g%s\n", $a, $b, $c, $p, $r;
84 $ARGV[0] =~ /^(\d+(?:\.\d+(?:\.\d+)?)?)/;
91 $ARGV[0] =~ /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?/;
92 my ($a, $b) = ($1, $2);
93 $b = 0 unless defined $b;
99 EGIT_V
=$
(to_version
"$V")
100 EGIT_N
=$
(next_version
"$EGIT_V")
103 JGIT_V
=$
(to_version
"$J")
104 JGIT_N
=$
(next_version
"$JGIT_V")
107 s/^(Bundle-Version:\s*).*$/${1}'"$OSGI_V"'/;
108 s/(org.eclipse.egit.*;version=")[^"[(]*(")/${1}'"$EGIT_V"'${2}/;
109 s/(org.eclipse.egit.*;version="\[)[^"]*(\)")/${1}'"$EGIT_V,$EGIT_N"'${2}/;
110 s/(org.eclipse.egit.*;bundle-version="\[)[^"]*(\)")/${1}'"$EGIT_V,$EGIT_N"'${2}/;
111 s/(org.eclipse.jgit.*;version="\[)[^"]*(\)")/${1}'"$JGIT_V,$JGIT_N"'${2}/;
112 s/(org.eclipse.jgit;bundle-version="\[)[^"]*(\)")/${1}'"$JGIT_V,$JGIT_N"'${2}/;
113 ' $
(git ls-files |
grep META-INF
/MANIFEST.MF
)
116 if ($ARGV ne $old_argv) {
120 if (!$seen_version) {
121 $seen_version = 1 if (!/<\?xml/ &&
122 s/(version=")[^"]*(")/${1}'"$OSGI_V"'${2}/);
124 s/(feature="org.eclipse.egit" version=")[^"]*(")/${1}'"$EGIT_V"'${2}/;
125 ' org.eclipse.egit.mylyn-feature
/feature.xml
128 if ($ARGV ne $old_argv) {
132 if (!$seen_version) {
133 $seen_version = 1 if (!/<\?xml/ &&
134 s/(version=")[^"]*(")/${1}'"$OSGI_V"'${2}/);
136 s/(plugin="org.eclipse.egit.core" version=")[^"]*(")/${1}'"$EGIT_V"'${2}/;
137 s/(plugin="org.eclipse.egit.ui" version=")[^"]*(")/${1}'"$EGIT_V"'${2}/;
138 ' org.eclipse.egit.gitflow-feature
/feature.xml
141 if ($ARGV ne $old_argv) {
145 if (!$seen_version) {
146 $seen_version = 1 if (!/<\?xml/ &&
147 s/(version=")[^"]*(")/${1}'"$OSGI_V"'${2}/);
149 s/(feature="org.eclipse.jgit" version=")[^"]*(")/${1}'"$JGIT_V"'${2}/;
150 ' $
(git ls-files |
grep feature.xml
)
153 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
154 ' org.eclipse.egit-feature
/pom.xml
157 if ($ARGV ne $old_argv) {
161 if (!$seen_version) {
163 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
165 s{<(egit-version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
169 if ($ARGV ne $old_argv) {
173 if ($seen_version < 2) {
175 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
177 ' org.eclipse.egit.repository
/pom.xml
180 if ($ARGV ne $old_argv) {
185 if (!$seen_version) {
187 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
189 if ($seen_version2 < 2) {
191 s|(<version\>)([\.\d]*)(\</version\>)|${1}'$EGIT_V'${3}|;
193 ' org.eclipse.egit.ui.test
/pom.xml
196 if ($ARGV ne $old_argv) {
201 if (!$seen_version) {
203 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
205 if ($seen_version2 < 3) {
207 s|(<version\>)([\.\d]*)(\</version\>)|${1}'$EGIT_V'${3}|;
209 ' org.eclipse.egit.mylyn.ui.test
/pom.xml
212 if ($ARGV ne $old_argv) {
216 if (!$seen_version) {
218 s{<(version)>[^<\$]*</\1>}{<${1}>'"$POM_V"'</${1}>};
220 s{<(jgit-version)>[^<]*</\1>}{<${1}>'"$J"'</${1}>};
221 ' $
(git ls-files |
grep pom.xml
)
223 find .
-name '*~' |
xargs rm -f